GNOME Bugzilla – Bug 164281
"Resize window on Zoom" feature is overzealous
Last modified: 2008-01-15 12:45:38 UTC
Please describe the problem: Normally, when you zoom in on an image, The GIMP will resize the window if you have that feature turned on (File -> Preferences -> Image Windows -> "[ ] Resize window on zoom"). Normally, if the image is zoomed to a point that it won't fit on screen, The GIMP will resize the window to preset dimensions if this feature is enabled. However, if you are zoomed in to this point where the window size is in that "preset dimensions" range, and you then manually resize the window to something smaller than the default size, The GIMP will forceably resize the window back to the default when the window gains focus again. Steps to reproduce: 1. Open two images of any type. 2. Turn on the "Resize window on zoom" feature in Preferences. 3. Using the =/+ key, zoom the image such that it's too big to fit on the screen. Notice that the window eventually gets resized to a fixed "default" size. 4. Using the window borders or your favorite window manager shortcuts, manually resize that window so that it is smaller than the default size. 5. Give focus to the other image window. 6. Give focus to the resized window. Notice that it suddenly resizes back to the default size it went to when you first zoomed in. Actual results: The above, exactly as described. Expected results: The window dimensions should stay exactly as I have set them, unless I explicitly change them or change the zoom level. Does this happen every time? Yes, it is consistant Other information: The window manager I use is Afterstep, with focus-follows-mouse mode enabled.
I can reproduce this here. However I didn't think anyone would actually ever use the "Resize window on zoom" preference. Perhaps we should get rid of.
I'll have a look to see if an expose event triggers a display_shell_shrink_wrap() or somesuch. It shouldn't, but anyway... This is probably an easy fix.
An expose event does trigger display_shell_shrink_wrap. I'm attaching the (annotated) interesting bits of a stack trace taken when we arrive in the shrink wrap after the expose. Hmm... gimp_display_shell_scale() calls (eventually) gimp_display_shell_shrink_wrap() if "resize window on zoom" is set...
+ Trace 54657
So what's happenning is that the update of the display is updating (among other things) the zoom drop-down, thus causing the problem. The fix would be to only emit an expose event to the canvas I think - if even. If the window is hidden by any other window than a GIMP window, it re-renders normally afterwards.
This simple change seems to fix the problem (applied to both branches): 2005-05-06 Sven Neumann <sven@gimp.org> * app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale_by_values): abort early if the values are all setup already. Fixes bug #164281.