← Back to team overview

unity-dev team mailing list archive

Re: Window Focus in Unity

 

Hi,

I've run additional experiments and found that the described focus model is the same in Unity 2D & GNOME Shell. I've added a reproducer for PyQt4 [1] and it still happens.

Could you give me a tip which library / technology influence this focus behavior? Where to look next?

Thanks

Izidor

1: https://code.launchpad.net/~izidor/%2Bjunk/focus-model/

Am 03.04.2012 23:31, schrieb Izidor Matušov:
Hi,

I am one of maintainers of Getting Things GNOME! (GTG), a task manager
application. I would like to add a feature where you trigger a keyboard
shortcut and you can immediately start typing a new task you want to do
in future, e.g. you browse web and you remember that you have to call
your cousin tomorrow. I was able to setup all needed parts but a new
window doesn't get focus. You have to switch to the window by mouse or
keyboard what kills the feature :-(

I've prepared a simple demo to test:
https://code.launchpad.net/~izidor/%2Bjunk/focus-model/

Run the main application (app.py) which provides a DBus method to open a
new window. In another terminal window, run Launcher.py which calls that
method and makes the app open a new window.

As you can see in image 01.png, a very strange thing happens: the new
window is put in over all windows but it doesn't get focus, i.e. when
you start typing, you don't change the text of the entry.

I have hard times to understand Window Focus Model in Unity. It seems to
me that a new window gets a focus only:
* when its application had already focus
* or when the window is the first shown window of an application

Another thing is when I use window.preset(), the window is put into the
background and an animation in Unity Launcher is shown. (Try it by
uncommenting a line in app.py).

This behavior affect all other AppIndicators I use too:
* when you open Empathy contact list from the indicator-messages, the
window doesn't get focus either, see 02.png. When I type, I type in the
gnome-terminal in background. (You might need to open the window and
close it few times to prevent showing the window for the first time of
application)

* Hamster Appindicator ( http://albertomilone.com/wordpress/?p=502 ) --
after showing the first window, it doesn't get any focus

* GTG's Appindicator -- Although it doesn't run over DBus, it has the
same problem. You have to choose an action from appindicator and then
switch to a new window.

* Banshee from Sound Menu is a little bit tricker: almost every time you
close banshee, you turn it off. The next time you open it, banshee
starts as a new process and an exception is applied.

However, this doesn't apply to Skype whose contact list can be shown
from its status icon with focus.

I use Ubuntu 11.10, unity 4.28.0-0ubuntu2.

My question is: How to give focus to a new window so the user can write
in it without switching windows? Is this Window Focus by intention or it
is a bug?

Thanks,
Izidor



Follow ups

References