[gtk+] wayland: Fix a race condition with xdg_popup resize
- From: Olivier Fourdan <ofourdan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Fix a race condition with xdg_popup resize
- Date: Fri, 24 Feb 2017 09:23:59 +0000 (UTC)
commit 83b54bab5734f17d01633c1b5a0ce3e4896d2ee0
Author: Olivier Fourdan <ofourdan redhat com>
Date: Fri Nov 25 14:24:52 2016 +0100
wayland: Fix a race condition with xdg_popup resize
When resizing an xdg_popup immediately after the initial mapping, there
is a race condition between the client and the compositor which is
processing the initial size given by the xdg_positioner, leading to the
xdg_popup to be eventually of the wrong size.
Only way to make sure the size is correct in that case is to hide and
show the window again. Considering this occurs before the initial
configure is processed, it should not be noticeable.
https://bugzilla.gnome.org/show_bug.cgi?id=772505
gdk/wayland/gdkwindow-wayland.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 64b7356..5c09541 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1001,13 +1001,30 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
int scale)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
+ gboolean is_xdg_popup;
+ gboolean is_visible;
if (window->width == width &&
window->height == height &&
impl->scale == scale)
return;
+ /* For xdg_popup using an xdg_positioner, there is a race condition if
+ * the application tries to change the size after it's mapped, but before
+ * the initial configure is received, so hide and show the surface again
+ * force the new size onto the compositor. See bug #772505.
+ */
+
+ is_xdg_popup = (impl->display_server.xdg_popup != NULL);
+ is_visible = gdk_window_is_visible (window);
+
+ if (is_xdg_popup && is_visible && !impl->initial_configure_received)
+ gdk_window_hide (window);
+
gdk_wayland_window_configure (window, width, height, scale);
+
+ if (is_xdg_popup && is_visible && !impl->initial_configure_received)
+ gdk_window_show (window);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]