Merge lp:~brandontschaefer/unity/lp.1101310-fix-launcher-resize-dash-window-buttons into lp:unity

Proposed by Brandon Schaefer
Status: Rejected
Rejected by: Brandon Schaefer
Proposed branch: lp:~brandontschaefer/unity/lp.1101310-fix-launcher-resize-dash-window-buttons
Merge into: lp:unity
Diff against target: 156 lines (+28/-32)
4 files modified
dash/DashController.cpp (+3/-2)
dash/DashView.cpp (+8/-29)
panel/PanelView.cpp (+2/-1)
tests/autopilot/unity/tests/test_panel.py (+15/-0)
To merge this branch: bzr merge lp:~brandontschaefer/unity/lp.1101310-fix-launcher-resize-dash-window-buttons
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Needs Fixing
Review via email: mp+143975@code.launchpad.net

Commit message

The DashView was taking up the entire screen (minus the launcher). So mouse down events would get eaten by the Dash.

So now we add the panel height to the geo.y of the DashView, so it doesn't eat those events anymore.

Description of the change

=== Problem ===
The DashView was taking up the entire screen (minus the launcher). So mouse down events would get eaten by the Dash.

=== Fix ===
So now we add the panel height to the DashView, so it doesn't eat those anymore!

=== Test ===
AP Test

To post a comment you must log in.
3050. By Brandon Schaefer

* Opps, left something in...

3051. By Brandon Schaefer

* Adds an AP test, and fixes a problem with the dash in maxed mode

Revision history for this message
Andrea Azzarone (azzar1) wrote :

When a preview is shown the blurred dash icons are not drawn on the panel.

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

This is rejected because the regression (the one pointed out by andyrock) caused by this needed a new branch here:
https://code.launchpad.net/~brandontschaefer/unity/lp.1101310-fix-launcher-resize-window-buttons

Unmerged revisions

3051. By Brandon Schaefer

* Adds an AP test, and fixes a problem with the dash in maxed mode

3050. By Brandon Schaefer

* Opps, left something in...

3049. By Brandon Schaefer

* The DashView (Actual Geometry, not content) was taking up the entire screen
  (minus the launcher), so now we subtract the panel from that so the nux event
  cant reach the window button when the launcher icons are re-sized.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashController.cpp'
