[gtk/wip/carlosg/for-master] gdk/surface: Trigger motion check for next frame after thaw
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/carlosg/for-master] gdk/surface: Trigger motion check for next frame after thaw
- Date: Sat, 12 Dec 2020 01:15:54 +0000 (UTC)
commit 8be0918d7e528185c87cc3afa700efab84f0a580
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Dec 12 01:36:16 2020 +0100
gdk/surface: Trigger motion check for next frame after thaw
This is a more reliable calling point than ::resume-events, and a
good one to schedule things so they happen on a frame clock in no
special phase (Thus still fixing the original issue at 80d4a08e30)
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3461
gdk/gdksurface.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/gdk/gdksurface.c b/gdk/gdksurface.c
index b6f739c5c0..393329c10f 100644
--- a/gdk/gdksurface.c
+++ b/gdk/gdksurface.c
@@ -1555,6 +1555,20 @@ gdk_surface_freeze_updates (GdkSurface *surface)
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
}
+static gboolean
+request_motion_cb (void *data)
+{
+ GdkSurface *surface = GDK_SURFACE (data);
+ GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
+
+ if (clock)
+ gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
+ surface->request_motion_id = 0;
+
+ return G_SOURCE_REMOVE;
+}
+
+
/*
* gdk_surface_thaw_updates:
* @surface: a #GdkSurface
@@ -1578,6 +1592,13 @@ gdk_surface_thaw_updates (GdkSurface *surface)
if (surface->pending_phases)
gdk_frame_clock_request_phase (frame_clock, surface->pending_phases);
+
+ if (surface->request_motion && surface->request_motion_id == 0)
+ {
+ surface->request_motion_id =
+ g_idle_add_full (GDK_PRIORITY_REDRAW + 20,
+ request_motion_cb, surface, NULL);
+ }
}
}
@@ -2410,19 +2431,6 @@ gdk_surface_flush_events (GdkFrameClock *clock,
surface->frame_clock_events_paused = TRUE;
}
-static gboolean
-request_motion_cb (void *data)
-{
- GdkSurface *surface = GDK_SURFACE (data);
- GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
-
- if (clock)
- gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
- surface->request_motion_id = 0;
-
- return G_SOURCE_REMOVE;
-}
-
static void
gdk_surface_resume_events (GdkFrameClock *clock,
void *data)
@@ -2434,13 +2442,6 @@ gdk_surface_resume_events (GdkFrameClock *clock,
_gdk_display_unpause_events (surface->display);
surface->frame_clock_events_paused = FALSE;
}
-
- if (surface->request_motion)
- {
- surface->request_motion_id =
- g_idle_add_full (GDK_PRIORITY_REDRAW + 1,
- request_motion_cb, surface, NULL);
- }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]