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 664584 - "Close Window" in single-window mode should close Gimp
"Close Window" in single-window mode should close Gimp
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: User Interface
2.7.3
Other All
: Normal normal
: 2.8
Assigned To: Jehan
GIMP Bugs
: 672290 677119 700946 702343 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-11-22 19:20 UTC by Jan Rüegg
Modified: 2013-06-17 21:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Close GIMP when closing window in single-window mode (853 bytes, patch)
2011-12-03 17:26 UTC, Niels Martignène
none Details | Review
WM DELETE event in single window mode is synonym to file-quit. (1.79 KB, patch)
2013-05-11 00:23 UTC, Jehan
none Details | Review
patch for "close" in single window mode (1.82 KB, patch)
2013-05-24 16:20 UTC, Hartmut Kuhse
none Details | Review

Description Jan Rüegg 2011-11-22 19:20:15 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.
Comment 1 Stefano Ferri 2011-11-22 20:56:42 UTC
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.
Comment 2 Martin Nordholts 2011-11-23 21:36:28 UTC
Something for 2.10 perhaps. For now we need to get 2.8 out.
Comment 3 Niels Martignène 2011-12-03 17:26:12 UTC
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.
Comment 4 Michael Schumacher 2012-03-17 12:14:19 UTC
*** Bug 672290 has been marked as a duplicate of this bug. ***
Comment 5 Michael Schumacher 2012-05-30 20:20:57 UTC
*** Bug 677119 has been marked as a duplicate of this bug. ***
Comment 6 Michael Schumacher 2012-12-27 00:06:42 UTC
A bug with a target milestone should not go unconfirmed.
Comment 7 Jehan 2013-05-11 00:23:21 UTC
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.
Comment 8 Michael Natterer 2013-05-11 18:26:16 UTC
I agree, please push to master and 2-8.
Comment 9 Jehan 2013-05-11 20:00:33 UTC
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)
Comment 10 Michael Natterer 2013-05-24 09:40:14 UTC
*** Bug 700946 has been marked as a duplicate of this bug. ***
Comment 11 Hartmut Kuhse 2013-05-24 16:20:29 UTC
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.
Comment 12 Jehan 2013-05-24 17:44:56 UTC
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?
Comment 13 Michael Natterer 2013-05-24 21:53:26 UTC
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).
Comment 14 Michael Natterer 2013-05-24 21:55:34 UTC
On second thought, maybe we should... Can you try that and see if it
fixes all cases?
Comment 15 Jehan 2013-05-24 22:30:14 UTC
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)
Comment 16 Michael Natterer 2013-06-17 21:02:32 UTC
*** Bug 702343 has been marked as a duplicate of this bug. ***