[gimp] Bug 630069 - In single-window mode, canvas badly positioned in all successive tabs
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 630069 - In single-window mode, canvas badly positioned in all successive tabs
- Date: Wed, 9 Mar 2011 06:31:13 +0000 (UTC)
commit 166c76b62d543487285a63a6d657a226240fd176
Author: Massimo Valentini <sixtysix inwind it>
Date: Wed Mar 9 07:30:15 2011 +0100
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.
app/display/gimpimagewindow.c | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index df9dfe7..6cf554d 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -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;
-
- g_signal_connect_data (shell, "size-allocate",
- G_CALLBACK (gimp_image_window_shell_size_allocate),
- data, (GClosureNotify) g_free,
- G_CONNECT_AFTER);
+
+ 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);
+
+ 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);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]