Skip to content

Commit

Permalink
x11: Do not attempt to set an invalid cursor
Browse files Browse the repository at this point in the history
Only set the cursor when the resolved cursor is not XCB_CURSOR_NONE.
  • Loading branch information
aperezdc committed Nov 23, 2023
1 parent 4b67680 commit 09beacf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions platform/x11/cog-platform-x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,12 +905,13 @@ on_mouse_target_changed(WebKitWebView *view, WebKitHitTestResult *hitTestResult,
for (unsigned i = 0; cursor == XCB_CURSOR_NONE && cursor_names[i]; i++)
cursor = xcb_cursor_load_cursor(ctx, cursor_names[i]);

if (cursor == XCB_CURSOR_NONE) {
if (cursor != XCB_CURSOR_NONE) {
xcb_change_window_attributes(s_display->xcb.connection, s_window->xcb.window, XCB_CW_CURSOR, &cursor);
xcb_free_cursor(s_display->xcb.connection, cursor);
} else {
g_warning("Could not load %s cursor", cursor_names[0]);
}

xcb_change_window_attributes(s_display->xcb.connection, s_window->xcb.window, XCB_CW_CURSOR, &cursor);
xcb_free_cursor(s_display->xcb.connection, cursor);
xcb_cursor_context_free(ctx);
}

Expand Down

0 comments on commit 09beacf

Please sign in to comment.