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 465488 - Focus stealing prevention bug
Focus stealing prevention bug
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
0.8.x
Other All
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-08-10 19:38 UTC by sedillard
Modified: 2009-03-12 20:52 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18



Description sedillard 2007-08-10 19:38:35 UTC
Please describe the problem:
Opening 2nd instance of evince does not raise window if there already is a 1st instance running. 

Steps to reproduce:
1. Open terminal
2. run 'evince x.pdf &'
3. alt-tab back to terminal
4. run 'evince y.pdf &'


Actual results:
Focus is left on terminal

Expected results:
Focus should be given to y.pdf

Does this happen every time?
Yes

Other information:
At first glance it seems like a metacity bug, but I think the behavior happens because evince is not following the protocol for opening new windows.

Opening pdfs from nautilus works fine (y.pdf gets focus.) I've skimmed some of the old FSP bugs for metacity, and I think the problem is this: when the 2nd instance is launched, and it forwards the action to the 1st instance, the "last user interaction" timestamp needs to be updated for the 1st instance. Since the open-window request is much newer than the "last user interaction" timestamp, metacity thinks that the 1st instance is trying to steal focus.

Firefox also has this problem of not updating the timestamp. Here is a page with a patch for firefox, so you can see what I mean: http://cgwalters.livejournal.com/tag/firefox+focus+gnome+linux

Note that epiphany does not have this bug, so you could also look there to see how it's done.

Here is an old bug thread discussing the "last user interaction" timestamp thing: http://bugzilla.gnome.org/show_bug.cgi?id=149028
Comment 1 Carlos Garcia Campos 2007-08-11 08:57:55 UTC
hmm, I can't reproduce it with evince from svn trunk, and I think we haven't changed anything related to this from 0.8.x to 0.9.x. 
Comment 2 Sven Arvidsson 2008-04-15 20:23:22 UTC
A Debian user have reported a similar problem with Evince and Metacity 2.20:

"The problem occurs (only, AFAIS) when the other instance of evince is running on
a different desktop/workspace in a minimized window! All other combinations did
not make the problem to occur. So yes, it is related to the issue you mentioned.
When reproducing it, please focus on the combination I described."

I can however, not reproduce this myself. The full report is at http://bugs.debian.org/475372
Comment 3 Paul Bryan 2008-09-28 23:54:34 UTC
I can reproduce this on demand, using GNOME Terminal:

Steps:
1. Open Evince with a PDF document.
2. That that document still open, open another.

The second document does not have focus.
Comment 4 Paul Bryan 2008-09-28 23:54:55 UTC
Also reported in Ubuntu:

https://bugs.edge.launchpad.net/ubuntu/+source/evince/+bug/232219
Comment 5 Carlos Garcia Campos 2008-10-12 15:09:43 UTC
I still can't reproduce it with evince 2.24
Comment 6 gnome 2008-10-16 15:15:13 UTC
Can't reproduce it on Ubuntu Hardy with evince 2.22.2 and metacity 2.22.0. It doesn't care whether Evince is maximised or not.
Comment 7 Paul Bryan 2008-10-16 15:20:38 UTC
I just (very easily) reproduced it on Ubuntu Hardy with Evince 2.22.2 and 2.22.0.
Comment 8 gnome 2008-10-16 15:25:20 UTC
I'm using sloppy focus-follows-mouse. If I change to click-to-focus indeed I can reproduce it. Sorry for the noise!
Comment 9 kpalberg 2009-03-12 17:37:20 UTC
This was fixed in 2.23.91 by the following:

http://svn.gnome.org/viewvc/evince/trunk/shell/ev-application.c?r1=3130&r2=3131
Comment 10 Wouter Bolsterlee (uws) 2009-03-12 20:52:47 UTC
Thanks, marking fixed then.