widgets: Update image display on imageview select

In the Image Dockable, clicking on an image will update the layers and 
navigation views. However, the actual canvas image will not update
unless you double-click the item.
This adds a select_item function so the canvas is updated on a single 
click as well.
This commit is contained in:
Alx Sa 2023-06-18 20:10:10 +00:00
parent 4a174206af
commit acf2756e4a
1 changed files with 22 additions and 0 deletions

View File

@ -42,6 +42,8 @@
#include "gimp-intl.h"
static void gimp_image_view_select_item (GimpContainerEditor *editor,
GimpViewable *viewable);
static void gimp_image_view_activate_item (GimpContainerEditor *editor,
GimpViewable *viewable);
@ -56,6 +58,7 @@ gimp_image_view_class_init (GimpImageViewClass *klass)
{
GimpContainerEditorClass *editor_class = GIMP_CONTAINER_EDITOR_CLASS (klass);
editor_class->select_item = gimp_image_view_select_item;
editor_class->activate_item = gimp_image_view_activate_item;
}
@ -140,6 +143,25 @@ gimp_image_view_new (GimpViewType view_type,
return GTK_WIDGET (image_view);
}
static void
gimp_image_view_select_item (GimpContainerEditor *editor,
GimpViewable *viewable)
{
GimpImageView *view = GIMP_IMAGE_VIEW (editor);
GimpContainer *container;
if (GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item)
GIMP_CONTAINER_EDITOR_CLASS (parent_class)->select_item (editor, viewable);
container = gimp_container_view_get_container (editor->view);
if (viewable && gimp_container_have (container, GIMP_OBJECT (viewable)))
{
if (view->raise_button)
gtk_button_clicked (GTK_BUTTON (view->raise_button));
}
}
static void
gimp_image_view_activate_item (GimpContainerEditor *editor,
GimpViewable *viewable)