wayland: Send a pixel sized change event when the drawable size changes

This commit is contained in:
Frank Praznik
2023-01-28 21:13:19 -05:00
committed by Sam Lantinga
parent 4667d65f77
commit a67b441a10

View File

@@ -2016,19 +2016,14 @@ static void Wayland_HandleResize(SDL_Window *window, int width, int height)
{ {
SDL_WindowData *data = (SDL_WindowData *)window->driverdata; SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
const int old_w = window->w, old_h = window->h; const int old_w = window->w, old_h = window->h;
const int old_drawable_width = data->drawable_width;
const int old_drawable_height = data->drawable_height;
/* Update the window geometry. */ /* Update the window geometry. */
window->w = width; window->w = width;
window->h = height; window->h = height;
ConfigureWindowGeometry(window); ConfigureWindowGeometry(window);
if (data->needs_resize_event || if (data->needs_resize_event || old_w != width || old_h != height) {
old_w != width || old_h != height || /* We have already updated window w/h, so we must override the deduplication logic in the video core */
old_drawable_width != data->drawable_width || old_drawable_height != data->drawable_height) {
/* We may have already updated window w/h (or only adjusted scale factor),
* so we must override the deduplication logic in the video core */
window->w = 0; window->w = 0;
window->h = 0; window->h = 0;
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, width, height); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, width, height);
@@ -2036,6 +2031,9 @@ static void Wayland_HandleResize(SDL_Window *window, int width, int height)
window->h = height; window->h = height;
data->needs_resize_event = SDL_FALSE; data->needs_resize_event = SDL_FALSE;
} }
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,
data->drawable_width, data->drawable_height);
} }
void Wayland_SetWindowMinimumSize(_THIS, SDL_Window *window) void Wayland_SetWindowMinimumSize(_THIS, SDL_Window *window)