[libadwaita/wip/exalm/screenshots-2: 10/23] screenshot: Allow widget not to be the root




commit 4ef27ec8111ad2970cad3437884018eb3648bbc5
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Dec 20 13:31:13 2021 +0500

    screenshot: Allow widget not to be the root
    
    This will be useful for widgets like carousel indicators, where we want to
    include a carousel, but only screenshot the indicators.

 doc/tools/screenshot.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/doc/tools/screenshot.c b/doc/tools/screenshot.c
index 4babe508..bfc6bd1d 100644
--- a/doc/tools/screenshot.c
+++ b/doc/tools/screenshot.c
@@ -185,7 +185,9 @@ take_screenshot (const char *name,
     gtk_window_set_child (GTK_WINDOW (window), button);
 
     wait = TRUE;
- } else {
+  } else if (gtk_widget_get_root (GTK_WIDGET (widget))) {
+    window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (widget)));
+  } else {
     window = gtk_window_new ();
     gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
     gtk_window_set_child (GTK_WINDOW (window), data->widget);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]