Merge lp:~gordallott/unity/horribleworkaroundfordashinputwindow into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Didier Roche-Tolomelli
Approved revision: no longer in the source branch.
Merged at revision: 2277
Proposed branch: lp:~gordallott/unity/horribleworkaroundfordashinputwindow
Merge into: lp:unity
Diff against target: 107 lines (+35/-18)
2 files modified
plugins/unityshell/src/DashController.cpp (+19/-11)
plugins/unityshell/src/HudController.cpp (+16/-7)
To merge this branch: bzr merge lp:~gordallott/unity/horribleworkaroundfordashinputwindow
Reviewer Review Type Date Requested Status
Didier Roche-Tolomelli Approve
Review via email: mp+101716@code.launchpad.net

Commit message

creates input windows and opens/closes them on startup for the HUD and Dash

Description of the change

Fixes an issue in unity where the first time you open the dash or hud, you sometimes get input passed through to whatever window was previously focused. not the greatest fix in the world but it'll have to do for now

UNBLOCK

To post a comment you must log in.
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

It's horrible, I'm powndering rejecting it! </kidding>

Ok, thanks for the quick fix Gord. Confirmed to work and to not trigger the lens loading up at startup.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/DashController.cpp'
2--- plugins/unityshell/src/DashController.cpp 2012-04-05 02:24:31 +0000
3+++ plugins/unityshell/src/DashController.cpp 2012-04-12 11:06:26 +0000
4@@ -51,9 +51,10 @@
5 SetupRelayoutCallbacks();
6 RegisterUBusInterests();
7
8-
9 ensure_id_ = g_timeout_add_seconds(60, [] (gpointer data) -> gboolean { static_cast<Controller*>(data)->EnsureDash(); return FALSE; }, this);
10
11+ SetupWindow();
12+
13 Settings::Instance().changed.connect([&]()
14 {
15 if (window_)
16@@ -83,6 +84,12 @@
17 window_->ShowWindow(false);
18 window_->SetOpacity(0.0f);
19 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));
20+
21+ /* FIXME - first time we load our windows there is a race that causes the input window not to actually get input, this side steps that by causing an input window show and hide before we really need it. */
22+ PluginAdapter::Default()->saveInputFocus ();
23+ window_->EnableInputWindow(true, "Dash", true, false);
24+ window_->EnableInputWindow(false, "Dash", true, false);
25+ PluginAdapter::Default()->restoreInputFocus ();
26 }
27
28 void Controller::SetupDashView()
29@@ -136,17 +143,18 @@
30
31 void Controller::EnsureDash()
32 {
33- if (window_)
34- return;
35-
36 LOG_DEBUG(logger) << "Initializing Dash";
37-
38- SetupWindow();
39- SetupDashView();
40- Relayout();
41- ensure_id_ = 0;
42-
43- on_realize.emit();
44+ if (!window_)
45+ SetupWindow();
46+
47+ if (!view_)
48+ {
49+ SetupDashView();
50+ Relayout();
51+ ensure_id_ = 0;
52+
53+ on_realize.emit();
54+ }
55 }
56
57 nux::BaseWindow* Controller::window() const
58
59=== modified file 'plugins/unityshell/src/HudController.cpp'
60--- plugins/unityshell/src/HudController.cpp 2012-04-04 01:08:52 +0000
61+++ plugins/unityshell/src/HudController.cpp 2012-04-12 11:06:26 +0000
62@@ -54,6 +54,7 @@
63 , type_wait_handle_(0)
64 {
65 LOG_DEBUG(logger) << "hud startup";
66+ SetupWindow();
67 UScreen::GetDefault()->changed.connect([&] (int, std::vector<nux::Geometry>&) { Relayout(); });
68
69 ubus.RegisterInterest(UBUS_HUD_CLOSE_REQUEST, sigc::mem_fun(this, &Controller::OnExternalHideHud));
70@@ -101,6 +102,12 @@
71 window_->ShowWindow(false);
72 window_->SetOpacity(0.0f);
73 window_->mouse_down_outside_pointer_grab_area.connect(sigc::mem_fun(this, &Controller::OnMouseDownOutsideWindow));
74+
75+ /* FIXME - first time we load our windows there is a race that causes the input window not to actually get input, this side steps that by causing an input window show and hide before we really need it. */
76+ PluginAdapter::Default()->saveInputFocus ();
77+ window_->EnableInputWindow(true, "Hud", true, false);
78+ window_->EnableInputWindow(false, "Hud", true, false);
79+ PluginAdapter::Default()->restoreInputFocus ();
80 }
81
82 void Controller::SetupHudView()
83@@ -145,15 +152,17 @@
84
85 void Controller::EnsureHud()
86 {
87- if (window_)
88- return;
89-
90 LOG_DEBUG(logger) << "Initializing Hud";
91
92- SetupWindow();
93- SetupHudView();
94- Relayout();
95- ensure_id_ = 0;
96+ if (!window_)
97+ SetupWindow();
98+
99+ if (!view_)
100+ {
101+ SetupHudView();
102+ Relayout();
103+ ensure_id_ = 0;
104+ }
105 }
106
107 nux::BaseWindow* Controller::window() const