From 01fcc2d7f43ce724e6b85b87dbb9c865fb7e1f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20M=C3=ADchal?= Date: Wed, 25 Jun 2025 22:14:18 +0300 Subject: [PATCH 1/2] app: Use correct maximum size for button viewables Pop-up widgets tied to button viewables can have their previews go over the original max value which officially is 192 ("gigantic"). When they do and update their property with the number, a critical gets fired regarding the maximum value being crossed over. Closes #14337 --- app/core/gimpviewable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/gimpviewable.h b/app/core/gimpviewable.h index 5d9bdef01c..2be0b4a66b 100644 --- a/app/core/gimpviewable.h +++ b/app/core/gimpviewable.h @@ -27,7 +27,7 @@ #define GIMP_VIEWABLE_MAX_PREVIEW_SIZE 2048 #define GIMP_VIEWABLE_MAX_POPUP_SIZE 256 -#define GIMP_VIEWABLE_MAX_BUTTON_SIZE 64 +#define GIMP_VIEWABLE_MAX_BUTTON_SIZE GIMP_VIEW_SIZE_GIGANTIC #define GIMP_VIEWABLE_MAX_MENU_SIZE 48 From 086539f2ae531c00f8d63420cb9448e921676e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20M=C3=ADchal?= Date: Wed, 25 Jun 2025 21:55:10 +0300 Subject: [PATCH 2/2] app: Change container pop-up view size predictably Instead of a blind multiplication/division use known and well defined increments that also have no chance of overflowing the minimum/maximum allowed sizes. Closes https://gitlab.gnome.org/Teams/GIMP/Design/gimp-ux/-/issues/509 --- app/widgets/gimpcontainerpopup.c | 9 +++++---- app/widgets/gimpcontainerpopup.h | 4 ++-- app/widgets/gimpviewablebutton.c | 2 +- app/widgets/gimpviewablebutton.h | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/widgets/gimpcontainerpopup.c b/app/widgets/gimpcontainerpopup.c index c1647aae3e..699a1fc0bd 100644 --- a/app/widgets/gimpcontainerpopup.c +++ b/app/widgets/gimpcontainerpopup.c @@ -32,6 +32,7 @@ #include "core/gimpcontext.h" #include "core/gimpcontainer.h" #include "core/gimpviewable.h" +#include "core/gimp-utils.h" #include "gimpcontainerbox.h" #include "gimpcontainereditor.h" @@ -213,7 +214,7 @@ gimp_container_popup_set_view_type (GimpContainerPopup *popup, } } -gint +GimpViewSize gimp_container_popup_get_view_size (GimpContainerPopup *popup) { g_return_val_if_fail (GIMP_IS_CONTAINER_POPUP (popup), GIMP_VIEW_SIZE_SMALL); @@ -223,7 +224,7 @@ gimp_container_popup_get_view_size (GimpContainerPopup *popup) void gimp_container_popup_set_view_size (GimpContainerPopup *popup, - gint view_size) + GimpViewSize view_size) { GtkWidget *scrolled_win; GtkWidget *viewport; @@ -366,7 +367,7 @@ gimp_container_popup_smaller_clicked (GtkWidget *button, view_size = gimp_container_view_get_view_size (popup->editor->view, NULL); - gimp_container_popup_set_view_size (popup, view_size * 0.8); + gimp_container_popup_set_view_size (popup, gimp_view_size_get_smaller (view_size)); } static void @@ -377,7 +378,7 @@ gimp_container_popup_larger_clicked (GtkWidget *button, view_size = gimp_container_view_get_view_size (popup->editor->view, NULL); - gimp_container_popup_set_view_size (popup, view_size * 1.2); + gimp_container_popup_set_view_size (popup, gimp_view_size_get_larger (view_size)); } static void diff --git a/app/widgets/gimpcontainerpopup.h b/app/widgets/gimpcontainerpopup.h index 7bfbf6985e..77e4c9a76b 100644 --- a/app/widgets/gimpcontainerpopup.h +++ b/app/widgets/gimpcontainerpopup.h @@ -80,9 +80,9 @@ GimpViewType gimp_container_popup_get_view_type (GimpContainerPopup *popup); void gimp_container_popup_set_view_type (GimpContainerPopup *popup, GimpViewType view_type); -gint gimp_container_popup_get_view_size (GimpContainerPopup *popup); +GimpViewSize gimp_container_popup_get_view_size (GimpContainerPopup *popup); void gimp_container_popup_set_view_size (GimpContainerPopup *popup, - gint view_size); + GimpViewSize view_size); #endif /* __GIMP_CONTAINER_POPUP_H__ */ diff --git a/app/widgets/gimpviewablebutton.c b/app/widgets/gimpviewablebutton.c index eaba1c418c..56e037d753 100644 --- a/app/widgets/gimpviewablebutton.c +++ b/app/widgets/gimpviewablebutton.c @@ -351,7 +351,7 @@ gimp_viewable_button_get_view_size (GimpViewableButton *button) void gimp_viewable_button_set_view_size (GimpViewableButton *button, - gint view_size) + GimpViewSize view_size) { g_return_if_fail (GIMP_IS_VIEWABLE_BUTTON (button)); diff --git a/app/widgets/gimpviewablebutton.h b/app/widgets/gimpviewablebutton.h index fd1cfa8b17..d4e95cdcf1 100644 --- a/app/widgets/gimpviewablebutton.h +++ b/app/widgets/gimpviewablebutton.h @@ -78,7 +78,7 @@ void gimp_viewable_button_set_view_type (GimpViewableButton *button, gint gimp_viewable_button_get_view_size (GimpViewableButton *button); void gimp_viewable_button_set_view_size (GimpViewableButton *button, - gint view_size); + GimpViewSize view_size); #endif /* __GIMP_VIEWABLE_BUTTON_H__ */