From 36909c6e3bb4a00d673075869768d8300b2d0617 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kim=20Silkeb=C3=A6kken=20=28lokaltog=29?= Date: Tue, 26 Jan 2010 11:06:10 +0100 Subject: [PATCH] Fixed cursor code in create_window(), allowing the cursor to be changed --- src/xcb.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/xcb.c b/src/xcb.c index 5f3b22ab..f7835d3a 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -99,14 +99,6 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl /* If the window class is XCB_WINDOW_CLASS_INPUT_ONLY, depth has to be 0 */ uint16_t depth = (window_class == XCB_WINDOW_CLASS_INPUT_ONLY ? 0 : XCB_COPY_FROM_PARENT); - /* Use the default cursor (left pointer) */ - if (cursor > -1) { - i3Font *cursor_font = load_font(conn, "cursor"); - xcb_create_glyph_cursor(conn, cursor_id, cursor_font->id, cursor_font->id, - XCB_CURSOR_LEFT_PTR, XCB_CURSOR_LEFT_PTR + 1, - 0, 0, 0, 65535, 65535, 65535); - } - xcb_create_window(conn, depth, result, /* the window id */ @@ -118,8 +110,14 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl mask, values); - if (cursor > -1) - xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id); + /* Set the cursor */ + i3Font *cursor_font = load_font(conn, "cursor"); + xcb_create_glyph_cursor(conn, cursor_id, cursor_font->id, cursor_font->id, + (cursor == -1 ? XCB_CURSOR_LEFT_PTR : cursor), + (cursor == -1 ? XCB_CURSOR_LEFT_PTR : cursor) + 1, + 0, 0, 0, 65535, 65535, 65535); + xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id); + xcb_free_cursor(conn, cursor_id); /* Map the window (= make it visible) */ if (map) -- 2.39.5