After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 164281 - "Resize window on Zoom" feature is overzealous
"Resize window on Zoom" feature is overzealous
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: User Interface
2.2.x
Other Linux
: Normal minor
: 2.2
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-01-16 21:05 UTC by Vanessa Dannenberg
Modified: 2008-01-15 12:45 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Vanessa Dannenberg 2005-01-16 21:05:42 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.
Comment 1 Sven Neumann 2005-01-18 14:07:57 UTC
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.
Comment 2 Dave Neary 2005-01-18 14:37:38 UTC
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.
Comment 3 Dave Neary 2005-01-18 20:16:50 UTC
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...

  • #3 gimp_display_shell_scale
    at gimpdisplayshell-scale.c line 388
  • #19 view_actions_set_zoom
    at view-actions.c line 599
  • #20 view_actions_update
    at view-actions.c line 503
  • #21 gimp_action_group_update
    at gimpactiongroup.c line 363
  • #22 gimp_ui_manager_real_update
    at gimpuimanager.c line 351
  • #29 gimp_ui_manager_update
    at gimpuimanager.c line 403
  • #35 gimp_context_display_changed
    at gimpcontext.c line 1752
  • #36 gimp_context_real_set_display
    at gimpcontext.c line 1788
  • #37 gimp_display_shell_events
    at gimpdisplayshell-callbacks.c line 268
  • #38 gimp_display_shell_canvas_tool_events
    at gimpdisplayshell-callbacks.c line 482
  • #44 gtk_widget_send_expose
    from /usr/lib/libgtk-x11-2.0.so.0

Comment 4 Dave Neary 2005-01-18 20:19:55 UTC

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.
Comment 5 Sven Neumann 2005-05-06 13:17:09 UTC
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.