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 448946 - zenity widgets steal focus
zenity widgets steal focus
Status: RESOLVED WONTFIX
Product: zenity
Classification: Core
Component: general
2.19.x
Other All
: Normal normal
: ---
Assigned To: Zenity Maintainers
Zenity Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-06-18 22:51 UTC by Brian J. Murrell
Modified: 2009-08-06 15:45 UTC
See Also:
GNOME target: ---
GNOME version: 2.19/2.20



Description Brian J. Murrell 2007-06-18 22:51:43 UTC
Please describe the problem:
As per the metacity folks and the long, long issue of focus stealing, zenity needs to co-operate with the window manager to not steal focus from other applications when it pops up a dialog.

Steps to reproduce:
1. Simply write a small script to pop up a dialog and watch it steal focus 100% of the time.


Actual results:


Expected results:
As per the metacity team, a properly behaving application should not steal focus.

Does this happen every time?
Yes.

Other information:
I can dig up the references from the metacity team but at this point I will just assume that y'all understand these issues.  Please advise if you need further information.
Comment 1 Tom Tromey 2008-04-19 20:15:02 UTC
I don't really know the issues, but I do see this behavior.
Something is odd though since the only references I see to
the focus are in progress.c, but I see the behavior for any
type of popup.  So perhaps one of us is misreading -- either
the behavior or the code.
Comment 2 Brian J. Murrell 2008-04-20 02:23:02 UTC
It's sad to see that this bug, posted originally 10 months ago has not even been triaged.  Is <zenity-maint@gnome.bugs> a blackhole?
Comment 3 Tom Tromey 2008-04-20 15:03:10 UTC
I don't know about that.  I do know that there are a number of
reasonable patches sitting in bugzilla, some for a long time.
I don't know Gnome protocol in this area any more.  How would I
go about getting them into svn?
Comment 4 Lucas Rocha 2008-04-20 19:39:58 UTC
Hi all, my fault! I've been busy with other stuff and ended up putting zenity with lower priority than normal. Will try to review and commit what makes sense this week. Thanks for the pings anyway. :-)
Comment 5 Lucas Rocha 2008-04-21 21:11:55 UTC
Hey, I have a fix for that but there's a side effect which I'm not is what we expect from a tool like zenity... 

If I make zenity not steal the focus, it won't popup in front the terminal window, for example (with metacity) - because the terminal owns the focus at the moment zenity runs. This can be really annoying for testing scripts using zenity for example.
Comment 6 hugh 2008-12-14 13:11:33 UTC
I think one aspect of the problem is that the people who object to Zenity stealing focus are using the wrong tool for their immediate purpose. What is needed in many cases is an on-top, unfocused alert from libnotify. This is supposed to be implemented in Zenity, but I, personally, can't make it work for scripts at the moment. Luckily, there is a command-line interface to libnotify, notify-send, that is an excellent compliment to Zenity.

Install libnotify-bin and test notify-send with:
notify-send --icon=gtk-dialog-info --urgency=low --expire-time=5000 "Helpful message"

I was dismayed when the new version of Zenity started opening windows in the background, but I found a patch here - https://bugs.launchpad.net/ubuntu/+source/zenity/+bug/272083 - that brings them back to the front.

Conceptually, to me, Zenity is not really a separate program, so I definitely want the windows opening on top. For instance, I use Zenity extensively with Nautilus scripts, so, on those occasions, I think of Zenity as part of Nautilus, and want and expect Zenity windows to take focus when invoked.
Comment 7 Brian J. Murrell 2008-12-17 17:44:54 UTC
Hrm.  Yes.  There appears to be two different issues at play here.  Focus stealing (i.e. i'm typing my password into an application and zenity pops up a window, steals focus and my password starts to get entered into the zenity pop-up) and proper notification of a new window.

I'm not sure how to separate them, but they are separate.
Comment 8 Pedro Villavicencio 2009-01-28 14:58:19 UTC
a patch was submitted to the ubuntu report:

http://launchpadlibrarian.net/18653141/zenity-2.24.0-focus.patch

May someone have a look to it and see if it makes sense? Lucas? ;-)
Comment 9 Martin Pitt 2009-04-20 07:17:37 UTC
This patch essentially reverts

  http://svn.gnome.org/viewvc/zenity?view=revision&revision=1364
Comment 10 Vincent Untz 2009-08-05 14:21:39 UTC
Lalalala, ping? The patch looks good to me.
Comment 11 Lucas Rocha 2009-08-06 15:42:55 UTC
Patch doesn't apply anymore because we moved out from glade files. I created a new patch locally. The patch does the exact opposite of what the bug report is requesting :-P Currently, zenity is *not* stealing focus.

After some thought, considering we have no way to deal with window stacking without messing with focus in zenity, my impression is that for a tool like zenity (most likely to be used as an utility inside apps than an app per se) it's just annoying to not steal focus by default. An option to explicitly disable that is requested in bug 587353 which kind of makes sense to me... For non-intrusive notifications, people should probably be using notifications (zenity --notification --listen, etc).

Closing this one as WONTFIX.
Comment 12 Lucas Rocha 2009-08-06 15:45:43 UTC
Bug 561131 is the one that was marked as fixed btw.