@@ -49,8 +49,18 @@ function button_xcb(button::MouseButton)
49
49
button == BUTTON_SCROLL_DOWN && return XCB_BUTTON_INDEX_5
50
50
end
51
51
52
+ function detail_xcb_button (button:: MouseButton ):: xcb_button_t
53
+ button == BUTTON_NONE && return 0
54
+ button == BUTTON_LEFT && return 1
55
+ button == BUTTON_MIDDLE && return 2
56
+ button == BUTTON_RIGHT && return 3
57
+ button == BUTTON_SCROLL_UP && return 4
58
+ button == BUTTON_SCROLL_DOWN && return 5
59
+ error (" Unknown button $button " )
60
+ end
61
+
52
62
function detail_xcb (wm:: XWindowManager , event:: Event )
53
- event. type in BUTTON_EVENT && return xcb_button_t ( iszero ( event. mouse_event. button) ? 0 : log2 ( Int (event . mouse_event . button)) )
63
+ event. type in BUTTON_EVENT && return detail_xcb_button ( event. mouse_event. button)
54
64
event. type in KEY_EVENT && return PhysicalKey (wm. keymap, event. key_event. key_name). code
55
65
event. type == POINTER_MOVED && return UInt8 (XCB_MOTION_NORMAL)
56
66
event. type == POINTER_ENTERED && return XCB_ENTER_NOTIFY
82
92
83
93
hex (x) = " 0x$(string (x, base= 16 )) "
84
94
85
- function send_event (wm:: XWindowManager , win:: XCBWindow , event_type:: EventType , data = nothing ; location = (0.0 , 0.0 ))
86
- send_event (wm, Event (event_type, data, location, floor ( time ()) , win))
95
+ function send_event (wm:: XWindowManager , win:: XCBWindow , event_type:: EventType , data = nothing ; location = (0.0 , 0.0 ), time = time () )
96
+ send_event (wm, Event (event_type, data, location, time, win))
87
97
end
88
98
89
- send_event (wm:: XWindowManager , win:: XCBWindow ) = (event_type, data = nothing ; location = (0.0 , 0.0 )) -> send_event (wm, win, event_type, data; location)
99
+ send_event (wm:: XWindowManager , win:: XCBWindow ) = (event_type, data = nothing ; location = (0.0 , 0.0 ), time = time ()) -> send_event (wm, win, event_type, data; location, time )
90
100
91
101
struct WindowRef <: AbstractWindow
92
102
number:: Int64
0 commit comments