[libadwaita/wip/exalm/screenshots-2: 5/15] screenshot: Add a small timeout before taking screenshots
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/screenshots-2: 5/15] screenshot: Add a small timeout before taking screenshots
- Date: Mon, 20 Dec 2021 15:37:46 +0000 (UTC)
commit 677d2a04d285ff45017f95ca8faf3740d41dad83
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Mon Dec 20 14:58:38 2021 +0500
screenshot: Add a small timeout before taking screenshots
doc/tools/screenshot.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/doc/tools/screenshot.c b/doc/tools/screenshot.c
index bfc6bd1d..21386313 100644
--- a/doc/tools/screenshot.c
+++ b/doc/tools/screenshot.c
@@ -31,8 +31,8 @@ screenshot_data_free (ScreenshotData *data)
g_free (data);
}
-static void
-draw_paintable (ScreenshotData *data)
+static gboolean
+draw_paintable_cb (ScreenshotData *data)
{
GtkSnapshot *snapshot;
GskRenderer *renderer;
@@ -41,10 +41,6 @@ draw_paintable (ScreenshotData *data)
int x, y, width, height;
int widget_width, widget_height;
- g_signal_handlers_disconnect_by_func (data->paintable,
- G_CALLBACK (draw_paintable),
- data);
-
widget_width = gtk_widget_get_allocated_width (data->widget);
widget_height = gtk_widget_get_allocated_height (data->widget);
@@ -90,6 +86,19 @@ draw_paintable (ScreenshotData *data)
screenshot_data_free (data);
g_main_loop_quit (loop);
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+draw_paintable (ScreenshotData *data)
+{
+ g_signal_handlers_disconnect_by_func (data->paintable,
+ G_CALLBACK (draw_paintable),
+ data);
+
+ /* Handle the case where something immediately invalidates allocation. */
+ g_timeout_add (50, G_SOURCE_FUNC (draw_paintable_cb), data);
}
static GtkCssProvider *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]