From: Benjamin Otte Date: Wed, 25 Oct 2023 18:31:01 +0000 (+0200) Subject: rendernode-tool: Add --undecorated to show command X-Git-Tag: archive/raspbian/4.12.4+ds-3+rpi1^2~21^2^2~11 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b88a652567060de10ea0521ab64258e89207f725;p=gtk4.git rendernode-tool: Add --undecorated to show command This is to get exactly just the rendernode drawn when testing, and not any extra drawing code. --- diff --git a/docs/reference/gtk/gtk4-rendernode-tool.rst b/docs/reference/gtk/gtk4-rendernode-tool.rst index ae2e9a2869..a01b6b58e4 100644 --- a/docs/reference/gtk/gtk4-rendernode-tool.rst +++ b/docs/reference/gtk/gtk4-rendernode-tool.rst @@ -35,6 +35,11 @@ Showing The ``show`` command displays the rendernode. +``--undecorated`` + +Removes window decorations. This is meant for rendering of exactly the rendernode +without any titlebar. + Rendering ^^^^^^^^^ diff --git a/tools/gtk-rendernode-tool-show.c b/tools/gtk-rendernode-tool-show.c index 99d1d0a4f6..2892869d9b 100644 --- a/tools/gtk-rendernode-tool-show.c +++ b/tools/gtk-rendernode-tool-show.c @@ -53,7 +53,8 @@ quit_cb (GtkWidget *widget, } static void -show_file (const char *filename) +show_file (const char *filename, + gboolean decorated) { GskRenderNode *node; GdkPaintable *paintable; @@ -79,6 +80,7 @@ show_file (const char *filename) gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), picture); window = gtk_window_new (); + gtk_window_set_decorated (GTK_WINDOW (window), decorated); set_window_title (GTK_WINDOW (window), filename); gtk_window_set_child (GTK_WINDOW (window), sw); @@ -98,7 +100,9 @@ do_show (int *argc, { GOptionContext *context; char **filenames = NULL; + gboolean decorated = TRUE; const GOptionEntry entries[] = { + { "undecorated", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &decorated, N_("Don't add a titlebar"), NULL }, { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, NULL, N_("FILE") }, { NULL, } }; @@ -137,7 +141,7 @@ do_show (int *argc, exit (1); } - show_file (filenames[0]); + show_file (filenames[0], decorated); g_strfreev (filenames); }