GHOST/Wayland: minor change to error handling when setting the cursor

Don't early exit in the unlikely event setting the cursor fails,
as this could prevent the tablet cursor from being set.
This commit is contained in:
Campbell Barton
2025-08-10 16:53:59 +10:00
parent ce3998ffea
commit 388609e7a7

View File

@@ -8760,15 +8760,14 @@ GHOST_TSuccess GHOST_SystemWayland::cursor_shape_set(const GHOST_TStandardCursor
if (seat->wl.pointer) {
/* Set cursor for the pointer device. */
if (!seat->cursor.shape.device) {
if (seat->cursor.shape.device == nullptr) {
seat->cursor.shape.device = wp_cursor_shape_manager_v1_get_pointer(
display_->wp.cursor_shape_manager, seat->wl.pointer);
if (!seat->cursor.shape.device) {
return GHOST_kFailure;
}
}
wp_cursor_shape_device_v1_set_shape(
seat->cursor.shape.device, seat->pointer.serial, *wl_shape);
if (seat->cursor.shape.device) {
wp_cursor_shape_device_v1_set_shape(
seat->cursor.shape.device, seat->pointer.serial, *wl_shape);
}
/* Set this to make sure we remember which shape we set when unhiding cursors. */
seat->cursor.shape.enum_id = *wl_shape;
@@ -8781,14 +8780,14 @@ GHOST_TSuccess GHOST_SystemWayland::cursor_shape_set(const GHOST_TStandardCursor
for (zwp_tablet_tool_v2 *zwp_tablet_tool_v2 : seat->wp.tablet_tools) {
GWL_TabletTool *tablet_tool = static_cast<GWL_TabletTool *>(
zwp_tablet_tool_v2_get_user_data(zwp_tablet_tool_v2));
if (!tablet_tool->shape.device) {
if (tablet_tool->shape.device == nullptr) {
tablet_tool->shape.device = wp_cursor_shape_manager_v1_get_tablet_tool_v2(
display_->wp.cursor_shape_manager, zwp_tablet_tool_v2);
if (!tablet_tool->shape.device) {
return GHOST_kFailure;
}
}
wp_cursor_shape_device_v1_set_shape(tablet_tool->shape.device, tablet_tool->serial, *wl_shape);
if (tablet_tool->shape.device) {
wp_cursor_shape_device_v1_set_shape(
tablet_tool->shape.device, tablet_tool->serial, *wl_shape);
}
/* Set this to make sure we remember which shape we set when unhiding cursors. */
tablet_tool->shape.enum_id = *wl_shape;
}