添加鼠标事件拦截
This commit is contained in:
@@ -361,3 +361,15 @@ void set_window_fullscreen_state(xcb_window_t window, bool fullscreen) {
|
||||
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, window, atom,
|
||||
XCB_ATOM_WINDOW, 32, data_len, &atom);
|
||||
}
|
||||
|
||||
void ungrab_any_button(xcb_window_t window) {
|
||||
xcb_ungrab_button(conn, XCB_BUTTON_INDEX_ANY, window, XCB_MOD_MASK_ANY);
|
||||
}
|
||||
|
||||
void grab_button(xcb_window_t window, uint8_t button, uint16_t modifiers) {
|
||||
uint8_t owner_events = false; /* 事件仅发送给抓取者,不发送给其他窗口 */
|
||||
uint16_t event_mask =
|
||||
XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE;
|
||||
xcb_grab_button(conn, owner_events, window, event_mask, XCB_GRAB_MODE_SYNC,
|
||||
XCB_GRAB_MODE_ASYNC, XCB_NONE, XCB_NONE, button, modifiers);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user