wayland: Don't commit the surface on a resize

This fixes weirdness with GNOME.

On a resize, we will schedule a new frame anyway which will commit
the wl_surface for us anyway. If we don't resize, we'll commit
to stay true to the wayland spec.
This commit is contained in:
Alexander Orzechowski
2022-03-10 06:02:22 -05:00
parent 39e75e39e8
commit 99a5843595

13
glfw/wl_window.c vendored
View File

@@ -234,7 +234,7 @@ clipboard_mime(void) {
return buf; return buf;
} }
static void static bool
dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height) { dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height) {
bool size_changed = width != window->wl.width || height != window->wl.height; bool size_changed = width != window->wl.width || height != window->wl.height;
bool scale_changed = checkScaleChange(window); bool scale_changed = checkScaleChange(window);
@@ -252,6 +252,8 @@ dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height
} }
_glfwInputWindowDamage(window); _glfwInputWindowDamage(window);
return size_changed || scale_changed;
} }
static void static void
@@ -510,10 +512,11 @@ static void xdgSurfaceHandleConfigure(void* data,
window->wl.current.decoration_mode = mode; window->wl.current.decoration_mode = mode;
} }
bool resized = false;
if (window->wl.pending_state) { if (window->wl.pending_state) {
int width = window->wl.pending.width, height = window->wl.pending.height; int width = window->wl.pending.width, height = window->wl.pending.height;
set_csd_window_geometry(window, &width, &height); set_csd_window_geometry(window, &width, &height);
dispatchChangesAfterConfigure(window, width, height); resized = dispatchChangesAfterConfigure(window, width, height);
if (window->wl.decorations.serverSide) { if (window->wl.decorations.serverSide) {
free_csd_surfaces(window); free_csd_surfaces(window);
} else { } else {
@@ -523,7 +526,11 @@ static void xdgSurfaceHandleConfigure(void* data,
} }
inform_compositor_of_window_geometry(window, "configure"); inform_compositor_of_window_geometry(window, "configure");
wl_surface_commit(window->wl.surface);
if (!resized) {
wl_surface_commit(window->wl.surface);
}
window->wl.pending_state = 0; window->wl.pending_state = 0;
} }