summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2020-12-04 15:02:59 +0100
committerJonas Ådahl <jadahl@gmail.com>2020-12-07 20:37:29 +0100
commit8e3ee58e3fcee161d6d1c52f7370800fd48d2bff (patch)
tree7cec2b02527f5e7737a687bde91cb32e520cd9df /tests
parent40a9baa2dbe8344d58ed5c263a062b78dad7d6c5 (diff)
downloadgtk+-8e3ee58e3fcee161d6d1c52f7370800fd48d2bff.tar.gz
tests/animated-resizing: Don't try to resize during frame dispatch
This will not work on X11 because it's too late to resize, due to resizing being asynchronous i.e. it won't be complete before we need to draw.
Diffstat (limited to 'tests')
-rw-r--r--tests/animated-resizing.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/animated-resizing.c b/tests/animated-resizing.c
index 0446b29b68..c9a316a560 100644
--- a/tests/animated-resizing.c
+++ b/tests/animated-resizing.c
@@ -130,10 +130,9 @@ on_frame (double progress)
}
static gboolean
-tick_callback (GtkWidget *widget,
- GdkFrameClock *frame_clock,
- gpointer user_data)
+resize_idle (gpointer user_data)
{
+ GdkFrameClock *frame_clock = user_data;
gint64 frame_time = gdk_frame_clock_get_frame_time (frame_clock);
double scaled_time;
@@ -143,6 +142,16 @@ tick_callback (GtkWidget *widget,
scaled_time = (frame_time - start_frame_time) / (CYCLE_TIME * 1000000);
on_frame (scaled_time - floor (scaled_time));
+ return G_SOURCE_REMOVE;
+}
+
+static gboolean
+tick_callback (GtkWidget *widget,
+ GdkFrameClock *frame_clock,
+ gpointer user_data)
+{
+ g_idle_add (resize_idle, frame_clock);
+
return G_SOURCE_CONTINUE;
}
@@ -196,7 +205,6 @@ main(int argc, char **argv)
cb_no_resize ? "no" : "yes");
window = gtk_window_new ();
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
frame_stats_ensure (GTK_WINDOW (window));
da = gtk_drawing_area_new ();