GNOME Bugzilla – Bug 630069
In single-window mode, canvas badly positioned in all successive tabs
Last modified: 2011-03-09 06:31:37 UTC
In single-window mode, any documents opened or created appear with the canvas positioned so that the top left (0,0) is at the top left of the window, except for the first document to be opened (when the tab bar is not there), which is correctly centred in the workspace. All documents should behave as the first one does, centring in the workspace (especially if the entire image can be visible when centred)
This will be fixed
I do not think this is limited to single-window-mode. looks like something to do with app/display/gimpdisplayshell.c where at the end of gimp_display_shell_constructed, we are setup to center after a resize(?) event. If we resize the new viz, gimp does the right thing and centers our canvas. My guess is gimp_display_shell_scale_changed isn't doing the right thing (as far as programmatic resizing)? Some Code of interest from app/display/gimpdisplayshell.c pasted below: if (image) { gimp_display_shell_connect (shell); /* After connecting to the image we want to center it. Since we * not even finnished creating the display shell, we can safely * assume we will get a size-allocate later. */ gimp_display_shell_scroll_center_image_on_next_size_allocate (shell, TRUE, TRUE); } else { ... } /* make sure the information is up-to-date */ gimp_display_shell_scale_changed (shell);
Created attachment 180169 [details] [review] Proposed patch Here one problem is that 'gimp_image_window_keep_canvas_pos' in file 'app/display/gimpimagewindow.c' 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. The attached patch checks the return value of 'gtk_widget_translate_coordinates' to avoid connecting handlers when their execution is considered harmful.
Works like a champ! Nothing like a well positioned if statement.
Thanks Massimo, good job as usual 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.