Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wl: Add pointer_obj safe-guard in cog_wl_seat_set_cursor() #691

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions platform/wayland/cog-utils-wl.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,18 @@ cog_wl_seat_set_cursor(CogWlSeat *seat, WebKitHitTestResult *hit_test)
*/
struct wl_cursor_image *image = cursor->images[0];
struct wl_buffer *buffer = wl_cursor_image_get_buffer(image);
wl_pointer_set_cursor(seat->pointer_obj,
seat->pointer.serial,
display->cursor_surface,
image->hotspot_x,
image->hotspot_y);
wl_surface_attach(display->cursor_surface, buffer, 0, 0);
wl_surface_damage(display->cursor_surface, 0, 0, image->width, image->height);
wl_surface_commit(display->cursor_surface);
if (seat->pointer_obj != NULL) {
wl_pointer_set_cursor(seat->pointer_obj,
seat->pointer.serial,
display->cursor_surface,
image->hotspot_x,
image->hotspot_y);
wl_surface_attach(display->cursor_surface, buffer, 0, 0);
wl_surface_damage(display->cursor_surface, 0, 0, image->width, image->height);
wl_surface_commit(display->cursor_surface);
} else {
g_warning("Set %s cursor skipped. There is not pointer capabalility in the Wayland seat", cursor_names[0]);
}
}
#endif /* COG_USE_WAYLAND_CURSOR */

Expand Down
Loading