Merge lp:~robert-ancell/unity-greeter/focus-crash into lp:unity-greeter

Proposed by Robert Ancell
Status: Merged
Approved by: Robert Ancell
Approved revision: 1114
Merged at revision: 1114
Proposed branch: lp:~robert-ancell/unity-greeter/focus-crash
Merge into: lp:unity-greeter
Diff against target: 36 lines (+13/-11)
1 file modified
src/unity-greeter.vala (+13/-11)
To merge this branch: bzr merge lp:~robert-ancell/unity-greeter/focus-crash
Reviewer Review Type Date Requested Status
Robert Ancell Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+204738@code.launchpad.net

Commit message

Handle a window being destroyed after we get the map event and try and focus it

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/unity-greeter.vala'
2--- src/unity-greeter.vala 2013-11-08 18:07:31 +0000
3+++ src/unity-greeter.vala 2014-02-04 17:00:31 +0000
4@@ -304,19 +304,21 @@
5 var display = Gdk.x11_lookup_xdisplay (xevent.xmap.display);
6 var xwin = xevent.xmap.window;
7 var win = Gdk.X11Window.foreign_new_for_display (display, xwin);
8-
9- /* Check to see if this window is our onboard window, since we don't want to focus it. */
10- X.Window keyboard_xid = 0;
11- if (main_window.menubar.keyboard_window != null)
12- keyboard_xid = Gdk.X11Window.get_xid (main_window.menubar.keyboard_window.get_window ());
13-
14- if (xwin != keyboard_xid && win.get_type_hint() != Gdk.WindowTypeHint.NOTIFICATION)
15+ if (win != null)
16 {
17- win.focus (Gdk.CURRENT_TIME);
18-
19- /* Make sure to keep keyboard above */
20+ /* Check to see if this window is our onboard window, since we don't want to focus it. */
21+ X.Window keyboard_xid = 0;
22 if (main_window.menubar.keyboard_window != null)
23- main_window.menubar.keyboard_window.get_window ().raise ();
24+ keyboard_xid = Gdk.X11Window.get_xid (main_window.menubar.keyboard_window.get_window ());
25+
26+ if (xwin != keyboard_xid && win.get_type_hint() != Gdk.WindowTypeHint.NOTIFICATION)
27+ {
28+ win.focus (Gdk.CURRENT_TIME);
29+
30+ /* Make sure to keep keyboard above */
31+ if (main_window.menubar.keyboard_window != null)
32+ main_window.menubar.keyboard_window.get_window ().raise ();
33+ }
34 }
35 }
36 else if (xevent.type == X.EventType.UnmapNotify)

Subscribers

People subscribed via source and target branches