Fixed cursor code in create_window(), allowing the cursor to be changed
This commit is contained in:
parent
148547c765
commit
36909c6e3b
18
src/xcb.c
18
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 */
|
/* 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);
|
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,
|
xcb_create_window(conn,
|
||||||
depth,
|
depth,
|
||||||
result, /* the window id */
|
result, /* the window id */
|
||||||
|
@ -118,8 +110,14 @@ xcb_window_t create_window(xcb_connection_t *conn, Rect dims, uint16_t window_cl
|
||||||
mask,
|
mask,
|
||||||
values);
|
values);
|
||||||
|
|
||||||
if (cursor > -1)
|
/* Set the cursor */
|
||||||
xcb_change_window_attributes(conn, result, XCB_CW_CURSOR, &cursor_id);
|
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) */
|
/* Map the window (= make it visible) */
|
||||||
if (map)
|
if (map)
|
||||||
|
|
Loading…
Reference in New Issue