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
|
@ -198,6 +198,8 @@ gimp_tool_compass_class_init (GimpToolCompassClass *klass)
|
||||||
widget_class->leave_notify = gimp_tool_compass_leave_notify;
|
widget_class->leave_notify = gimp_tool_compass_leave_notify;
|
||||||
widget_class->motion_modifier = gimp_tool_compass_motion_modifier;
|
widget_class->motion_modifier = gimp_tool_compass_motion_modifier;
|
||||||
widget_class->get_cursor = gimp_tool_compass_get_cursor;
|
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] =
|
compass_signals[CREATE_GUIDES] =
|
||||||
g_signal_new ("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->motion_modifier = gimp_tool_focus_motion_modifier;
|
||||||
widget_class->hover_modifier = gimp_tool_focus_hover_modifier;
|
widget_class->hover_modifier = gimp_tool_focus_hover_modifier;
|
||||||
widget_class->get_cursor = gimp_tool_focus_get_cursor;
|
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_object_class_install_property (object_class, PROP_TYPE,
|
||||||
g_param_spec_enum ("type", NULL, NULL,
|
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->key_press = gimp_tool_rectangle_key_press;
|
||||||
widget_class->motion_modifier = gimp_tool_rectangle_motion_modifier;
|
widget_class->motion_modifier = gimp_tool_rectangle_motion_modifier;
|
||||||
widget_class->get_cursor = gimp_tool_rectangle_get_cursor;
|
widget_class->get_cursor = gimp_tool_rectangle_get_cursor;
|
||||||
|
widget_class->update_on_scale = TRUE;
|
||||||
|
|
||||||
rectangle_signals[CHANGE_COMPLETE] =
|
rectangle_signals[CHANGE_COMPLETE] =
|
||||||
g_signal_new ("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->leave_notify = gimp_tool_transform_grid_leave_notify;
|
||||||
widget_class->hover_modifier = gimp_tool_transform_grid_hover_modifier;
|
widget_class->hover_modifier = gimp_tool_transform_grid_hover_modifier;
|
||||||
widget_class->get_cursor = gimp_tool_transform_grid_get_cursor;
|
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,
|
g_object_class_install_property (object_class, PROP_TRANSFORM,
|
||||||
gimp_param_spec_matrix3 ("transform",
|
gimp_param_spec_matrix3 ("transform",
|
||||||
|
|
|
@ -221,6 +221,7 @@ gimp_tool_widget_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
GimpToolWidget *widget = GIMP_TOOL_WIDGET (object);
|
GimpToolWidget *widget = GIMP_TOOL_WIDGET (object);
|
||||||
GimpToolWidgetPrivate *private = widget->private;
|
GimpToolWidgetPrivate *private = widget->private;
|
||||||
|
GimpToolWidgetClass *klass = GIMP_TOOL_WIDGET_GET_CLASS (widget);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->constructed (object);
|
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);
|
private->item = gimp_canvas_group_new (private->shell);
|
||||||
|
|
||||||
gimp_canvas_item_set_visible (private->item, private->visible);
|
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
|
static void
|
||||||
|
|
|
@ -125,6 +125,10 @@ struct _GimpToolWidgetClass
|
||||||
const GimpCoords *coords,
|
const GimpCoords *coords,
|
||||||
GdkModifierType state,
|
GdkModifierType state,
|
||||||
const gchar **ui_path);
|
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)
|
switch (action)
|
||||||
{
|
{
|
||||||
case GIMP_TOOL_ACTION_PAUSE:
|
case GIMP_TOOL_ACTION_PAUSE:
|
||||||
break;
|
|
||||||
|
|
||||||
case GIMP_TOOL_ACTION_RESUME:
|
case GIMP_TOOL_ACTION_RESUME:
|
||||||
if (draw_tool->widget)
|
|
||||||
gimp_tool_widget_changed (draw_tool->widget);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GIMP_TOOL_ACTION_HALT:
|
case GIMP_TOOL_ACTION_HALT:
|
||||||
|
|
Loading…
Reference in New Issue