Wayland: Ensure context is correct when calling wl_egl_window_resize
Fixes #7373 (I hope)
This commit is contained in:
parent
fbefd8600f
commit
9755d0d879
1 changed files with 9 additions and 1 deletions
10
glfw/wl_window.c
vendored
10
glfw/wl_window.c
vendored
|
|
@ -356,6 +356,14 @@ _glfwWaylandWindowScale(_GLFWwindow *window) {
|
|||
return ans;
|
||||
}
|
||||
|
||||
#define run_with_context(window, expression) { \
|
||||
const _GLFWwindow *current_context = (_GLFWwindow*)glfwGetCurrentContext(); \
|
||||
const bool needs_swap = window != current_context; \
|
||||
if (needs_swap) glfwMakeContextCurrent((GLFWwindow*)window); \
|
||||
expression; \
|
||||
if (needs_swap) glfwMakeContextCurrent((GLFWwindow*)current_context); \
|
||||
}
|
||||
|
||||
static void
|
||||
resizeFramebuffer(_GLFWwindow* window) {
|
||||
double scale = _glfwWaylandWindowScale(window);
|
||||
|
|
@ -363,7 +371,7 @@ resizeFramebuffer(_GLFWwindow* window) {
|
|||
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);
|
||||
run_with_context(window, wl_egl_window_resize(window->wl.native, scaled_width, scaled_height, 0, 0));
|
||||
update_regions(window);
|
||||
window->wl.waiting_for_swap_to_commit = true;
|
||||
_glfwInputFramebufferSize(window, scaled_width, scaled_height);
|
||||
|
|
|
|||
Loading…
Reference in a new issue