[gtk: 62/88] tests/animated-resizing: Don't try to resize during frame dispatch
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 62/88] tests/animated-resizing: Don't try to resize during frame dispatch
- Date: Tue, 8 Dec 2020 15:38:45 +0000 (UTC)
commit 8e3ee58e3fcee161d6d1c52f7370800fd48d2bff
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Dec 4 15:02:59 2020 +0100
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.
tests/animated-resizing.c | 16 ++++++++++++----
1 file 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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]