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 112031 - focus issue wrt dialogs in metacity
focus issue wrt dialogs in metacity
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2003-05-01 22:15 UTC by Jakub Steiner
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
focus mru window on window free and on window minimize. (2.30 KB, patch)
2003-08-21 04:17 UTC, Rob Adams
none Details | Review

Description Jakub Steiner 2003-05-01 22:15:50 UTC
A window doesn't get focus if a dialog is dismissed that was above an image
window. 

To reproduce:
* use metacity WM, 'sloppy focus' (focus follows mouse, only entering a new
window changes the focus (doesn't lose it leaving one) [1])
* create a new image
* choose image>scale; brings up a dialog
* set some values to scale it up (to make sure the window remains below the
cursor and click OK

Now a funny thing happens. The dialog is dismissed and the image window
below it seems to get the focus and immidiately loses it.

P.S.: I tried finding a bugreport on this, since I know mitch has been
investigating the issue, but didn't succeed. sorry if it's a dupe.

[1] my humble explanation ;)
Comment 1 Jakub Steiner 2003-05-01 22:17:44 UTC
I forgot to mention this is only an issue with GIMP. Before someone
acuses me misfiling the apropriate module ;)
Comment 2 Sven Neumann 2003-05-02 11:04:31 UTC
Still a window manager issue and should be reported against metacity.
The GIMP is not doing anything special here.
Comment 3 Jakub Steiner 2003-05-02 12:33:12 UTC
Additional info:

* one of my docks steals the focus (so does tigert's although a
different one)
* the dock windows are utility windows (GDK_WINDOW_TYPE_HINT_UTILITY)

Maybe the fact that metacity keeps them above the image windows
(NORMAL) results in this? I do like them being above the image windows
though.

cc:ing garrett and havoc, because they can work it out in person.
Garrett being a GIMP person and havoc a metacity father ;)
Comment 4 Havoc Pennington 2003-05-02 17:59:44 UTC
what's a dock window in this context?

The problem is probably in fact that it focuses the topmost window. 
Should be changed to focus last-used window.
Comment 5 Jakub Steiner 2003-05-02 21:20:08 UTC
I'm not sure what kind of information you need about the dock. 

Gimp UI consists of the main tollbox with a menu, image windows
containing artwork and then optional docks (you can have them turned
off). 

Docking is a new concept in GIMP. But apart from the new hint
(GDK_WINDOW_TYPE_HINT_UTILITY) and the fact that you can attach them
together ('dock' them) they are just windows where you can set tool
options, manage image layers, select colors, gradients etc just like
in 1.2. 

A sample GIMP session is on the following screenshot (there's only one
window I referred to as 'dock' on it, since the others are attached to
the main toolbox window):

http://developer.gimp.org/screenshots/gimp-text.jpeg

At that session, dock#1 would get focus when I'd dismiss the scale dialog.

I'm willing to test the 'focus last window' patch ;)
Comment 6 Sven Neumann 2003-08-15 17:10:37 UTC
Raising severity to major since it seems to be a major problem for
GIMP users and is reported frequently.
Comment 7 Rob Adams 2003-08-16 16:03:13 UTC
can somebody test this with the MRU-focus patch that just went into
CVS HEAD.  Hopefully this won't be a problem any more.  Whether we
want to continue stacking utility windows above is a topic for further
discussion on Bug 115092.
Comment 8 Jakub Steiner 2003-08-16 21:31:02 UTC
Just tested with metacity HEAD and I can observe no change wrt to this
unfortunately :(

The dialog is dismissed, the image below it blinks as it gets focus
and loses it in a split second to one of the docks.
Comment 9 Rob Adams 2003-08-17 16:55:43 UTC
I see, apparently the full fix wasn't in that patch.  Try it with the
patch that's on Bug 108643.
Comment 10 Jakub Steiner 2003-08-19 17:17:28 UTC
http://bugzilla.gnome.org/showattachment.cgi?attach_id=19283 doesn't
seem to apply to HEAD if that's what you ment.
Comment 11 Rob Adams 2003-08-19 17:26:26 UTC
it's been committed now.  Try it with HEAD.
Comment 12 Jakub Steiner 2003-08-19 17:31:12 UTC
I noticed the fix of #108643 in HEAD. It seems to have fixed most of
the annoying situations.

This situation seems to work now:

1) create a new image
2) select image>filters>render>clouds>solid noise

The image gets the focus once the dialog is dismissed pressing OK.
This was broken before, now works.

However:

1) create new image
2) image>scale; OK

still focuses the dock, not the image window. 

I'm quite happy with the fix since it's most annoying when applying
filters. Feel free to close it if you don't feel like investigating
why scaling is different.
Comment 13 Rob Adams 2003-08-19 17:41:47 UTC
OK I've actually fired up the gimp now and tried it and I see what you
mean.  I'll play with it a bit over the next couple days and see what
I can come up with.  The GIMP doesn't try to set focus on any of its
windows on its own, does it?
Comment 14 Jakub Steiner 2003-08-20 13:01:22 UTC
After using this for a while I found a few more places where this is
still broken:

* using the text tool's editor dialog (once dismissed, a dock is
focused, not the image window)
* using the save dialog (file>save as or save a copy)
Comment 15 Rob Adams 2003-08-21 04:16:03 UTC
OK it looks like the patch that went in didn't use the MRU list for
focus like I thought it was going to (after all, what was the point
otherwise?).

I'm attaching a simple patch that seems to fix the problems that Jakub
and I were able to observe.
Comment 16 Rob Adams 2003-08-21 04:17:08 UTC
Created attachment 19400 [details] [review]
focus mru window on window free and on window minimize.
Comment 17 Havoc Pennington 2003-08-21 04:29:12 UTC
Looks good to me, thanks.
Comment 18 Rob Adams 2003-08-21 04:32:53 UTC
committed.  Hopefully gimping will be a more pleasant experience when
using metacity from now on ;-)
Comment 19 Jakub Steiner 2003-08-21 13:12:56 UTC
This has indeed fixed all the other cases. Thank you so much for the
fix. It was a truly annoying bug.