wayland: Defer creating cursor confinement regions until the surface is mapped

Otherwise, the confinement area will be lost if the window is recreated when initializing the renderer.
This commit is contained in:
Frank Praznik 2025-03-30 14:32:32 -04:00
parent cb1d79db39
commit 266ee41c86
No known key found for this signature in database
2 changed files with 8 additions and 0 deletions

View File

@ -3312,6 +3312,11 @@ bool Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *w
return SDL_SetError("No pointer to confine");
}
// The confinement region will be created when the window is mapped.
if (w->shell_surface_status != WAYLAND_SHELL_SURFACE_STATUS_SHOWN) {
return true;
}
/* A confine may already be active, in which case we should destroy it and
* create a new one.
*/

View File

@ -707,6 +707,9 @@ static void surface_frame_done(void *data, struct wl_callback *cb, uint32_t time
}
}
// Create the pointer confinement region, if necessary.
Wayland_input_confine_pointer(wind->waylandData->input, wind->sdlwindow);
/* If the window was initially set to the suspended state, send the occluded event now,
* as we don't want to mark the window as occluded until at least one frame has been submitted.
*/