Commit Graph

7 Commits

Author SHA1 Message Date
Ell
52a8dadaf6 app: handle GimpToolWidget::message in GimpToolWidgetGroup
... by forwarding the message, if the emitting widget has focus.

(cherry picked from commit 00a06f94be)
2019-01-13 08:15:48 -05:00
Ell
0f367371aa app: tweak focus behavior of GimpToolWidgetGroup when removing widget
When removing the focus widget of a GimpToolWidgetGroup, use the
last child, rather than the first child, as the new focus widget.
This plays nicer with auto-raise, and is probably better anyway.

(cherry picked from commit 24fb597196)
2018-09-23 13:26:55 -04:00
Ell
693cea427a app: in GimpToolWidgetGroup, improve focus behavior when adding/removing widgets
When a focused widget is added to a group, make it the new focus-
widget of the group, instead of unsetting its focus if another
widget already has focus.

When removing the focused widget from a group, set a different
widget as the group's focus widget (if one exists), instead of
unsetting the focus widget, so that nonempty groups always have a
focus widget.

(cherry picked from commit 95d2c92ff2)
2018-09-23 13:26:55 -04:00
Ell
f479711814 app: in GimpToolWidgetGroup, calculate hover widget at button press
In gimp_tool_widget_group_button_press(), explicitly call
gimp_tool_widget_group_hover() before forwarding the event to the
group's hover widget, so that the hover widget gets recalculated.
If a widget is added to the group as a result of a button-press
event, this guarantees that it gets considered as a target for the
same event.

(cherry picked from commit 5b217b3ad4)
2018-09-23 13:26:55 -04:00
Ell
31b369d09f app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:41:35 -04:00
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
Ell
3250561340 app: add GimpToolWidgetGroup
GimpToolWidgetGroup is a tool widget acting as a container for
child widgets, multiplexing widget events and demultiplexing tool
events.  It can be used by tools to display multiple widgets
simultaneously.

The group keeps track of the current focus widget, and hover
widget.  Certain events are only dispatched to/forwarded from these
widgets.

The hover widget is determined by performing a hit test for all the
children, starting from the last child.  The first widget returning
GIMP_HIT_DIRECT, if any, is selected as the hover widget;
otherwise, if the current focus widget returns GIMP_HIT_INDIRECT,
it's selected; otherwise, if exactly one widget returns
GIMP_HIT_INDIRECT, it's selected; otherwise, there is no hover
widget.

The focus widget is set when clicking on a widget (or
programatically, using gimp_tool_widget_set_focus()).
Additionally, the group can raise the clicked widget to the top of
the stack (see gimp_tool_widget_group_set_auto_raise().)

(cherry picked from commit 4ef06b9922)
2018-06-05 04:33:09 -04:00