summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2022-03-23 17:00:21 -0700
committerChristian Hergert <chergert@redhat.com>2022-03-23 17:03:15 -0700
commit524d507035b104f51feae7ec48e4e83bc4a8f171 (patch)
tree3b4a5d2f5632e67843445aed7675e09427d1f0df
parentffffb382e254b57c7701f09b05fdcebe58a6cb9a (diff)
downloadgtk+-wip/chergert/fix-wayland-glitching.tar.gz
gdk/wayland: freeze popups when hiddenwip/chergert/fix-wayland-glitching
Previously, there was an issue with glitching after showing/hiding a popover that was not also destroyed. This was due to the popover having an update_freeze_count of zero after hiding the surface. That resulted in it's toplevel continuously dropping frames such as during high-frame-rate scrolling in textviews. This problem is much more visible on high-frame-rate displays such as 120hz/144hz. With this commit, we track the POPUP_STATE_IDLE case and also freeze the frame clock of the popup until it is mapped again.
-rw-r--r--gdk/wayland/gdksurface-wayland.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 09328bdb89..acf24da73f 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -113,6 +113,7 @@ struct _GdkWaylandSurface
PopupState popup_state;
+ unsigned int popup_thaw_upon_show : 1;
unsigned int initial_configure_received : 1;
unsigned int has_uncommitted_ack_configure : 1;
unsigned int mapped : 1;
@@ -2994,6 +2995,8 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
thaw_popup_toplevel_state (surface);
break;
case POPUP_STATE_IDLE:
+ impl->popup_thaw_upon_show = TRUE;
+ gdk_surface_freeze_updates (surface);
break;
default:
g_assert_not_reached ();
@@ -3223,6 +3226,12 @@ show_popup (GdkSurface *surface,
if (!impl->display_server.wl_surface)
gdk_wayland_surface_create_surface (surface);
+ if (impl->popup_thaw_upon_show)
+ {
+ impl->popup_thaw_upon_show = FALSE;
+ gdk_surface_thaw_updates (surface);
+ }
+
gdk_wayland_surface_map_popup (surface, width, height, layout);
}