Merge lp:~brandontschaefer/unity/mouse-click-outside-dash-closing-fix into lp:unity

Proposed by Brandon Schaefer
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 2826
Proposed branch: lp:~brandontschaefer/unity/mouse-click-outside-dash-closing-fix
Merge into: lp:unity
Diff against target: 120 lines (+60/-7)
4 files modified
manual-tests/Dash.txt (+19/-0)
plugins/unityshell/src/unityshell.cpp (+14/-7)
unity-shared/PluginAdapter.cpp (+25/-0)
unity-shared/PluginAdapter.h (+2/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/mouse-click-outside-dash-closing-fix
Reviewer Review Type Date Requested Status
jenkins (community) continuous-integration Needs Fixing
Marco Trevisan (Treviño) Approve
Review via email: mp+127845@code.launchpad.net

Commit message

On screen keyboard now work with the Dash, when it is outside the Dashs' geo.

Description of the change

=== Problem ===
When you click outside of the dashs geo it will close. If you have have an OSK and click on it, where it is outside of the dashs geo it will close the dash. (This makes OSK uses vs the dash).

=== Fix ===
Take the overlay and check if any windows are above it that are AlwaysOnTop. If there is one then check if the mouse in its geo. If the mouse click is in its geo then do not close th dash.

=== Test ===
Manual test

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Works fine, it does not cause troubles with always-on-top applications.

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ah, before of general approval, it would be nice if you'd change the calls:

nux::Geometry on_top_geo = wm->GetWindowGeometry(top_xid);
nux::Geometry dash_geo = dash_controller_->GetInputWindowGeometry();

to use nux::Geometry const& instead.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Thanks, missed that!

Revision history for this message
Unity Merger (unity-merger) wrote :
Revision history for this message
Unity Merger (unity-merger) wrote :
Revision history for this message
Unity Merger (unity-merger) wrote :
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'manual-tests/Dash.txt'
2--- manual-tests/Dash.txt 2012-09-13 10:56:42 +0000
3+++ manual-tests/Dash.txt 2012-10-10 18:12:19 +0000
4@@ -113,6 +113,25 @@
5 The screen should look the same as if you had never opened the dash.
6
7
8+Test that when an on screen keyboard is used it will not close the Dash.
9+------------------------------------------------------------------------
10+This tests shows that an on screen keyboards will not close the dash when clicking on it.
11+(see lp:1058705)
12+
13+Setup:
14+#. Open the on screen keyboard Onboard.
15+#. Move Onboard to the bottom right of the screen.
16+#. Open the Dash
17+#. Ensure the Dash is not in fullscreen mode.
18+#. Ensure that Onboard is outside of the Dash.
19+
20+Actions:
21+#. Use Onboard to type "Hello" in the Dash.
22+
23+Expected Results:
24+ The Dash should stay open, and allow use of the on screen keyboard.
25+
26+
27 Filter Results Tests
28 ========================
29 These tests show that the dash "All" button works well.
30
31=== modified file 'plugins/unityshell/src/unityshell.cpp'
32--- plugins/unityshell/src/unityshell.cpp 2012-10-10 10:14:38 +0000
33+++ plugins/unityshell/src/unityshell.cpp 2012-10-10 18:12:19 +0000
34@@ -1534,13 +1534,16 @@
35 skip_other_plugins = UnityWindow::get(w)->handleEvent(event);
36 }
37
38-
39 if (dash_controller_->IsVisible())
40 {
41 nux::Point pt(event->xbutton.x_root, event->xbutton.y_root);
42- nux::Geometry dash_geo = dash_controller_->GetInputWindowGeometry();
43-
44- if (!dash_geo.IsInside(pt) && !DoesPointIntersectUnityGeos(pt))
45+ nux::Geometry const& dash_geo = dash_controller_->GetInputWindowGeometry();
46+
47+ Window dash_xid = dash_controller_->window()->GetInputWindowId();
48+ Window top_xid = wm.GetTopWindowAbove(dash_xid);
49+ nux::Geometry const& on_top_geo = wm.GetWindowGeometry(top_xid);
50+
51+ if (!dash_geo.IsInside(pt) && !DoesPointIntersectUnityGeos(pt) && !on_top_geo.IsInside(pt))
52 {
53 dash_controller_->HideDash(false);
54 }
55@@ -1549,9 +1552,13 @@
56 if (hud_controller_->IsVisible())
57 {
58 nux::Point pt(event->xbutton.x_root, event->xbutton.y_root);
59- nux::Geometry hud_geo = hud_controller_->GetInputWindowGeometry();
60-
61- if (!hud_geo.IsInside(pt) && !DoesPointIntersectUnityGeos(pt))
62+ nux::Geometry const& hud_geo = hud_controller_->GetInputWindowGeometry();
63+
64+ Window hud_xid = hud_controller_->window()->GetInputWindowId();
65+ Window top_xid = wm.GetTopWindowAbove(hud_xid);
66+ nux::Geometry const& on_top_geo = wm.GetWindowGeometry(top_xid);
67+
68+ if (!hud_geo.IsInside(pt) && !DoesPointIntersectUnityGeos(pt) && !on_top_geo.IsInside(pt))
69 {
70 hud_controller_->HideHud(false);
71 }
72
73=== modified file 'unity-shared/PluginAdapter.cpp'
74--- unity-shared/PluginAdapter.cpp 2012-10-05 03:45:41 +0000
75+++ unity-shared/PluginAdapter.cpp 2012-10-10 18:12:19 +0000
76@@ -556,6 +556,31 @@
77 return 0;
78 }
79
80+Window PluginAdapter::GetTopWindowAbove(Window xid) const
81+{
82+ CompWindow* window;
83+ CompPoint screen_vp = m_Screen->vp();
84+
85+ auto const& windows = m_Screen->windows();
86+ for (auto it = windows.rbegin(); it != windows.rend(); ++it)
87+ {
88+ window = *it;
89+ if (window->defaultViewport() == screen_vp &&
90+ window->isViewable() && window->isMapped() &&
91+ !window->minimized() && !window->inShowDesktopMode() &&
92+ !(window->type() & CompWindowTypeDockMask) &&
93+ !(window->type() & CompWindowTypeSplashMask))
94+ {
95+ return window->id();
96+ }
97+ else if (window->id() == xid)
98+ {
99+ return 0;
100+ }
101+ }
102+ return 0;
103+}
104+
105 bool PluginAdapter::IsWindowClosable(Window window_id) const
106 {
107 CompWindow* window = m_Screen->findWindow(window_id);
108
109=== modified file 'unity-shared/PluginAdapter.h'
110--- unity-shared/PluginAdapter.h 2012-10-05 03:45:41 +0000
111+++ unity-shared/PluginAdapter.h 2012-10-10 18:12:19 +0000
112@@ -179,6 +179,8 @@
113
114 void MoveResizeWindow(Window window_id, nux::Geometry geometry);
115
116+ Window GetTopWindowAbove(Window xid) const;
117+
118 protected:
119 PluginAdapter(CompScreen* screen);
120 void AddProperties(GVariantBuilder* builder);