mirror of https://github.com/GNOME/gimp.git
app: update tool widgets on display-shell changes more granularly
Partially revert commit c73710e410
,
avoiding updating tool widgets unconditionally on tool resume in
GimpDrawTool -- it's too expensive in general.
Instead, handle display-shell changes in GimpToolWidget, by adding
GimpToolWidget::update_on_{scale,scroll,rotate} flags, which
subclasses can use to request an update on any of these events.
Set the flags as necessary for the affected widgets.
This commit is contained in:
parent
ec69083354
commit
afda774f44
|
@ -185,19 +185,21 @@ gimp_tool_compass_class_init (GimpToolCompassClass *klass)
|
|||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpToolWidgetClass *widget_class = GIMP_TOOL_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->constructed = gimp_tool_compass_constructed;
|
||||
object_class->set_property = gimp_tool_compass_set_property;
|
||||
object_class->get_property = gimp_tool_compass_get_property;
|
||||
object_class->constructed = gimp_tool_compass_constructed;
|
||||
object_class->set_property = gimp_tool_compass_set_property;
|
||||
object_class->get_property = gimp_tool_compass_get_property;
|
||||
|
||||
widget_class->changed = gimp_tool_compass_changed;
|
||||
widget_class->button_press = gimp_tool_compass_button_press;
|
||||
widget_class->button_release = gimp_tool_compass_button_release;
|
||||
widget_class->motion = gimp_tool_compass_motion;
|
||||
widget_class->hit = gimp_tool_compass_hit;
|
||||
widget_class->hover = gimp_tool_compass_hover;
|
||||
widget_class->leave_notify = gimp_tool_compass_leave_notify;
|
||||
widget_class->motion_modifier = gimp_tool_compass_motion_modifier;
|
||||
widget_class->get_cursor = gimp_tool_compass_get_cursor;
|
||||
widget_class->changed = gimp_tool_compass_changed;
|
||||
widget_class->button_press = gimp_tool_compass_button_press;
|
||||
widget_class->button_release = gimp_tool_compass_button_release;
|
||||
widget_class->motion = gimp_tool_compass_motion;
|
||||
widget_class->hit = gimp_tool_compass_hit;
|
||||
widget_class->hover = gimp_tool_compass_hover;
|
||||
widget_class->leave_notify = gimp_tool_compass_leave_notify;
|
||||
widget_class->motion_modifier = gimp_tool_compass_motion_modifier;
|
||||
widget_class->get_cursor = gimp_tool_compass_get_cursor;
|
||||
widget_class->update_on_scale = TRUE;
|
||||
widget_class->update_on_rotate = TRUE;
|
||||
|
||||
compass_signals[CREATE_GUIDES] =
|
||||
g_signal_new ("create-guides",
|
||||
|
|
|
@ -224,6 +224,7 @@ gimp_tool_focus_class_init (GimpToolFocusClass *klass)
|
|||
widget_class->motion_modifier = gimp_tool_focus_motion_modifier;
|
||||
widget_class->hover_modifier = gimp_tool_focus_hover_modifier;
|
||||
widget_class->get_cursor = gimp_tool_focus_get_cursor;
|
||||
widget_class->update_on_scale = TRUE;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_TYPE,
|
||||
g_param_spec_enum ("type", NULL, NULL,
|
||||
|
|
|
@ -463,6 +463,7 @@ gimp_tool_rectangle_class_init (GimpToolRectangleClass *klass)
|
|||
widget_class->key_press = gimp_tool_rectangle_key_press;
|
||||
widget_class->motion_modifier = gimp_tool_rectangle_motion_modifier;
|
||||
widget_class->get_cursor = gimp_tool_rectangle_get_cursor;
|
||||
widget_class->update_on_scale = TRUE;
|
||||
|
||||
rectangle_signals[CHANGE_COMPLETE] =
|
||||
g_signal_new ("change-complete",
|
||||
|
|
|
@ -232,6 +232,7 @@ gimp_tool_transform_grid_class_init (GimpToolTransformGridClass *klass)
|
|||
widget_class->leave_notify = gimp_tool_transform_grid_leave_notify;
|
||||
widget_class->hover_modifier = gimp_tool_transform_grid_hover_modifier;
|
||||
widget_class->get_cursor = gimp_tool_transform_grid_get_cursor;
|
||||
widget_class->update_on_scale = TRUE;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_TRANSFORM,
|
||||
gimp_param_spec_matrix3 ("transform",
|
||||
|
|
|
@ -221,6 +221,7 @@ gimp_tool_widget_constructed (GObject *object)
|
|||
{
|
||||
GimpToolWidget *widget = GIMP_TOOL_WIDGET (object);
|
||||
GimpToolWidgetPrivate *private = widget->private;
|
||||
GimpToolWidgetClass *klass = GIMP_TOOL_WIDGET_GET_CLASS (widget);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
||||
|
||||
|
@ -229,6 +230,33 @@ gimp_tool_widget_constructed (GObject *object)
|
|||
private->item = gimp_canvas_group_new (private->shell);
|
||||
|
||||
gimp_canvas_item_set_visible (private->item, private->visible);
|
||||
|
||||
if (klass->changed)
|
||||
{
|
||||
if (klass->update_on_scale)
|
||||
{
|
||||
g_signal_connect_object (private->shell, "scaled",
|
||||
G_CALLBACK (klass->changed),
|
||||
widget,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
if (klass->update_on_scroll)
|
||||
{
|
||||
g_signal_connect_object (private->shell, "scrolled",
|
||||
G_CALLBACK (klass->changed),
|
||||
widget,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
if (klass->update_on_rotate)
|
||||
{
|
||||
g_signal_connect_object (private->shell, "rotated",
|
||||
G_CALLBACK (klass->changed),
|
||||
widget,
|
||||
G_CONNECT_SWAPPED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -125,6 +125,10 @@ struct _GimpToolWidgetClass
|
|||
const GimpCoords *coords,
|
||||
GdkModifierType state,
|
||||
const gchar **ui_path);
|
||||
|
||||
gboolean update_on_scale;
|
||||
gboolean update_on_scroll;
|
||||
gboolean update_on_rotate;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -217,11 +217,7 @@ gimp_draw_tool_control (GimpTool *tool,
|
|||
switch (action)
|
||||
{
|
||||
case GIMP_TOOL_ACTION_PAUSE:
|
||||
break;
|
||||
|
||||
case GIMP_TOOL_ACTION_RESUME:
|
||||
if (draw_tool->widget)
|
||||
gimp_tool_widget_changed (draw_tool->widget);
|
||||
break;
|
||||
|
||||
case GIMP_TOOL_ACTION_HALT:
|
||||
|
|
Loading…
Reference in New Issue