From bb588155fdf9fc1435812901e95dff6a3b699006 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Sun, 14 Jan 2024 19:43:32 +0000 Subject: [PATCH] plug-ins: Fix ImageMap resize bug in GTK3 Resolves #10530. In GTK2, setting a window's scrollbar policy to GTK_POLICY_NEVER hid the scrollbars. In GTK3, this also makes the window automatically resize to fit the contents. Since ImageMap displays the full drawable with no scaling, this caused the plug-in window to be very large for large layers. GTK_POLICY_EXTERNAL in GTK3 works the same as the GTK2 version of GTK_POLICY_NEVER, so using it instead fixes the problem. The default width and height magic numbers were also replaced with constants. --- plug-ins/imagemap/imap_preview.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plug-ins/imagemap/imap_preview.c b/plug-ins/imagemap/imap_preview.c index 15b069f168..3ea085705c 100644 --- a/plug-ins/imagemap/imap_preview.c +++ b/plug-ins/imagemap/imap_preview.c @@ -41,7 +41,8 @@ GDK_ENTER_NOTIFY_MASK | \ GDK_LEAVE_NOTIFY_MASK) -#define PREVIEW_SIZE 400 +#define PREVIEW_WIDTH 600 +#define PREVIEW_HEIGHT 400 /*====================================================================== Preview Rendering Util routine @@ -341,9 +342,9 @@ make_preview (GimpDrawable *drawable, window = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window), - GTK_POLICY_NEVER, GTK_POLICY_NEVER); - width = (data->width > 600) ? 600 : data->width; - height = (data->height > 400) ? 400 : data->height; + GTK_POLICY_EXTERNAL, GTK_POLICY_EXTERNAL); + width = (data->width > PREVIEW_WIDTH) ? PREVIEW_WIDTH : data->width; + height = (data->height > PREVIEW_HEIGHT) ? PREVIEW_HEIGHT : data->height; gtk_widget_set_size_request (window, width, height); gtk_grid_attach (GTK_GRID (grid), window, 1, 1, 1, 1); gtk_widget_show (window);