tUngrab pointer and change cursor on mouse release - glazier - window management experiments
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
(DIR) commit 36c240625c4a17887b121140d42ea0ca98d1a106
(DIR) parent 6b54c5c976df75c6e6522e090dfc0df970b03ec2
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Sat, 19 Oct 2019 00:32:40 +0200
Ungrab pointer and change cursor on mouse release
Diffstat:
M config.def.h | 1 +
M glazier.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/config.def.h b/config.def.h
t@@ -3,6 +3,7 @@
#define XHAIR_MOVE "hand1"
#define XHAIR_SIZE "tcross"
+#define XHAIR_DFLT "left_ptr"
/* window borders */
int border = 8;
(DIR) diff --git a/glazier.c b/glazier.c
t@@ -105,6 +105,7 @@ cb_mouse_press(xcb_generic_event_t *ev)
}
xcb_flush(conn);
+ xcb_cursor_context_free(cx);
return 0;
}
t@@ -114,15 +115,24 @@ cb_mouse_release(xcb_generic_event_t *ev)
{
xcb_cursor_t p;
xcb_cursor_context_t *cx;
- xcb_grab_pointer_cookie_t c;
- xcb_grab_pointer_reply_t *r;
xcb_button_release_event_t *e;
e = (xcb_button_release_event_t *)ev;
if (verbose)
fprintf(stderr, "mouse_release: 0x%08x\n", e->child);
+ if (xcb_cursor_context_new(conn, scrn, &cx) < 0) {
+ fprintf(stderr, "cannot instantiate cursor\n");
+ exit(1);
+ }
+
+ p = xcb_cursor_load_cursor(cx, XHAIR_DFLT);
+ xcb_change_window_attributes(conn, e->child, XCB_CW_CURSOR, &p);
xcb_ungrab_pointer(conn, XCB_CURRENT_TIME);
+
+ xcb_flush(conn);
+ xcb_cursor_context_free(cx);
+
return 0;
}