From 7a18dcc89ed92fd9050019e90a70ea737a476a96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fernando=20Tarl=C3=A1=20Cardoso=20Lemos?= Date: Thu, 28 Jul 2011 20:36:14 -0300 Subject: [PATCH] Set the root window cursor. Fixes #442. --- src/main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main.c b/src/main.c index 947c783b..5e8d76a5 100644 --- a/src/main.c +++ b/src/main.c @@ -331,6 +331,21 @@ int main(int argc, char *argv[]) { /*init_xkb();*/ } + /* Set a cursor for the root window (otherwise the root window will show no + cursor until the first client is launched). */ + if (xcursor_supported) { + uint32_t values[1] = { xcursor_get_cursor(XCURSOR_CURSOR_POINTER) }; + xcb_change_window_attributes(conn, root, XCB_CW_CURSOR, values); + } else { + xcb_cursor_t cursor_id = xcb_generate_id(conn); + i3Font cursor_font = load_font("cursor", false); + int xcb_cursor = xcursor_get_xcb_cursor(XCURSOR_CURSOR_POINTER); + xcb_create_glyph_cursor(conn, cursor_id, cursor_font.id, cursor_font.id, + xcb_cursor, xcb_cursor + 1, 0, 0, 0, 65535, 65535, 65535); + xcb_change_window_attributes(conn, root, XCB_CW_CURSOR, &cursor_id); + xcb_free_cursor(conn, cursor_id); + } + if (xkb_supported) { int errBase, major = XkbMajorVersion, -- 2.39.5