diff -Nru unity-greeter-0.2.8/debian/changelog unity-greeter-0.2.8/debian/changelog --- unity-greeter-0.2.8/debian/changelog 2012-07-26 13:57:31.000000000 +0000 +++ unity-greeter-0.2.8/debian/changelog 2012-10-01 18:34:33.000000000 +0000 @@ -1,3 +1,13 @@ +unity-greeter (0.2.8-0ubuntu1.3) precise-proposed; urgency=low + + * debian/patches/fix-focus.patch: + - Backport better keyboard focus handling from upstream as new windows + appear and disappear. This fixes keyboard navigation in dialogs + (LP: #986289) and the onboard keyboard not showing up on startup + if it was enabled before (LP: #1051946) + + -- Michael Terry Fri, 14 Sep 2012 15:47:42 -0400 + unity-greeter (0.2.8-0ubuntu1.2) precise-proposed; urgency=low * debian/patches/state-file-garbage.patch: diff -Nru unity-greeter-0.2.8/debian/patches/fix-focus.patch unity-greeter-0.2.8/debian/patches/fix-focus.patch --- unity-greeter-0.2.8/debian/patches/fix-focus.patch 1970-01-01 00:00:00.000000000 +0000 +++ unity-greeter-0.2.8/debian/patches/fix-focus.patch 2012-10-01 18:16:40.000000000 +0000 @@ -0,0 +1,107 @@ +Index: unity-greeter-0.2.8/src/unity-greeter.vala +=================================================================== +--- unity-greeter-0.2.8.orig/src/unity-greeter.vala 2012-10-01 14:15:07.014342740 -0400 ++++ unity-greeter-0.2.8/src/unity-greeter.vala 2012-10-01 14:16:34.170343662 -0400 +@@ -681,17 +681,51 @@ + } + } + +- private Gdk.FilterReturn focus_upon_map (X.Event xevent, Gdk.Event event) ++ private Gdk.FilterReturn focus_upon_map (Gdk.XEvent gxevent, Gdk.Event event) + { ++ var xevent = (X.Event*)gxevent; + if (xevent.type == X.EventType.MapNotify) + { +- var display = Gdk.Display.get_default (); +- var win = Gdk.X11Window.foreign_new_for_display (display, xevent.xmap.window); ++ var display = Gdk.x11_lookup_xdisplay (xevent.xmap.display); ++ var xwin = xevent.xmap.window; ++ var win = Gdk.X11Window.foreign_new_for_display (display, xwin); + +- if (win.get_accept_focus ()) ++ /* Check to see if this window is our onboard window, since we don't want to focus it. */ ++ X.Window keyboard_xid = 0; ++ if (main_window.menubar.keyboard_window != null) ++ keyboard_xid = Gdk.X11Window.get_xid (main_window.menubar.keyboard_window.get_window ()); ++ ++ if (xwin != keyboard_xid && win.get_type_hint() != Gdk.WindowTypeHint.NOTIFICATION) ++ { + win.focus (Gdk.CURRENT_TIME); +- else +- user_list.focus_prompt (); ++ ++ /* Make sure to keep keyboard above */ ++ if (main_window.menubar.keyboard_window != null) ++ main_window.menubar.keyboard_window.get_window ().raise (); ++ } ++ } ++ else if (xevent.type == X.EventType.UnmapNotify) ++ { ++ // Since we aren't keeping track of focus (for example, we don't ++ // track the Z stack of windows) like a normal WM would, when we ++ // decide here where to return focus after another window unmaps, ++ // we don't have much to go on. X will tell us if we should take ++ // focus back. (I could not find an obvious way to determine this, ++ // but checking if the X input focus is RevertTo.None seems ++ // reliable.) ++ ++ X.Window xwin; ++ int revert_to; ++ xevent.xunmap.display.get_input_focus (out xwin, out revert_to); ++ ++ if (revert_to == X.RevertTo.None) ++ { ++ main_window.get_window ().focus (Gdk.CURRENT_TIME); ++ ++ /* Make sure to keep keyboard above */ ++ if (main_window.menubar.keyboard_window != null) ++ main_window.menubar.keyboard_window.get_window ().raise (); ++ } + } + return Gdk.FilterReturn.CONTINUE; + } +@@ -704,7 +738,7 @@ + continuing even if not actually marked as modal) */ + var root = Gdk.get_default_root_window (); + root.set_events (root.get_events () | Gdk.EventMask.SUBSTRUCTURE_MASK); +- root.add_filter ((Gdk.FilterFunc) focus_upon_map); ++ root.add_filter (focus_upon_map); + } + + private static Cairo.XlibSurface? create_root_surface (Gdk.Screen screen) +Index: unity-greeter-0.2.8/src/main-window.vala +=================================================================== +--- unity-greeter-0.2.8.orig/src/main-window.vala 2012-09-14 15:50:14.641008600 -0400 ++++ unity-greeter-0.2.8/src/main-window.vala 2012-10-01 14:15:07.054342741 -0400 +@@ -21,10 +21,10 @@ + public class MainWindow : Gtk.Window + { + public UserList user_list; ++ public MenuBar menubar; + + private List monitors; + private Background background; +- private MenuBar menubar; + private Gtk.Box login_box; + + private uint change_background_timeout = 0; +Index: unity-greeter-0.2.8/src/menubar.vala +=================================================================== +--- unity-greeter-0.2.8.orig/src/menubar.vala 2012-09-14 15:50:14.641008600 -0400 ++++ unity-greeter-0.2.8/src/menubar.vala 2012-10-01 14:15:07.058342741 -0400 +@@ -67,6 +67,7 @@ + { + public Background? background {get; construct; default = null;} + public bool high_contrast {get; private set; default = false;} ++ public Gtk.Window? keyboard_window {get; private set; default = null;} + + public Gtk.AccelGroup? accel_group {get; construct;} + +@@ -121,7 +122,6 @@ + private Gtk.CheckMenuItem high_contrast_item; + private Gtk.Label keyboard_label = null; + private Pid keyboard_pid = 0; +- private Gtk.Window? keyboard_window = null; + + construct + { diff -Nru unity-greeter-0.2.8/debian/patches/series unity-greeter-0.2.8/debian/patches/series --- unity-greeter-0.2.8/debian/patches/series 2012-07-26 13:57:31.000000000 +0000 +++ unity-greeter-0.2.8/debian/patches/series 2012-10-01 18:33:05.000000000 +0000 @@ -3,3 +3,4 @@ show-changed-default-badge.patch fix-hung-logging-in.patch state-file-garbage.patch +fix-focus.patch