GNOME Bugzilla – Bug 582931
nautilus steals eog focus when opening second image
Last modified: 2015-04-05 17:42:55 UTC
I download 2 images from the web into my Desktop. I open a web browser that occupies most of the desktop space but where the images are, then double-click on the first of them, eog stays on top of the browser, double-click the second one, new eog stays on top of browser and first image. Now I open a nautilus window and go to Desktop. Double-click on the first image, eog stays on top of the browser. Double-click on the second image, and it's hidden behind the nautilus window. Other information:
Which distribution is this? Do you have desktop effects activated?
Ubuntu 8.10. And no Desktop effects at all. I've tried the same with Ubuntu 9.04 LiveCD, and I get the same results.
-> eog This is a bug in EOG, as Evince works good with the same testcase.
I don't see this with eog either here. Double-clicking the second image in the nautilus window correctly raises it above all other windows (browser,eog-1, nautilus). Cosimo, did you just try Evince or eog also?
(In reply to comment #4) > I don't see this with eog either here. Double-clicking the second image in the > nautilus window correctly raises it above all other windows (browser,eog-1, > nautilus). Strike that. I experienced it myself now. Wonder, what's changed since May.
It's really strange. There seems to be some randomness involved. Sometimes it's working correctly and sometimes it fails.
*** Bug 608755 has been marked as a duplicate of this bug. ***
*** Bug 612839 has been marked as a duplicate of this bug. ***
I was now also able to reproduce it with The Gimp, which is like eog a single-instance-multiple-windows-app. Interestingly it makes a difference if the initial instance of eog/gimp was started from the terminal or by nautilus. If it's started from the terminal it's working as expected. Apparently evince does things a little bit different than eog as it's not affected.
(I posted this a few minutes ago but for some reason wasn't successful.) Just to say, I'm not sure this is a case of nautilus "stealing" focus -- the same issue happens when I try: * opening with Konqueror * opening using `xdg-open <image>' * opening directly using `eog <image>' I can't confirm that there's any randomness involved. The "single-instance-multiple-windows-app" thing is something to look at -- the issue doesn't exist with any instance-per-window apps AFAICS. I can confirm that the case also exists with the GIMP. It also exists with the GIMP when opening from other sources. So, this is neither an issue with nautilus, nor with eog! My guess is that this is something like an issue with the window manager?
Bug reporting this with GIMP: bug 562495. This report with Evo seems to be related as well: bug 559449 It mentions bug 273912, which connects this with metacity's focus stealing prevention. We'll have to check Elijah's instructions from bug 273912 comment 3 against eog. AFAIK we are sending the timestamp to the existing instance as Elijah recommends. Bug 573922 seems to be related as well.
*** Bug 627979 has been marked as a duplicate of this bug. ***
Confirmed in eog 3.4.2-1 in Debian
Happens to me with eog-3.4.3-2.fc17.x86_64 on 64 bit Fedora 17. Every image I open after the first opens underneath nautilus. Even if I open the first on my laptop display (image opens on top), move nautilus to my external display, and try to open another image, the second window will still open underneath nautilus. I get a notification from shell, saying that the file opened and is ready. This has driven me to switch back to Shotwell.
This is happening because the user interaction timestamp of the event that opens the second image isn't being passed to the primary instance of eog. This timestamp is needed when opening the new window to allow the window to come to the top. The timestamp should be getting passed automatically, but when the display is opened, the DESKTOP_STARTUP_ID environment variable gets cleared, which prevents the timestamp from being forwarded over dbus. To fix this, the display needs to be not opened until the variable is read, which requires moving a bunch of initialization out of main() and into eog_application_startup(). Patch below.
Created attachment 254324 [details] [review] move initialization later to avoid losing event timestamp
Nice catch, John! :) Moving that code to EogApplication also makes sense, as only the primary instance should need to call it. Thanks for patching. commit 997742b4f0d9023d402f5e7a519aca12fba2be46 Author: John Hiesey <> Date: Sat Sep 7 01:02:51 2013 +0000 Delay display initialization to avoid losing event timestamp Should fix a new window not receiving focus when opening another image from Nautilus. https://bugzilla.gnome.org/show_bug.cgi?id=582931 --- This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.
*** Bug 743800 has been marked as a duplicate of this bug. ***
*** Bug 747357 has been marked as a duplicate of this bug. ***