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.
This commit is contained in:
Benjamin Otte 2024-07-06 05:29:53 +02:00
parent 012c4b9425
commit ecc2e02453

View File

@ -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);