mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
backend/x11: Hide cursor with Xfixes
This commit is contained in:
parent
70ae76304e
commit
d3ee69f76b
5 changed files with 59 additions and 22 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#endif
|
||||
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xfixes.h>
|
||||
#include <xcb/xinput.h>
|
||||
|
||||
#include <wlr/interfaces/wlr_input_device.h>
|
||||
|
|
@ -164,6 +165,36 @@ void handle_x11_xinput_event(struct wlr_x11_backend *x11,
|
|||
x11->time = ev->time;
|
||||
break;
|
||||
}
|
||||
case XCB_INPUT_ENTER: {
|
||||
xcb_input_enter_event_t *ev = (xcb_input_enter_event_t *)event;
|
||||
|
||||
output = get_x11_output_from_window_id(x11, ev->event);
|
||||
if (!output) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!output->cursor_hidden) {
|
||||
xcb_xfixes_hide_cursor(x11->xcb, output->win);
|
||||
xcb_flush(x11->xcb);
|
||||
output->cursor_hidden = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XCB_INPUT_LEAVE: {
|
||||
xcb_input_leave_event_t *ev = (xcb_input_leave_event_t *)event;
|
||||
|
||||
output = get_x11_output_from_window_id(x11, ev->event);
|
||||
if (!output) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (output->cursor_hidden) {
|
||||
xcb_xfixes_show_cursor(x11->xcb, output->win);
|
||||
xcb_flush(x11->xcb);
|
||||
output->cursor_hidden = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue