From ecc2e024531df6a55b8f630628fe87f72f8dfbad Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 6 Jul 2024 05:29:53 +0200 Subject: [PATCH] rendernode-tool: Add a GtkWindowHandle Make the whole window area draggable, like usually the titlebar. This is especially useful with --undecorated. In that case we need to make the window non-resizable though, becuase otherwise it can be accidentally maximized and whatnot. --- tools/gtk-rendernode-tool-show.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/gtk-rendernode-tool-show.c b/tools/gtk-rendernode-tool-show.c index 653ed9c617..a5e52f74ce 100644 --- a/tools/gtk-rendernode-tool-show.c +++ b/tools/gtk-rendernode-tool-show.c @@ -60,6 +60,7 @@ show_file (const char *filename, graphene_rect_t node_bounds; GdkPaintable *paintable; GtkWidget *sw; + GtkWidget *handle; GtkWidget *window; gboolean done = FALSE; GtkSnapshot *snapshot; @@ -82,10 +83,14 @@ show_file (const char *filename, gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), picture); + handle = gtk_window_handle_new (); + gtk_window_handle_set_child (GTK_WINDOW_HANDLE (handle), sw); + window = gtk_window_new (); gtk_window_set_decorated (GTK_WINDOW (window), decorated); + gtk_window_set_resizable (GTK_WINDOW (window), decorated); set_window_title (GTK_WINDOW (window), filename); - gtk_window_set_child (GTK_WINDOW (window), sw); + gtk_window_set_child (GTK_WINDOW (window), handle); gtk_window_present (GTK_WINDOW (window)); g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);