mirror of https://github.com/GNOME/gimp.git
Bug 630069 - In single-window mode, canvas badly positioned in all successive tabs
The problem is that gimp_image_window_keep_canvas_pos() connects a signal handler too early, with data not yet valid, the handler is executed after the canvas position is computed correctly and so invalid data overrides the valid. Checks the return value of gtk_widget_translate_coordinates() to avoid connecting handlers when their execution is considered harmful.
This commit is contained in:
parent
50419c855e
commit
166c76b62d
|
@ -1065,28 +1065,30 @@ gimp_image_window_keep_canvas_pos (GimpImageWindow *window)
|
|||
gint image_origin_shell_y = -1;
|
||||
gint image_origin_window_x = -1;
|
||||
gint image_origin_window_y = -1;
|
||||
PosCorrectionData *data = NULL;
|
||||
|
||||
gimp_display_shell_transform_xy (shell,
|
||||
0.0, 0.0,
|
||||
&image_origin_shell_x,
|
||||
&image_origin_shell_y);
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (shell->canvas),
|
||||
GTK_WIDGET (window),
|
||||
image_origin_shell_x,
|
||||
image_origin_shell_y,
|
||||
&image_origin_window_x,
|
||||
&image_origin_window_y);
|
||||
|
||||
data = g_new0 (PosCorrectionData, 1);
|
||||
data->window = window;
|
||||
data->x = image_origin_window_x;
|
||||
data->y = image_origin_window_y;
|
||||
if (gtk_widget_translate_coordinates (GTK_WIDGET (shell->canvas),
|
||||
GTK_WIDGET (window),
|
||||
image_origin_shell_x,
|
||||
image_origin_shell_y,
|
||||
&image_origin_window_x,
|
||||
&image_origin_window_y))
|
||||
{
|
||||
PosCorrectionData *data = g_new0 (PosCorrectionData, 1);
|
||||
|
||||
g_signal_connect_data (shell, "size-allocate",
|
||||
G_CALLBACK (gimp_image_window_shell_size_allocate),
|
||||
data, (GClosureNotify) g_free,
|
||||
G_CONNECT_AFTER);
|
||||
data->window = window;
|
||||
data->x = image_origin_window_x;
|
||||
data->y = image_origin_window_y;
|
||||
|
||||
g_signal_connect_data (shell, "size-allocate",
|
||||
G_CALLBACK (gimp_image_window_shell_size_allocate),
|
||||
data, (GClosureNotify) g_free,
|
||||
G_CONNECT_AFTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue