Merge lp:~andrea.corbellini/terminator/bring-to-front into lp:terminator/trunk

Proposed by Andrea Corbellini
Status: Merged
Merge reported by: Chris Jones
Merged at revision: not available
Proposed branch: lp:~andrea.corbellini/terminator/bring-to-front
Merge into: lp:terminator/trunk
Diff against target: 16 lines (+4/-2)
1 file modified
terminatorlib/window.py (+4/-2)
To merge this branch: bzr merge lp:~andrea.corbellini/terminator/bring-to-front
Reviewer Review Type Date Requested Status
Chris Jones Pending
Review via email: mp+128994@code.launchpad.net

Description of the change

How to reproduce the problem:
1. enable the dbus server;
2. open a terminator instance;
3. open a new application (e.g. firefox) and ensure it has focus;
4. launch terminator again.

What should happen:
A new terminator window should be created above firefox.

What happens:
A new terminator window is created, but is below firefox.

Why this happens:
Because window.present() is called after window.show(). When called after show(), present() has the effect of bringing the window in front of the windows of the same applications. Instead, if present() is called before show(), the window will be brought above all windows, including the windows that belong to other applications.

Note: this happens with Unity. Other window managers may behave differently and might not need this patch, however it doesn't hurt them.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/window.py'
2--- terminatorlib/window.py 2012-07-10 19:57:23 +0000
3+++ terminatorlib/window.py 2012-10-10 16:47:24 +0000
4@@ -373,8 +373,10 @@
5
6 def show(self, startup=False):
7 """Undo the startup show request if started in hidden mode"""
8- gtk.Window.show(self)
9- #Present is necessary to grab focus when window is hidden from taskbar
10+ #Present is necessary to grab focus when window is hidden from taskbar.
11+ #It is important to call present() before show(), otherwise the window
12+ #won't be brought to front if an another application has the focus.
13+ #Last note: present() will implicitly call gtk.Window.show()
14 self.present()
15
16 #Window must be shown, then hidden for the hotkeys to be registered