diff options
author | Scott Anderson <scott@anderso.nz> | 2018-11-11 14:51:22 +1300 |
---|---|---|
committer | Scott Anderson <scott@anderso.nz> | 2018-11-13 10:55:03 +1300 |
commit | d3ee69f76bbc8b71a79840c047fa7a6144ddc628 (patch) | |
tree | 29d08a6cfdd92ed2b12ebf1139164fbb79f7ce78 /backend/x11/input_device.c | |
parent | 70ae76304e5c40774dd50a23537cdc419cdfa4c6 (diff) |
backend/x11: Hide cursor with Xfixes
Diffstat (limited to 'backend/x11/input_device.c')
-rw-r--r-- | backend/x11/input_device.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 08d982e6..a50f478a 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -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; + } } } |