GNOME Bugzilla – Bug 664584
"Close Window" in single-window mode should close Gimp
Last modified: 2013-06-17 21:02:32 UTC
Hitting the "Close Window" button in Gimp (the one from the window manager) makes Gimp close the currently open image. This makes sense in the normal mode, where every image has its own window, bit in single-window mode, it would be better to close Gimp entirely. Right now, when there are three images open, you have two hit the same "cross" button four times to exit gimp, what is a bit counter-intuitive.
Yes, this is annoying. Seems like the close button inherits the properties of the image window as in multi window mode. In single window mode, Gimp should ask, at the same time, if the images have to be saved, then exit.
Something for 2.10 perhaps. For now we need to get 2.8 out.
Created attachment 202714 [details] [review] Close GIMP when closing window in single-window mode Here is a simple patch that implements the desired behavior, closing the window through the window manager or Alt+F4 now does the same as File > Quit. Works as desired for me on Linux/Openbox but I did not test it extensively.
*** Bug 672290 has been marked as a duplicate of this bug. ***
*** Bug 677119 has been marked as a duplicate of this bug. ***
A bug with a target milestone should not go unconfirmed.
Created attachment 243824 [details] [review] WM DELETE event in single window mode is synonym to file-quit. Hi, I just tested Niels Martignène's patch from 2011. Well it works. And I agree that the current behavior is annoying because you definitely expect your software to close on reception of the window manager DELETE event (obviously still with all the usual safety checks, like asking you to save if some images are dirty, etc.). I made a variation to the patch though, in that I don't call gimp_exit() directly because I believe the exact same behavior as the "file-quit" event is expected here. So I activate the "file-quit" action instead. Of course right now this is the same as gimp_exit() as this is what "file-quit" does, but if we were to modify the behavior someday, we would do it only in this one single place.
I agree, please push to master and 2-8.
commit 714c232eee4d966f782d8e882cb5645a8feed0f4 Author: Jehan <jehan@girinstud.io> Date: Sat May 11 09:04:33 2013 +0900 Bug 664584: WM DELETE event in single window mode is synonym to file-quit. In multi-window mode, closing an image window is only meant to close the current image (unless this is the last empty window). In single window mode though, you are meaning to close the whole program. Thanks to Niels Martignène for the original patch. (cherry picked from commit 6008c2019bd2824a272455da59d6212fd3695533)
*** Bug 700946 has been marked as a duplicate of this bug. ***
Created attachment 245254 [details] [review] patch for "close" in single window mode The proposed patch creates a problem in single window mode. The "Close - CTRL-W" menu item in File menu fires a GDK_DELETE event for the active window, so it behaves like "Quit" in single window mode. I suggest following patch to resolve that problem.
Hello Hatmut, first of all, thanks for the patch. Now there is no problem on master. Both clicking in the "file > Close View" or hitting the ctrl-w shortcut would just close a single tab in single window mode, as expected. But I can reproduce on gimp-2-8 indeed. The problem is not about this bug. I see in your patch that you modify window_close_cmd_callback() which is not the callback for the "view-close" action in master since bug 685559 (now there is view_close_cmd_callback()), but it still is in gimp-2-8. I think the right solution would be to cherry-pick all commits from bug 685559. Mitch, should we do this?
That looks a bit intrusive, why don't you just hack up withever works as a fix in 2.8, if possible (didn't look at the details).
On second thought, maybe we should... Can you try that and see if it fixes all cases?
Hi, I think that's better to cherry-pick indeed because just making too many GIMP 2.8 specific hacks may backfire later if source code were to diverge too much (moreover let's not waste too long on GIMP 2.8 code if we already have existing fixes on master :p). And anyway whatever we did in bug 685559 was actually pretty good user experience improvement, which we could even consider UI bug fix (no new action in the end, so that's not a new feature, even though the report title was about this at first). Anyway I backported all 5 commits that relates to bug 685559, and now GIMP 2.8 also has this much nicer behavior of the view-close action where it won't close docks by mistake. :-) And that also fixes the problem highlighted by Hartmut. commit c947260d2db0d761668dd7b16f195f9ed3d458c6 Author: Jehan <jehan@girinstud.io> Date: Wed Dec 12 15:14:42 2012 +0900 actions: dock-close had a default shortcut colliding with view-close. When the accelerator is NULL, gtk_action_group_add_action_with_accel() would use the default one for the stock icon used. And GTK_STOCK_CLOSE default accelerator is "<Primary>w" which we already use for view-close. We must use empty string when we want no default accelerator. (cherry picked from commit 28669b07d193515ee5fc4bc35b154909a9d35169) commit 6cda75205a1c1d444efbe1e43ad85f68565f7912 Author: Michael Natterer <mitch@gimp.org> Date: Fri Dec 14 09:54:17 2012 +0100 app: add the "view" action group to all docks so all image and view related shortcuts work globally now. (cherry picked from commit b234f5f879f1aeec704904f0c85562290b283b46) commit ae8749a9a7cfcdf294873bada2c0e664ec0914b5 Author: Michael Natterer <mitch@gimp.org> Date: Wed Dec 12 23:26:46 2012 +0100 app: can't call view_actions_setup() from file_actions_setup() This breaks Ctrl+W from docks to close the active display, we'll need another solution for this. (cherry picked from commit 0ff07fa385f401a7f9758d724a06304840f2f8c0) commit 1380b0696cbae20cbe04742da6ab3926a67674cb Author: Jehan <jehan@girinstud.io> Date: Wed Dec 12 16:05:39 2012 +0900 actions: forgot an include which was triggering an "implicit declaration" warning. (cherry picked from commit 8a935f05a07a89279538f638d5d43f165d34a6e6) commit 22d4cd02fc6b56e342d4645921575b7f3f462a90 Author: Jehan <jehan@girinstud.io> Date: Mon Nov 26 00:18:00 2012 +0900 Bug 685559 - view-close action modified to close only an image view. view-close was closing also toolbox docks if they had the focus. Now this action will close only the current active image view (if any), whatever the window which has actual focus. Additionally all other view actions are available on dock focus. (cherry picked from commit 2ad8634c06814219728bb10fbe59a63afc42fdea)
*** Bug 702343 has been marked as a duplicate of this bug. ***