From ca3ed3e024864e91ca3cccc59fb96950e1d079b5 Mon Sep 17 00:00:00 2001 From: Ander Conselvan de Oliveira Date: Fri, 30 Nov 2012 17:41:02 +0200 Subject: egl/wayland: Don't invalidate drawable on swap buffers We used to invalidate the drawable after a call to eglSwapBuffers(), so that a wl_egl_window_resize() would take effect for the next frame. However, that leads to calling dri2_get_buffers() when eglMakeCurrent() is called with the current context and surface, and a later call to wl_egl_window_resize() would not take effect until the next buffer swap. Instead, add a callback from wl_egl_window_resize() back to the wayland egl platform, and invalidate the drawable only when it is resized. This solves a bug on wayland clients when going back to windowed mode from fullscreen when clicking a pop up menu, where the window size after this would be the fullscreen size. Note: this is a candidate for stable branches. CC: wayland-devel@lists.freedesktop.org --- src/egl/wayland/wayland-egl/wayland-egl-priv.h | 3 +++ src/egl/wayland/wayland-egl/wayland-egl.c | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'src/egl/wayland') diff --git a/src/egl/wayland/wayland-egl/wayland-egl-priv.h b/src/egl/wayland/wayland-egl/wayland-egl-priv.h index bdbf32a..da25be9 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl-priv.h +++ b/src/egl/wayland/wayland-egl/wayland-egl-priv.h @@ -24,6 +24,9 @@ struct wl_egl_window { int attached_width; int attached_height; + + void *private; + void (*resize_callback)(struct wl_egl_window *, void *); }; #ifdef __cplusplus diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c index c61fb4f..8bd49cf 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl.c +++ b/src/egl/wayland/wayland-egl/wayland-egl.c @@ -13,6 +13,9 @@ wl_egl_window_resize(struct wl_egl_window *egl_window, egl_window->height = height; egl_window->dx = dx; egl_window->dy = dy; + + if (egl_window->resize_callback) + egl_window->resize_callback(egl_window, egl_window->private); } WL_EGL_EXPORT struct wl_egl_window * @@ -26,6 +29,8 @@ wl_egl_window_create(struct wl_surface *surface, return NULL; egl_window->surface = surface; + egl_window->private = NULL; + egl_window->resize_callback = NULL; wl_egl_window_resize(egl_window, width, height, 0, 0); egl_window->attached_width = 0; egl_window->attached_height = 0; -- cgit v1.1