From: Kim Silkebækken (lokaltog) Date: Tue, 26 Jan 2010 10:06:10 +0000 (+0100) Subject: Fixed cursor code in create_window(), allowing the cursor to be changed X-Git-Tag: 3.e~6^2~157 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=36909c6e3bb4a00d673075869768d8300b2d0617;p=i3%2Fi3 Fixed cursor code in create_window(), allowing the cursor to be changed --- 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)