2--- dash/DashController.cpp 2012-12-13 14:26:56 +0000
3+++ dash/DashController.cpp 2013-01-19 02:00:29 +0000
4@@ -223,13 +223,14 @@
5 {
6 UScreen *uscreen = UScreen::GetDefault();
7 auto monitor_geo = uscreen->GetMonitorGeometry(GetIdealMonitor());
8+ panel::Style &panel_style = panel::Style::Instance();
9
10 // We want to cover as much of the screen as possible to grab any mouse events outside
11 // of our window
12 return nux::Geometry (monitor_geo.x + launcher_width,
13- monitor_geo.y,
14+ monitor_geo.y + panel_style.panel_height,
15 monitor_geo.width - launcher_width,
16- monitor_geo.height);
17+ monitor_geo.height - panel_style.panel_height);
18 }
19
20 void Controller::Relayout(bool check_monitor)
21
22=== modified file 'dash/DashView.cpp'
23--- dash/DashView.cpp 2013-01-15 21:53:55 +0000
24+++ dash/DashView.cpp 2013-01-19 02:00:29 +0000
25@@ -525,13 +525,11 @@
26 void DashView::SetupViews()
27 {
28 dash::Style& style = dash::Style::Instance();
29- panel::Style &panel_style = panel::Style::Instance();
30
31 layout_ = new nux::VLayout();
32 layout_->SetLeftAndRightPadding(style.GetVSeparatorSize(), 0);
33 layout_->SetTopAndBottomPadding(style.GetHSeparatorSize(), 0);
34 SetLayout(layout_);
35- layout_->AddLayout(new nux::SpaceLayout(0, 0, panel_style.panel_height, panel_style.panel_height), 0);
36
37 content_layout_ = new DashLayout(NUX_TRACKER_LOCATION);
38 content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding(), 0);
39@@ -623,7 +621,6 @@
40 nux::Geometry DashView::GetBestFitGeometry(nux::Geometry const& for_geo)
41 {
42 dash::Style& style = dash::Style::Instance();
43- panel::Style &panel_style = panel::Style::Instance();
44
45 int width = 0, height = 0;
46 int tile_width = style.GetTileWidth();
47@@ -648,42 +645,28 @@
48
49 // width/height shouldn't be bigger than the geo available.
50 width = std::min(width, for_geo.width); // launcher width is taken into account in for_geo.
51- height = std::min(height, for_geo.height - panel_style.panel_height); // panel height is not taken into account in for_geo.
52+ height = std::min(height, for_geo.height); // panel height is taken into account in for_geo
53
54 if (style.always_maximised)
55 {
56 width = std::max(0, for_geo.width);
57- height = std::max(0, for_geo.height - panel_style.panel_height);
58+ height = std::max(0, for_geo.height);
59 }
60- return nux::Geometry(0, panel_style.panel_height, width, height);
61+ return nux::Geometry(0, 0, width, height);
62 }
63
64 void DashView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
65 {
66- panel::Style &panel_style = panel::Style::Instance();
67-
68- nux::Geometry renderer_geo_abs(GetAbsoluteGeometry());
69- renderer_geo_abs.y += panel_style.panel_height;
70- renderer_geo_abs.height -= panel_style.panel_height;
71-
72- nux::Geometry renderer_geo(GetGeometry());
73- renderer_geo.y += panel_style.panel_height;
74- renderer_geo.height += panel_style.panel_height;
75+ nux::Geometry const& renderer_geo_abs(GetAbsoluteGeometry());
76+ nux::Geometry const& renderer_geo(GetGeometry());
77
78 renderer_.DrawFull(graphics_engine, content_geo_, renderer_geo_abs, renderer_geo, true);
79 }
80
81 void DashView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw)
82 {
83- panel::Style& panel_style = panel::Style::Instance();
84-
85- nux::Geometry renderer_geo_abs(GetAbsoluteGeometry());
86- renderer_geo_abs.y += panel_style.panel_height;
87- renderer_geo_abs.height -= panel_style.panel_height;
88-
89- nux::Geometry renderer_geo(GetGeometry());
90- renderer_geo.y += panel_style.panel_height;
91- renderer_geo.height += panel_style.panel_height;
92+ nux::Geometry const& renderer_geo_abs(GetAbsoluteGeometry());
93+ nux::Geometry const& renderer_geo(GetGeometry());
94
95 renderer_.DrawInner(graphics_engine, content_geo_, renderer_geo_abs, renderer_geo);
96
97@@ -1089,11 +1072,6 @@
98 geo.width += style.GetDashRightTileWidth();
99 geo.height += style.GetDashBottomTileHeight();
100 }
101-
102- if (!geo.IsPointInside(x, y))
103- {
104- ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
105- }
106 }
107
108 void DashView::OnActivateRequest(GVariant* args)
109@@ -1518,6 +1496,7 @@
110 wrapper.add("right-border-width", style.GetDashRightTileWidth());
111 wrapper.add("bottom-border-height", style.GetDashBottomTileHeight());
112 wrapper.add("preview_displaying", preview_displaying_);
113+ wrapper.add("dash_maximized", style.always_maximised());
114 }
115
116 nux::Area* DashView::KeyNavIteration(nux::KeyNavDirection direction)
117
118=== modified file 'panel/PanelView.cpp'
119--- panel/PanelView.cpp 2012-12-17 19:35:34 +0000
120+++ panel/PanelView.cpp 2013-01-19 02:00:29 +0000
121@@ -636,7 +636,8 @@
122 tracked_pointer_pos_ = {-1, -1};
123 }
124
125- ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
126+ if (overlay_is_open_)
127+ ubus_manager_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
128 }
129
130 void PanelView::OnEntryShowMenu(std::string const& entry_id, unsigned xid,
131
132=== modified file 'tests/autopilot/unity/tests/test_panel.py'
133--- tests/autopilot/unity/tests/test_panel.py 2012-12-18 10:59:42 +0000
134+++ tests/autopilot/unity/tests/test_panel.py 2013-01-19 02:00:29 +0000
135@@ -294,6 +294,21 @@
136 self.assertThat(self.panel.window_buttons_shown, Eventually(Equals(True)))
137 self.assertWinButtonsInOverlayMode(True)
138
139+ def test_window_buttons_work_in_dash_after_launcher_resize(self):
140+ """When the launcher icons are resized, the window buttons must still work in the dash."""
141+
142+ self.set_unity_option("icon_size", 25)
143+ self.dash.ensure_visible()
144+ self.addCleanup(self.dash.ensure_hidden)
145+
146+ dash_max = self.dash.view.dash_maximized
147+ if dash_max:
148+ self.panel.window_buttons.maximize.mouse_click()
149+ else:
150+ self.panel.window_buttons.unmaximize.mouse_click()
151+
152+ self.assertThat(dash_max, NotEquals(self.dash.view.dash_maximized))
153+
154 def test_window_buttons_show_with_hud(self):
155 """Window buttons must be shown when the HUD is open."""
156 self.hud.ensure_visible()