Skip to content

Commit

Permalink
_glfwPLatformSetWindowSize() should not be called when handling confi…
Browse files Browse the repository at this point in the history
…gure events as it does a bunch of work already done before
  • Loading branch information
kovidgoyal committed Apr 7, 2021
1 parent 4822fa9 commit 82a5733
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions glfw/wl_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,15 @@ clipboard_mime(void) {
return buf;
}

static void dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height) {
static void
dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height) {
bool size_changed = width != window->wl.width || height != window->wl.height;
bool scale_changed = checkScaleChange(window);

if (size_changed) {
_glfwInputWindowSize(window, width, height);
_glfwPlatformSetWindowSize(window, width, height);
window->wl.width = width; window->wl.height = height;
resizeFramebuffer(window);
}

if (scale_changed) {
Expand Down Expand Up @@ -448,9 +450,9 @@ static void xdgToplevelHandleConfigure(void* data,
bool live_resize_done = !(new_states & TOPLEVEL_STATE_RESIZING) && (window->wl.toplevel_states & TOPLEVEL_STATE_RESIZING);
window->wl.toplevel_states = new_states;
set_csd_window_geometry(window, &width, &height);
debug("final window content size: %dx%d\n", window->wl.width, window->wl.height);
wl_surface_commit(window->wl.surface);
dispatchChangesAfterConfigure(window, width, height);
debug("final window content size: %dx%d\n", window->wl.width, window->wl.height);
_glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED);
ensure_csd_resources(window);
if (live_resize_done) _glfwInputLiveResize(window, false);
Expand Down

0 comments on commit 82a5733

Please sign in to comment.