diff --git a/glfw/context.c b/glfw/context.c index b10eda6a4..e194a2ee1 100644 --- a/glfw/context.c +++ b/glfw/context.c @@ -476,9 +476,6 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* handle) return; } -#ifdef _GLFW_WAYLAND - _glfwWaylandBeforeBufferSwap(window); -#endif window->context.swapBuffers(window); #ifdef _GLFW_WAYLAND _glfwWaylandAfterBufferSwap(window); diff --git a/glfw/wl_platform.h b/glfw/wl_platform.h index fb51392ae..4e52d7828 100644 --- a/glfw/wl_platform.h +++ b/glfw/wl_platform.h @@ -185,9 +185,6 @@ typedef struct _GLFWwindowWayland struct zwlr_layer_surface_v1* zwlr_layer_surface_v1; } layer_shell; - struct { - int width, height, dirty; - } framebuffer_size_at_last_resize; /* information about axis events on current frame */ struct { diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 95c6673ae..93362910a 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -370,27 +370,21 @@ wait_for_swap_to_commit(_GLFWwindow *window) { static void resizeFramebuffer(_GLFWwindow* window) { + GLFWwindow *ctx = glfwGetCurrentContext(); + const bool ctx_changed = ctx != (GLFWwindow*)window; + if (ctx_changed) glfwMakeContextCurrent((GLFWwindow*)window); double scale = _glfwWaylandWindowScale(window); int scaled_width = (int)round(window->wl.width * scale); int scaled_height = (int)round(window->wl.height * scale); debug("Resizing framebuffer of window: %llu to: %dx%d window size: %dx%d at scale: %.3f\n", window->id, scaled_width, scaled_height, window->wl.width, window->wl.height, scale); + wl_egl_window_resize(window->wl.native, scaled_width, scaled_height, 0, 0); update_regions(window); wait_for_swap_to_commit(window); - window->wl.framebuffer_size_at_last_resize.width = scaled_width; - window->wl.framebuffer_size_at_last_resize.height = scaled_height; - window->wl.framebuffer_size_at_last_resize.dirty = true; + if (ctx_changed) glfwMakeContextCurrent(ctx); _glfwInputFramebufferSize(window, scaled_width, scaled_height); } -void -_glfwWaylandBeforeBufferSwap(_GLFWwindow* window) { - if (window->wl.framebuffer_size_at_last_resize.dirty) { - wl_egl_window_resize(window->wl.native, window->wl.framebuffer_size_at_last_resize.width, window->wl.framebuffer_size_at_last_resize.height, 0, 0); - window->wl.framebuffer_size_at_last_resize.dirty = false; - } -} - void _glfwWaylandAfterBufferSwap(_GLFWwindow* window) { if (window->wl.temp_buffer_used_during_window_creation) {