x11: Fix handling of frame clock freezes

Now that popups share the frame clock of their
parent, we have to be much more careful about
freezing the clock, since that may stop updates
for another surface.

This commit makes two changes that make the
X11 handling of the frame clock more similar
to the Wayland backend:
- Use gdk_surface_freeze_updates instead of
  gdk_surface_freeze_toplevel_updates to avoid
  affecting the frame clock
- Bail out early in before_paint/after_paint
  if the surface is frozen, to avoid affecting
  the frame clock

Together, these two make the X11 popup surface
type work without freezing updates for the toplevel.
This commit is contained in:
Matthias Clasen 2019-05-19 02:53:17 +00:00
parent ef353f24c6
commit fa9cbf6c7d
2 changed files with 9 additions and 4 deletions

View File

@ -878,7 +878,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
} }
if (toplevel) if (toplevel)
gdk_surface_freeze_toplevel_updates (surface); gdk_surface_freeze_updates (surface);
_gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial); _gdk_x11_surface_grab_check_unmap (surface, xevent->xany.serial);
} }
@ -901,7 +901,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
0); 0);
if (toplevel) if (toplevel)
gdk_surface_thaw_toplevel_updates (surface); gdk_surface_thaw_updates (surface);
} }
return_val = FALSE; return_val = FALSE;

View File

@ -745,6 +745,9 @@ static void
on_frame_clock_before_paint (GdkFrameClock *clock, on_frame_clock_before_paint (GdkFrameClock *clock,
GdkSurface *surface) GdkSurface *surface)
{ {
if (surface->update_freeze_count > 0)
return;
gdk_x11_surface_predict_presentation_time (surface); gdk_x11_surface_predict_presentation_time (surface);
gdk_x11_surface_begin_frame (surface, FALSE); gdk_x11_surface_begin_frame (surface, FALSE);
} }
@ -753,8 +756,10 @@ static void
on_frame_clock_after_paint (GdkFrameClock *clock, on_frame_clock_after_paint (GdkFrameClock *clock,
GdkSurface *surface) GdkSurface *surface)
{ {
gdk_x11_surface_end_frame (surface); if (surface->update_freeze_count > 0)
return;
gdk_x11_surface_end_frame (surface);
} }
static void static void
@ -909,7 +914,7 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
connect_frame_clock (surface); connect_frame_clock (surface);
gdk_surface_freeze_toplevel_updates (surface); gdk_surface_freeze_updates (surface);
if (parent) if (parent)
{ {