Merge lp:~canonical-dx-team/unity/unity.fix-691114 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 747
Proposed branch: lp:~canonical-dx-team/unity/unity.fix-691114
Merge into: lp:unity
Diff against target: 93 lines (+43/-14)
2 files modified
src/Launcher.cpp (+3/-0)
src/QuicklistView.cpp (+40/-14)
To merge this branch: bzr merge lp:~canonical-dx-team/unity/unity.fix-691114
Reviewer Review Type Date Requested Status
Gord Allott Pending
Review via email: mp+45778@code.launchpad.net

Description of the change

Avoid Quicklists being positioned so that they are partially offscreen at the bottom screen-edge. Fixes LP: #691114

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

There's still a bug in the layout-calculation for the base-geometry in Nux (around BaseWindow::ShowWindow). That needs to be solved first to take advantage of this fix here.

Revision history for this message
Jay Taoko (jaytaoko) wrote :

The fix is not Nux related. We just needed to correct the Quicklist position in QuicklistView::ShowQuicklistWithTipAt the same way we do it in QuicklistView::UpdateTexture ().

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Launcher.cpp'
2--- src/Launcher.cpp 2011-01-07 16:37:51 +0000
3+++ src/Launcher.cpp 2011-01-11 01:23:10 +0000
4@@ -1475,6 +1475,9 @@
5
6 void Launcher::DrawRenderArg (nux::GraphicsEngine& GfxContext, RenderArg const &arg, nux::Geometry geo)
7 {
8+ if (arg.icon->TextureForSize (_icon_image_size) == 0)
9+ return;
10+
11 GfxContext.GetRenderStates ().SetSeparateBlend (true,
12 GL_SRC_ALPHA,
13 GL_ONE_MINUS_SRC_ALPHA,
14
15=== modified file 'src/QuicklistView.cpp'
16--- src/QuicklistView.cpp 2011-01-07 16:37:51 +0000
17+++ src/QuicklistView.cpp 2011-01-11 01:23:10 +0000
18@@ -137,21 +137,39 @@
19
20 void QuicklistView::ShowQuicklistWithTipAt (int anchor_tip_x, int anchor_tip_y)
21 {
22- int window_width;
23- int window_height;
24-
25- window_width = nux::GetWindow ().GetWindowWidth ();
26- window_height = nux::GetWindow ().GetWindowHeight ();
27-
28 _anchorX = anchor_tip_x;
29 _anchorY = anchor_tip_y;
30
31- int x = _anchorX - _padding;
32- int y = anchor_tip_y - _anchor_height/2 - _top_size - _corner_radius - _padding;
33-
34- SetBaseX (x);
35- SetBaseY (y);
36-
37+ if (!_enable_quicklist_for_testing)
38+ {
39+ if ((_item_list.size () != 0) || (_default_item_list.size () != 0))
40+ {
41+ int offscreen_size = GetBaseY () +
42+ GetBaseHeight () -
43+ nux::GetWindow().GetWindowHeight ();
44+
45+ if (offscreen_size > 0)
46+ _top_size = offscreen_size;
47+ else
48+ _top_size = 4;
49+
50+ int x = _anchorX - _padding;
51+ int y = _anchorY - _anchor_height/2 - _top_size - _corner_radius - _padding;
52+
53+ SetBaseX (x);
54+ SetBaseY (y);
55+ }
56+ else
57+ {
58+ _top_size = 0;
59+ int x = _anchorX - _padding;
60+ int y = _anchorY - _anchor_height/2 - _top_size - _corner_radius - _padding;
61+
62+ SetBaseX (x);
63+ SetBaseY (y);
64+ }
65+ }
66+
67 Show ();
68 }
69
70@@ -1271,13 +1289,21 @@
71 if (_cairo_text_has_changed == false)
72 return;
73
74- int size_above_anchor = -1; // equal to sise below
75+ int size_above_anchor = -1; // equal to size below
76
77 if (!_enable_quicklist_for_testing)
78 {
79 if ((_item_list.size () != 0) || (_default_item_list.size () != 0))
80 {
81- _top_size = 4;
82+ int offscreen_size = GetBaseY () +
83+ GetBaseHeight () -
84+ nux::GetWindow().GetWindowHeight ();
85+
86+ if (offscreen_size > 0)
87+ _top_size = offscreen_size;
88+ else
89+ _top_size = 4;
90+
91 size_above_anchor = _top_size;
92 int x = _anchorX - _padding;
93 int y = _anchorY - _anchor_height/2 - _top_size - _corner_radius - _padding;