From c6cb16c049aa810d9b87cdc9c16c8ab9c49216ce Mon Sep 17 00:00:00 2001 From: Brandon Schaefer Date: Wed, 1 Feb 2012 19:17:23 -0800 Subject: Noticed from the last fix that when a window as getting restored it would always restore to the window that was active when key nav mode first started. Now the correct window gets focus when you leave key nav mode. (bzr r1884.3.4) --- plugins/unityshell/src/LauncherController.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/unityshell/src/LauncherController.cpp b/plugins/unityshell/src/LauncherController.cpp index 488b0d386..dd9d1f868 100644 --- a/plugins/unityshell/src/LauncherController.cpp +++ b/plugins/unityshell/src/LauncherController.cpp @@ -170,6 +170,7 @@ public: bool launcher_grabbed; bool reactivate_keynav; int reactivate_index; + bool keynav_restore_window_; UBusManager ubus; @@ -198,6 +199,7 @@ Controller::Impl::Impl(Display* display, Controller* parent) launcher_keynav = false; launcher_grabbed = false; reactivate_keynav = false; + keynav_restore_window_ = true; int i = 0; for (auto monitor : monitors) @@ -288,8 +290,9 @@ void Controller::Impl::OnWindowFocusChanged (guint32 xid) if (keynav_first_focus) { - parent_->KeyNavTerminate(false); keynav_first_focus = false; + keynav_restore_window_ = false; + parent_->KeyNavTerminate(false); } else if (launcher_keynav) { @@ -1033,6 +1036,7 @@ void Controller::KeyNavActivate() pimpl->reactivate_keynav = false; pimpl->launcher_keynav = true; + pimpl->keynav_restore_window_ = true; pimpl->keyboard_launcher_ = pimpl->launchers[pimpl->MonitorWithMouse()]; pimpl->keyboard_launcher_->ShowShortcuts(false); @@ -1040,7 +1044,6 @@ void Controller::KeyNavActivate() pimpl->model_->SetSelection(0); pimpl->ubus.SendMessage(UBUS_LAUNCHER_START_KEY_SWTICHER, g_variant_new_boolean(true)); - pimpl->ubus.SendMessage(UBUS_LAUNCHER_START_KEY_NAV, NULL); } @@ -1076,8 +1079,7 @@ void Controller::KeyNavTerminate(bool activate) pimpl->keyboard_launcher_.Release(); pimpl->ubus.SendMessage(UBUS_LAUNCHER_END_KEY_SWTICHER, g_variant_new_boolean(true)); - - pimpl->ubus.SendMessage(UBUS_LAUNCHER_END_KEY_NAV, g_variant_new_boolean(true)); + pimpl->ubus.SendMessage(UBUS_LAUNCHER_END_KEY_NAV, g_variant_new_boolean(pimpl->keynav_restore_window_)); } bool Controller::KeyNavIsActive() const -- cgit v1.2.3