From 84c28d2efbc0c861af6c2f747fae0db931121d47 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 29 Jul 2024 08:11:40 -0400 Subject: [PATCH] image-tool: Add an --undecorated option This is useful if you want to debug things and don't want to end up in the decoration rendering code paths. --- docs/reference/gtk/gtk4-image-tool.rst | 5 +++++ tools/gtk-image-tool-show.c | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/reference/gtk/gtk4-image-tool.rst b/docs/reference/gtk/gtk4-image-tool.rst index 911ab9d9c8..3c9b686888 100644 --- a/docs/reference/gtk/gtk4-image-tool.rst +++ b/docs/reference/gtk/gtk4-image-tool.rst @@ -41,6 +41,11 @@ Showing The ``show`` command displays one or more images, side-by-side. +``--undecorated`` + +Removes window decorations. This is meant for rendering of exactly the image +without any titlebar. + Compare ^^^^^^^ diff --git a/tools/gtk-image-tool-show.c b/tools/gtk-image-tool-show.c index 9bc3c75343..3b85292fa5 100644 --- a/tools/gtk-image-tool-show.c +++ b/tools/gtk-image-tool-show.c @@ -41,7 +41,8 @@ quit_cb (GtkWidget *widget, } static void -show_files (char **filenames) +show_files (char **filenames, + gboolean decorated) { GtkWidget *sw; GtkWidget *window; @@ -64,6 +65,9 @@ show_files (char **filenames) g_free (name); } + gtk_window_set_decorated (GTK_WINDOW (window), decorated); + gtk_window_set_resizable (GTK_WINDOW (window), decorated); + gtk_window_set_title (GTK_WINDOW (window), title->str); g_string_free (title, TRUE); @@ -108,7 +112,10 @@ 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, } }; @@ -135,7 +142,7 @@ do_show (int *argc, exit (1); } - show_files (filenames); + show_files (filenames, decorated); g_strfreev (filenames); }