Browse Source

wayland: Only set the window geometry when viewports are unsupported

Setting the window geometry on the xdg-toplevel path is a hack used to prevent protocol violations if a buffer with an old size is committed. Since viewports decouple the window geometry from the buffer size, this is not needed if viewports are supported.

Fixes an invalid window geometry warning and incorrect window overview size for fullscreen windows in GNOME.
Frank Praznik 9 months ago
parent
commit
159d7087c6
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/video/wayland/SDL_waylandwindow.c

+ 5 - 5
src/video/wayland/SDL_waylandwindow.c

@@ -407,8 +407,11 @@ static void ConfigureWindowGeometry(SDL_Window *window)
      * need to be recalculated if the output size has changed.
      */
     if (window_size_changed) {
-        /* libdecor does this internally on frame commits, so it's only needed for xdg surfaces. */
-        if (data->shell_surface_type != WAYLAND_SURFACE_LIBDECOR && data->shell_surface.xdg.surface) {
+        /* XXX: This is a hack and only set on the xdg-toplevel path when viewports
+         *      aren't supported to avoid a potential protocol violation if a buffer
+         *      with an old size is committed.
+         */
+        if (!data->viewport && data->shell_surface_type == WAYLAND_SURFACE_XDG_TOPLEVEL && data->shell_surface.xdg.surface) {
             xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->current.logical_width, data->current.logical_height);
         }
 
@@ -1830,9 +1833,6 @@ void Wayland_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
                                                      &decoration_listener,
                                                      window);
         }
-
-        /* Set the geometry */
-        xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->current.logical_width, data->current.logical_height);
     } else {
         /* Nothing to see here, just commit. */
         wl_surface_commit(data->surface);