Merge lp:~3v1n0/unity/shortcuts-hidpi into lp:unity
- shortcuts-hidpi
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~3v1n0/unity/shortcuts-hidpi |
Merge into: | lp:unity |
Prerequisite: | lp:~3v1n0/unity/shutdown-hidpi-fixes |
Diff against target: |
595 lines (+210/-84) 7 files modified
shortcuts/ShortcutController.cpp (+1/-1) shortcuts/ShortcutView.cpp (+113/-48) shortcuts/ShortcutView.h (+9/-3) tests/test_unity_window_view.cpp (+9/-9) unity-shared/UnityWindowStyle.cpp (+65/-15) unity-shared/UnityWindowStyle.h (+6/-3) unity-shared/UnityWindowView.cpp (+7/-5) |
To merge this branch: | bzr merge lp:~3v1n0/unity/shortcuts-hidpi |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Andrea Azzarone (community) | Needs Fixing | ||
Review via email: mp+218738@code.launchpad.net |
This proposal has been superseded by a proposal from 2014-05-16.
Commit message
ShortcutView: use RawPixel's for the size values and convert them to match current scaling
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Andrea Azzarone (azzar1) wrote : | # |
Here the overlay appears different before and after the fix.
https:/
https:/
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
> Here the overlay appears different before and after the fix.
>
> https:/
> https:/
This is because both in English and many localized versions the keys
or descriptions are cut, while there's no reason to limit the
horizontal size, since most of netbooks will still be able to see it.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3807
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'shortcuts/ShortcutController.cpp' | |||
2 | --- shortcuts/ShortcutController.cpp 2014-05-16 00:33:37 +0000 | |||
3 | +++ shortcuts/ShortcutController.cpp 2014-05-16 00:33:37 +0000 | |||
4 | @@ -70,11 +70,11 @@ | |||
5 | 70 | if (!view_) | 70 | if (!view_) |
6 | 71 | return; | 71 | return; |
7 | 72 | 72 | ||
8 | 73 | model->Fill(); | ||
9 | 73 | view_->SetModel(model); | 74 | view_->SetModel(model); |
10 | 74 | 75 | ||
11 | 75 | if (Visible()) | 76 | if (Visible()) |
12 | 76 | { | 77 | { |
13 | 77 | model->Fill(); | ||
14 | 78 | auto const& offset = GetOffsetPerMonitor(view_->monitor()); | 78 | auto const& offset = GetOffsetPerMonitor(view_->monitor()); |
15 | 79 | 79 | ||
16 | 80 | if (offset.x < 0 || offset.y < 0) | 80 | if (offset.x < 0 || offset.y < 0) |
17 | 81 | 81 | ||
18 | === modified file 'shortcuts/ShortcutView.cpp' | |||
19 | --- shortcuts/ShortcutView.cpp 2013-11-16 11:44:23 +0000 | |||
20 | +++ shortcuts/ShortcutView.cpp 2014-05-16 00:33:37 +0000 | |||
21 | @@ -38,10 +38,16 @@ | |||
22 | 38 | const unsigned MAIN_TITLE_FONT_SIZE = 15; | 38 | const unsigned MAIN_TITLE_FONT_SIZE = 15; |
23 | 39 | const unsigned SECTION_NAME_FONT_SIZE = 12; | 39 | const unsigned SECTION_NAME_FONT_SIZE = 12; |
24 | 40 | const unsigned SHORTKEY_ENTRY_FONT_SIZE = 9; | 40 | const unsigned SHORTKEY_ENTRY_FONT_SIZE = 9; |
29 | 41 | const unsigned INTER_SPACE_SHORTKEY_DESCRIPTION = 10; | 41 | const RawPixel INTER_SPACE_SHORTKEY_DESCRIPTION = 10_em; |
30 | 42 | const unsigned SHORTKEY_COLUMN_WIDTH = 150; | 42 | const RawPixel SHORTKEY_COLUMN_DEFAULT_WIDTH = 150_em; |
31 | 43 | const unsigned DESCRIPTION_COLUMN_WIDTH = 265; | 43 | const RawPixel SHORTKEY_COLUMN_MAX_WIDTH = 350_em; |
32 | 44 | const unsigned LINE_SPACING = 5; | 44 | const RawPixel DESCRIPTION_COLUMN_DEFAULT_WIDTH = 265_em; |
33 | 45 | const RawPixel DESCRIPTION_COLUMN_MAX_WIDTH = 500_em; | ||
34 | 46 | const RawPixel LINE_SPACING = 3_em; | ||
35 | 47 | const RawPixel MAIN_HORIZONTAL_PADDING = 30_em; | ||
36 | 48 | const RawPixel MAIN_VERTICAL_PADDING = 18_em; | ||
37 | 49 | const RawPixel MAIN_CHILDREN_SPACE = 20_em; | ||
38 | 50 | const RawPixel COLUMNS_CHILDREN_SPACE = 30_em; | ||
39 | 45 | 51 | ||
40 | 46 | // We need this class because SetVisible doesn't work for layouts. | 52 | // We need this class because SetVisible doesn't work for layouts. |
41 | 47 | class SectionView : public nux::View | 53 | class SectionView : public nux::View |
42 | @@ -72,8 +78,8 @@ | |||
43 | 72 | : ui::UnityWindowView() | 78 | : ui::UnityWindowView() |
44 | 73 | { | 79 | { |
45 | 74 | auto main_layout = new nux::VLayout(); | 80 | auto main_layout = new nux::VLayout(); |
48 | 75 | main_layout->SetPadding(30, 18); | 81 | main_layout->SetPadding(MAIN_HORIZONTAL_PADDING.CP(scale), MAIN_VERTICAL_PADDING.CP(scale)); |
49 | 76 | main_layout->SetSpaceBetweenChildren(20); | 82 | main_layout->SetSpaceBetweenChildren(MAIN_CHILDREN_SPACE.CP(scale)); |
50 | 77 | SetLayout(main_layout); | 83 | SetLayout(main_layout); |
51 | 78 | 84 | ||
52 | 79 | std::string header = "<b>"+std::string(_("Keyboard Shortcuts"))+"</b>"; | 85 | std::string header = "<b>"+std::string(_("Keyboard Shortcuts"))+"</b>"; |
53 | @@ -81,13 +87,22 @@ | |||
54 | 81 | auto* header_view = new StaticCairoText(header, NUX_TRACKER_LOCATION); | 87 | auto* header_view = new StaticCairoText(header, NUX_TRACKER_LOCATION); |
55 | 82 | header_view->SetFont(FONT_NAME+" "+std::to_string(MAIN_TITLE_FONT_SIZE)); | 88 | header_view->SetFont(FONT_NAME+" "+std::to_string(MAIN_TITLE_FONT_SIZE)); |
56 | 83 | header_view->SetLines(-1); | 89 | header_view->SetLines(-1); |
57 | 90 | header_view->SetScale(scale); | ||
58 | 84 | main_layout->AddView(header_view, 1 , nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 91 | main_layout->AddView(header_view, 1 , nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
59 | 85 | 92 | ||
60 | 86 | main_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 93 | main_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
61 | 87 | 94 | ||
62 | 88 | columns_layout_ = new nux::HLayout(); | 95 | columns_layout_ = new nux::HLayout(); |
64 | 89 | columns_layout_->SetSpaceBetweenChildren(30); | 96 | columns_layout_->SetSpaceBetweenChildren(COLUMNS_CHILDREN_SPACE.CP(scale)); |
65 | 90 | main_layout->AddLayout(columns_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 97 | main_layout->AddLayout(columns_layout_, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
66 | 98 | |||
67 | 99 | scale.changed.connect([this, main_layout, header_view] (double scale) { | ||
68 | 100 | main_layout->SetPadding(MAIN_HORIZONTAL_PADDING.CP(scale), MAIN_VERTICAL_PADDING.CP(scale)); | ||
69 | 101 | main_layout->SetSpaceBetweenChildren(MAIN_CHILDREN_SPACE.CP(scale)); | ||
70 | 102 | columns_layout_->SetSpaceBetweenChildren(COLUMNS_CHILDREN_SPACE.CP(scale)); | ||
71 | 103 | header_view->SetScale(scale); | ||
72 | 104 | RenderColumns(); | ||
73 | 105 | }); | ||
74 | 91 | } | 106 | } |
75 | 92 | 107 | ||
76 | 93 | void View::SetModel(Model::Ptr model) | 108 | void View::SetModel(Model::Ptr model) |
77 | @@ -114,14 +129,17 @@ | |||
78 | 114 | auto* section_name_view = new StaticCairoText(name, NUX_TRACKER_LOCATION); | 129 | auto* section_name_view = new StaticCairoText(name, NUX_TRACKER_LOCATION); |
79 | 115 | section_name_view->SetFont(FONT_NAME+" "+std::to_string(SECTION_NAME_FONT_SIZE)); | 130 | section_name_view->SetFont(FONT_NAME+" "+std::to_string(SECTION_NAME_FONT_SIZE)); |
80 | 116 | section_name_view->SetLines(-1); | 131 | section_name_view->SetLines(-1); |
82 | 117 | layout->AddView(new nux::SpaceLayout(10, 10, 10, 10), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 132 | section_name_view->SetScale(scale); |
83 | 133 | const int top_space = (10_em).CP(scale); | ||
84 | 134 | const int bottom_space = (15_em).CP(scale); | ||
85 | 135 | layout->AddView(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | ||
86 | 118 | layout->AddView(section_name_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 136 | layout->AddView(section_name_view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
88 | 119 | layout->AddView(new nux::SpaceLayout(15, 15, 15, 15), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 137 | layout->AddView(new nux::SpaceLayout(bottom_space, bottom_space, bottom_space, bottom_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
89 | 120 | 138 | ||
90 | 121 | return layout; | 139 | return layout; |
91 | 122 | } | 140 | } |
92 | 123 | 141 | ||
94 | 124 | nux::View* View::CreateShortKeyEntryView(AbstractHint::Ptr const& hint) | 142 | nux::View* View::CreateShortKeyEntryView(AbstractHint::Ptr const& hint, StaticCairoText* shortkey_view, StaticCairoText* description_view) |
95 | 125 | { | 143 | { |
96 | 126 | auto* view = new SectionView(NUX_TRACKER_LOCATION); | 144 | auto* view = new SectionView(NUX_TRACKER_LOCATION); |
97 | 127 | 145 | ||
98 | @@ -131,56 +149,56 @@ | |||
99 | 131 | nux::HLayout* shortkey_layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 149 | nux::HLayout* shortkey_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
100 | 132 | nux::HLayout* description_layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 150 | nux::HLayout* description_layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
101 | 133 | 151 | ||
102 | 134 | glib::String shortkey(g_markup_escape_text(hint->shortkey().c_str(), -1)); | ||
103 | 135 | |||
104 | 136 | std::string skey = "<b>"+shortkey.Str()+"</b>"; | ||
105 | 137 | auto* shortkey_view = new StaticCairoText(skey, NUX_TRACKER_LOCATION); | ||
106 | 138 | shortkey_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); | ||
107 | 139 | shortkey_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); | ||
108 | 140 | shortkey_view->SetLines(-1); | ||
109 | 141 | shortkey_view->SetMinimumWidth(SHORTKEY_COLUMN_WIDTH); | ||
110 | 142 | shortkey_view->SetMaximumWidth(SHORTKEY_COLUMN_WIDTH); | ||
111 | 143 | |||
112 | 144 | glib::String es_desc(g_markup_escape_text(hint->description().c_str(), -1)); | ||
113 | 145 | |||
114 | 146 | auto* description_view = new StaticCairoText(es_desc.Str(), NUX_TRACKER_LOCATION); | ||
115 | 147 | description_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); | ||
116 | 148 | description_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); | ||
117 | 149 | description_view->SetLines(-1); | ||
118 | 150 | description_view->SetMinimumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
119 | 151 | description_view->SetMaximumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
120 | 152 | |||
121 | 153 | shortkey_layout->AddView(shortkey_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 152 | shortkey_layout->AddView(shortkey_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
122 | 154 | shortkey_layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 153 | shortkey_layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
123 | 155 | shortkey_layout->SetMinimumWidth(SHORTKEY_COLUMN_WIDTH); | ||
124 | 156 | shortkey_layout->SetMaximumWidth(SHORTKEY_COLUMN_WIDTH); | ||
125 | 157 | 154 | ||
126 | 158 | description_layout->AddView(description_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 155 | description_layout->AddView(description_view, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
127 | 159 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 156 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
128 | 160 | description_layout->SetMinimumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
129 | 161 | description_layout->SetMaximumWidth(DESCRIPTION_COLUMN_WIDTH); | ||
130 | 162 | 157 | ||
131 | 163 | layout->AddLayout(shortkey_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 158 | layout->AddLayout(shortkey_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
132 | 164 | layout->AddLayout(description_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); | 159 | layout->AddLayout(description_layout, 1, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT); |
134 | 165 | layout->SetSpaceBetweenChildren(INTER_SPACE_SHORTKEY_DESCRIPTION); | 160 | layout->SetSpaceBetweenChildren(INTER_SPACE_SHORTKEY_DESCRIPTION.CP(scale)); |
135 | 166 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); | 161 | description_layout->SetContentDistribution(nux::MAJOR_POSITION_START); |
136 | 167 | 162 | ||
141 | 168 | view->key_changed_conn_ = hint->shortkey.changed.connect([this, view, shortkey_view] (std::string const& new_key) { | 163 | view->key_changed_conn_ = hint->shortkey.changed.connect([this, view, shortkey_view] (std::string const& key) { |
142 | 169 | bool enabled = !new_key.empty(); | 164 | std::string escaped = glib::String(g_markup_escape_text(key.c_str(), -1)).Str(); |
143 | 170 | shortkey_view->SetText(enabled ? "<b>"+new_key+"</b>" : ""); | 165 | |
144 | 171 | view->SetVisible(enabled); | 166 | if (!escaped.empty()) |
145 | 167 | escaped = "<b>"+escaped+"</b>"; | ||
146 | 168 | |||
147 | 169 | shortkey_view->SetText(escaped); | ||
148 | 170 | shortkey_view->SetVisible(!escaped.empty()); | ||
149 | 171 | view->SetVisible(shortkey_view->IsVisible()); | ||
150 | 172 | QueueRelayout(); | 172 | QueueRelayout(); |
151 | 173 | QueueDraw(); | ||
152 | 173 | }); | 174 | }); |
153 | 174 | 175 | ||
155 | 175 | view->SetVisible(!shortkey.Str().empty()); | 176 | view->SetVisible(shortkey_view->IsVisible()); |
156 | 176 | 177 | ||
157 | 177 | return view; | 178 | return view; |
158 | 178 | } | 179 | } |
159 | 179 | 180 | ||
160 | 181 | StaticCairoText* View::CreateShortcutTextView(std::string const& text, bool bold) | ||
161 | 182 | { | ||
162 | 183 | std::string escaped = glib::String(g_markup_escape_text(text.c_str(), -1)).Str(); | ||
163 | 184 | |||
164 | 185 | if (bold && !text.empty()) | ||
165 | 186 | escaped = "<b>"+escaped+"</b>"; | ||
166 | 187 | |||
167 | 188 | auto* text_view = new StaticCairoText(escaped, NUX_TRACKER_LOCATION); | ||
168 | 189 | text_view->SetTextAlignment(StaticCairoText::AlignState::NUX_ALIGN_LEFT); | ||
169 | 190 | text_view->SetFont(FONT_NAME+" "+std::to_string(SHORTKEY_ENTRY_FONT_SIZE)); | ||
170 | 191 | text_view->SetLines(-1); | ||
171 | 192 | text_view->SetScale(scale); | ||
172 | 193 | text_view->SetVisible(!escaped.empty()); | ||
173 | 194 | |||
174 | 195 | return text_view; | ||
175 | 196 | } | ||
176 | 197 | |||
177 | 180 | nux::LinearLayout* View::CreateIntermediateLayout() | 198 | nux::LinearLayout* View::CreateIntermediateLayout() |
178 | 181 | { | 199 | { |
179 | 182 | nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); | 200 | nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION); |
181 | 183 | layout->SetSpaceBetweenChildren(LINE_SPACING); | 201 | layout->SetSpaceBetweenChildren(LINE_SPACING.CP(scale)); |
182 | 184 | 202 | ||
183 | 185 | return layout; | 203 | return layout; |
184 | 186 | } | 204 | } |
185 | @@ -195,9 +213,38 @@ | |||
186 | 195 | view_layout_->ProcessDraw(GfxContext, force_draw); | 213 | view_layout_->ProcessDraw(GfxContext, force_draw); |
187 | 196 | } | 214 | } |
188 | 197 | 215 | ||
189 | 216 | void View::PreLayoutManagement() | ||
190 | 217 | { | ||
191 | 218 | UnityWindowView::PreLayoutManagement(); | ||
192 | 219 | |||
193 | 220 | for (auto const& column : shortkeys_) | ||
194 | 221 | { | ||
195 | 222 | int min_width = SHORTKEY_COLUMN_DEFAULT_WIDTH.CP(scale); | ||
196 | 223 | |||
197 | 224 | for (auto* shortkey : column) | ||
198 | 225 | min_width = std::min(std::max(min_width, shortkey->GetTextExtents().width), shortkey->GetMaximumWidth()); | ||
199 | 226 | |||
200 | 227 | for (auto* shortkey : column) | ||
201 | 228 | shortkey->SetMinimumWidth(min_width); | ||
202 | 229 | } | ||
203 | 230 | |||
204 | 231 | for (auto const& column : descriptions_) | ||
205 | 232 | { | ||
206 | 233 | int min_width = DESCRIPTION_COLUMN_DEFAULT_WIDTH.CP(scale); | ||
207 | 234 | |||
208 | 235 | for (auto* description : column) | ||
209 | 236 | min_width = std::min(std::max(min_width, description->GetTextExtents().width), description->GetMaximumWidth()); | ||
210 | 237 | |||
211 | 238 | for (auto* description : column) | ||
212 | 239 | description->SetMinimumWidth(min_width); | ||
213 | 240 | } | ||
214 | 241 | } | ||
215 | 242 | |||
216 | 198 | void View::RenderColumns() | 243 | void View::RenderColumns() |
217 | 199 | { | 244 | { |
218 | 200 | columns_layout_->Clear(); | 245 | columns_layout_->Clear(); |
219 | 246 | shortkeys_.clear(); | ||
220 | 247 | descriptions_.clear(); | ||
221 | 201 | 248 | ||
222 | 202 | if (!model_) | 249 | if (!model_) |
223 | 203 | { | 250 | { |
224 | @@ -209,11 +256,21 @@ | |||
225 | 209 | int i = 0; | 256 | int i = 0; |
226 | 210 | int column_idx = 0; | 257 | int column_idx = 0; |
227 | 211 | auto const& columns = columns_layout_->GetChildren(); | 258 | auto const& columns = columns_layout_->GetChildren(); |
230 | 212 | 259 | auto const& categories = model_->categories(); | |
231 | 213 | for (auto const& category : model_->categories()) | 260 | const int categories_per_column = model_->categories_per_column(); |
232 | 261 | const int columns_number = categories.size() / categories_per_column + 1; | ||
233 | 262 | const int top_space = (23_em).CP(scale); | ||
234 | 263 | const int bottom_space = (20_em).CP(scale); | ||
235 | 264 | const int max_shortkeys_width = SHORTKEY_COLUMN_MAX_WIDTH.CP(scale); | ||
236 | 265 | const int max_descriptions_width = DESCRIPTION_COLUMN_MAX_WIDTH.CP(scale); | ||
237 | 266 | |||
238 | 267 | shortkeys_.resize(columns_number); | ||
239 | 268 | descriptions_.resize(columns_number); | ||
240 | 269 | |||
241 | 270 | for (auto const& category : categories) | ||
242 | 214 | { | 271 | { |
243 | 215 | // Computing column index based on current index | 272 | // Computing column index based on current index |
245 | 216 | column_idx = i/model_->categories_per_column(); | 273 | column_idx = i/categories_per_column; |
246 | 217 | 274 | ||
247 | 218 | nux::LinearLayout* section_layout = CreateSectionLayout(category); | 275 | nux::LinearLayout* section_layout = CreateSectionLayout(category); |
248 | 219 | nux::LinearLayout* intermediate_layout = CreateIntermediateLayout(); | 276 | nux::LinearLayout* intermediate_layout = CreateIntermediateLayout(); |
249 | @@ -221,19 +278,27 @@ | |||
250 | 221 | 278 | ||
251 | 222 | for (auto const& hint : model_->hints().at(category)) | 279 | for (auto const& hint : model_->hints().at(category)) |
252 | 223 | { | 280 | { |
254 | 224 | nux::View* view = CreateShortKeyEntryView(hint); | 281 | StaticCairoText* shortkey = CreateShortcutTextView(hint->shortkey(), true); |
255 | 282 | shortkey->SetMaximumWidth(max_shortkeys_width); | ||
256 | 283 | shortkeys_[column_idx].push_back(shortkey); | ||
257 | 284 | |||
258 | 285 | StaticCairoText* description = CreateShortcutTextView(hint->description(), false); | ||
259 | 286 | description->SetMaximumWidth(max_descriptions_width); | ||
260 | 287 | descriptions_[column_idx].push_back(description); | ||
261 | 288 | |||
262 | 289 | nux::View* view = CreateShortKeyEntryView(hint, shortkey, description); | ||
263 | 225 | intermediate_layout->AddView(view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); | 290 | intermediate_layout->AddView(view, 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); |
264 | 226 | } | 291 | } |
265 | 227 | 292 | ||
266 | 228 | section_layout->AddLayout(intermediate_layout, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 293 | section_layout->AddLayout(intermediate_layout, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
267 | 229 | 294 | ||
269 | 230 | if ((i + 1) % model_->categories_per_column() != 0 && category != model_->categories().back()) | 295 | if ((i + 1) % categories_per_column != 0 && category != categories.back()) |
270 | 231 | { | 296 | { |
271 | 232 | // Add a line with some padding after and before each category that is not | 297 | // Add a line with some padding after and before each category that is not |
272 | 233 | // the last of the column. | 298 | // the last of the column. |
274 | 234 | section_layout->AddView(new nux::SpaceLayout(23, 23, 23, 23), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 299 | section_layout->AddView(new nux::SpaceLayout(top_space, top_space, top_space, top_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
275 | 235 | section_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 300 | section_layout->AddView(new HSeparator(), 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
277 | 236 | section_layout->AddView(new nux::SpaceLayout(20, 20, 20, 20), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); | 301 | section_layout->AddView(new nux::SpaceLayout(bottom_space, bottom_space, bottom_space, bottom_space), 0, nux::MINOR_POSITION_START, nux::MINOR_SIZE_MATCHCONTENT); |
278 | 237 | } | 302 | } |
279 | 238 | 303 | ||
280 | 239 | nux::VLayout* column = nullptr; | 304 | nux::VLayout* column = nullptr; |
281 | @@ -251,7 +316,7 @@ | |||
282 | 251 | 316 | ||
283 | 252 | column->AddView(section_layout, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); | 317 | column->AddView(section_layout, 1, nux::MINOR_POSITION_START, nux::MINOR_SIZE_FULL); |
284 | 253 | 318 | ||
286 | 254 | i++; | 319 | ++i; |
287 | 255 | } | 320 | } |
288 | 256 | 321 | ||
289 | 257 | ComputeContentSize(); | 322 | ComputeContentSize(); |
290 | 258 | 323 | ||
291 | === modified file 'shortcuts/ShortcutView.h' | |||
292 | --- shortcuts/ShortcutView.h 2013-11-16 11:44:23 +0000 | |||
293 | +++ shortcuts/ShortcutView.h 2014-05-16 00:33:37 +0000 | |||
294 | @@ -29,6 +29,8 @@ | |||
295 | 29 | 29 | ||
296 | 30 | namespace unity | 30 | namespace unity |
297 | 31 | { | 31 | { |
298 | 32 | class StaticCairoText; | ||
299 | 33 | |||
300 | 32 | namespace shortcut | 34 | namespace shortcut |
301 | 33 | { | 35 | { |
302 | 34 | 36 | ||
303 | @@ -47,8 +49,9 @@ | |||
304 | 47 | 49 | ||
305 | 48 | protected: | 50 | protected: |
306 | 49 | // Protected methods | 51 | // Protected methods |
309 | 50 | void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip); | 52 | void DrawOverlay(nux::GraphicsEngine& GfxContext, bool force_draw, nux::Geometry const& clip) override; |
310 | 51 | nux::Geometry GetBackgroundGeometry(); | 53 | nux::Geometry GetBackgroundGeometry() override; |
311 | 54 | void PreLayoutManagement() override; | ||
312 | 52 | 55 | ||
313 | 53 | // Introspectable methods | 56 | // Introspectable methods |
314 | 54 | std::string GetName() const; | 57 | std::string GetName() const; |
315 | @@ -56,7 +59,8 @@ | |||
316 | 56 | private: | 59 | private: |
317 | 57 | // Private methods | 60 | // Private methods |
318 | 58 | nux::LinearLayout* CreateSectionLayout(std::string const& section_name); | 61 | nux::LinearLayout* CreateSectionLayout(std::string const& section_name); |
320 | 59 | nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const& hint); | 62 | nux::View* CreateShortKeyEntryView(AbstractHint::Ptr const&, StaticCairoText* shortkey, StaticCairoText* description); |
321 | 63 | StaticCairoText* CreateShortcutTextView(std::string const& text, bool bold); | ||
322 | 60 | nux::LinearLayout* CreateIntermediateLayout(); | 64 | nux::LinearLayout* CreateIntermediateLayout(); |
323 | 61 | 65 | ||
324 | 62 | void RenderColumns(); | 66 | void RenderColumns(); |
325 | @@ -64,6 +68,8 @@ | |||
326 | 64 | // Private members | 68 | // Private members |
327 | 65 | Model::Ptr model_; | 69 | Model::Ptr model_; |
328 | 66 | nux::HLayout* columns_layout_; | 70 | nux::HLayout* columns_layout_; |
329 | 71 | std::vector<std::vector<StaticCairoText*>> shortkeys_; | ||
330 | 72 | std::vector<std::vector<StaticCairoText*>> descriptions_; | ||
331 | 67 | 73 | ||
332 | 68 | friend class TestShortcutView; | 74 | friend class TestShortcutView; |
333 | 69 | }; | 75 | }; |
334 | 70 | 76 | ||
335 | === modified file 'tests/test_unity_window_view.cpp' | |||
336 | --- tests/test_unity_window_view.cpp 2014-03-21 04:40:12 +0000 | |||
337 | +++ tests/test_unity_window_view.cpp 2014-05-16 00:33:37 +0000 | |||
338 | @@ -82,10 +82,10 @@ | |||
339 | 82 | view.closable = true; | 82 | view.closable = true; |
340 | 83 | ASSERT_NE(view.close_button_, nullptr); | 83 | ASSERT_NE(view.close_button_, nullptr); |
341 | 84 | 84 | ||
343 | 85 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIcon()); | 85 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON)); |
344 | 86 | EXPECT_EQ(view.close_button_->GetParentObject(), &view); | 86 | EXPECT_EQ(view.close_button_->GetParentObject(), &view); |
345 | 87 | 87 | ||
347 | 88 | int padding = view.style()->GetCloseButtonPadding(); | 88 | int padding = view.style()->GetCloseButtonPadding(view.scale); |
348 | 89 | EXPECT_EQ(view.close_button_->GetBaseX(), padding); | 89 | EXPECT_EQ(view.close_button_->GetBaseX(), padding); |
349 | 90 | EXPECT_EQ(view.close_button_->GetBaseY(), padding); | 90 | EXPECT_EQ(view.close_button_->GetBaseY(), padding); |
350 | 91 | } | 91 | } |
351 | @@ -96,16 +96,16 @@ | |||
352 | 96 | ASSERT_NE(view.close_button_, nullptr); | 96 | ASSERT_NE(view.close_button_, nullptr); |
353 | 97 | 97 | ||
354 | 98 | view.close_button_->mouse_enter.emit(0, 0, 0, 0); | 98 | view.close_button_->mouse_enter.emit(0, 0, 0, 0); |
356 | 99 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIconHighligted()); | 99 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON_HIGHLIGHTED)); |
357 | 100 | 100 | ||
358 | 101 | view.close_button_->mouse_leave.emit(0, 0, 0, 0); | 101 | view.close_button_->mouse_leave.emit(0, 0, 0, 0); |
360 | 102 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIcon()); | 102 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON)); |
361 | 103 | 103 | ||
362 | 104 | view.close_button_->mouse_down.emit(0, 0, 0, 0); | 104 | view.close_button_->mouse_down.emit(0, 0, 0, 0); |
364 | 105 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIconPressed()); | 105 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON_PRESSED)); |
365 | 106 | 106 | ||
366 | 107 | view.close_button_->mouse_up.emit(0, 0, 0, 0); | 107 | view.close_button_->mouse_up.emit(0, 0, 0, 0); |
368 | 108 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetCloseIcon()); | 108 | EXPECT_EQ(view.close_button_->texture(), view.style()->GetTexture(view.scale, WindowTextureType::CLOSE_ICON)); |
369 | 109 | } | 109 | } |
370 | 110 | 110 | ||
371 | 111 | TEST_F(TestUnityWindowView, CloseButtonClicksRequestsClose) | 111 | TEST_F(TestUnityWindowView, CloseButtonClicksRequestsClose) |
372 | @@ -185,7 +185,7 @@ | |||
373 | 185 | view.SetLayout(layout); | 185 | view.SetLayout(layout); |
374 | 186 | view.ComputeContentSize(); | 186 | view.ComputeContentSize(); |
375 | 187 | 187 | ||
377 | 188 | int offset = view.style()->GetInternalOffset(); | 188 | int offset = view.style()->GetInternalOffset(view.scale); |
378 | 189 | EXPECT_EQ(layout->GetBaseX(), offset); | 189 | EXPECT_EQ(layout->GetBaseX(), offset); |
379 | 190 | EXPECT_EQ(layout->GetBaseY(), offset); | 190 | EXPECT_EQ(layout->GetBaseY(), offset); |
380 | 191 | } | 191 | } |
381 | @@ -199,7 +199,7 @@ | |||
382 | 199 | 199 | ||
383 | 200 | TEST_F(TestUnityWindowView, GetInternalBackground) | 200 | TEST_F(TestUnityWindowView, GetInternalBackground) |
384 | 201 | { | 201 | { |
386 | 202 | int offset = view.style()->GetInternalOffset(); | 202 | int offset = view.style()->GetInternalOffset(view.scale); |
387 | 203 | view.background_geo_.Set(g_random_int(), g_random_int(), g_random_int(), g_random_int()); | 203 | view.background_geo_.Set(g_random_int(), g_random_int(), g_random_int(), g_random_int()); |
388 | 204 | EXPECT_EQ(view.GetInternalBackground(), view.background_geo_.GetExpand(-offset, -offset)); | 204 | EXPECT_EQ(view.GetInternalBackground(), view.background_geo_.GetExpand(-offset, -offset)); |
389 | 205 | } | 205 | } |
390 | @@ -240,4 +240,4 @@ | |||
391 | 240 | } | 240 | } |
392 | 241 | 241 | ||
393 | 242 | } // ui | 242 | } // ui |
394 | 243 | } // unity | ||
395 | 244 | \ No newline at end of file | 243 | \ No newline at end of file |
396 | 244 | } // unity | ||
397 | 245 | 245 | ||
398 | === modified file 'unity-shared/UnityWindowStyle.cpp' | |||
399 | --- unity-shared/UnityWindowStyle.cpp 2014-05-16 00:33:37 +0000 | |||
400 | +++ unity-shared/UnityWindowStyle.cpp 2014-05-16 00:33:37 +0000 | |||
401 | @@ -21,9 +21,13 @@ | |||
402 | 21 | 21 | ||
403 | 22 | #include <NuxCore/Logger.h> | 22 | #include <NuxCore/Logger.h> |
404 | 23 | 23 | ||
405 | 24 | #include "UnitySettings.h" | ||
406 | 24 | #include "UnityWindowStyle.h" | 25 | #include "UnityWindowStyle.h" |
407 | 26 | #include "UScreen.h" | ||
408 | 25 | #include "config.h" | 27 | #include "config.h" |
409 | 26 | 28 | ||
410 | 29 | #include <unordered_set> | ||
411 | 30 | |||
412 | 27 | namespace unity | 31 | namespace unity |
413 | 28 | { | 32 | { |
414 | 29 | namespace ui | 33 | namespace ui |
415 | @@ -38,14 +42,31 @@ | |||
416 | 38 | const char* const DIALOG_HIGHLIGHT = PKGDATADIR"/dialog_close_highlight.png"; | 42 | const char* const DIALOG_HIGHLIGHT = PKGDATADIR"/dialog_close_highlight.png"; |
417 | 39 | const char* const DIALOG_PRESS = PKGDATADIR"/dialog_close_press.png"; | 43 | const char* const DIALOG_PRESS = PKGDATADIR"/dialog_close_press.png"; |
418 | 40 | 44 | ||
420 | 41 | double const DEFAULT_SCALE = 1.0; | 45 | |
421 | 46 | RawPixel const INTERNAL_OFFSET = 20_em; | ||
422 | 47 | RawPixel const BORDER_SIZE = 30_em; | ||
423 | 48 | RawPixel const CLOSE_PADDING = 3_em; | ||
424 | 42 | } | 49 | } |
425 | 43 | 50 | ||
426 | 44 | DECLARE_LOGGER(logger, "unity.ui.unity.window.style"); | 51 | DECLARE_LOGGER(logger, "unity.ui.unity.window.style"); |
427 | 45 | 52 | ||
428 | 53 | |||
429 | 46 | UnityWindowStyle::UnityWindowStyle() | 54 | UnityWindowStyle::UnityWindowStyle() |
430 | 47 | { | 55 | { |
432 | 48 | LoadAllTextureInScale(DEFAULT_SCALE); | 56 | unsigned monitors = UScreen::GetDefault()->GetPluggedMonitorsNumber(); |
433 | 57 | auto& settings = Settings::Instance(); | ||
434 | 58 | |||
435 | 59 | // Pre-load scale values per monitor | ||
436 | 60 | for (unsigned i = 0; i < monitors; ++i) | ||
437 | 61 | { | ||
438 | 62 | double scale = settings.Instance().em(i)->DPIScale(); | ||
439 | 63 | |||
440 | 64 | if (unity_window_textures_.find(scale) == unity_window_textures_.end()) | ||
441 | 65 | LoadAllTextureInScale(scale); | ||
442 | 66 | } | ||
443 | 67 | |||
444 | 68 | settings.Instance().dpi_changed.connect(sigc::mem_fun(this, &UnityWindowStyle::CleanUpUnusedTextures)); | ||
445 | 69 | UScreen::GetDefault()->changed.connect(sigc::mem_fun(this, &UnityWindowStyle::OnMonitorChanged)); | ||
446 | 49 | } | 70 | } |
447 | 50 | 71 | ||
448 | 51 | void UnityWindowStyle::LoadAllTextureInScale(double scale) | 72 | void UnityWindowStyle::LoadAllTextureInScale(double scale) |
449 | @@ -76,6 +97,35 @@ | |||
450 | 76 | return max_size; | 97 | return max_size; |
451 | 77 | } | 98 | } |
452 | 78 | 99 | ||
453 | 100 | void UnityWindowStyle::OnMonitorChanged(int primary, std::vector<nux::Geometry> const& monitors) | ||
454 | 101 | { | ||
455 | 102 | CleanUpUnusedTextures(); | ||
456 | 103 | } | ||
457 | 104 | |||
458 | 105 | // Get current in use scale values, if a scaled value is allocated, but | ||
459 | 106 | // not in use clean up the scaled textures in unity_window_textures | ||
460 | 107 | void UnityWindowStyle::CleanUpUnusedTextures() | ||
461 | 108 | { | ||
462 | 109 | unsigned monitors = UScreen::GetDefault()->GetPluggedMonitorsNumber(); | ||
463 | 110 | auto& settings = Settings::Instance(); | ||
464 | 111 | std::unordered_set<double> used_scales; | ||
465 | 112 | |||
466 | 113 | for (unsigned i = 0; i < monitors; ++i) | ||
467 | 114 | used_scales.insert(settings.em(i)->DPIScale()); | ||
468 | 115 | |||
469 | 116 | for (auto it = unity_window_textures_.begin(); it != unity_window_textures_.end();) | ||
470 | 117 | { | ||
471 | 118 | if (used_scales.find(it->first) == used_scales.end()) | ||
472 | 119 | { | ||
473 | 120 | it = unity_window_textures_.erase(it); | ||
474 | 121 | } | ||
475 | 122 | else | ||
476 | 123 | { | ||
477 | 124 | ++it; | ||
478 | 125 | } | ||
479 | 126 | } | ||
480 | 127 | } | ||
481 | 128 | |||
482 | 79 | UnityWindowStyle::Ptr const& UnityWindowStyle::Get() | 129 | UnityWindowStyle::Ptr const& UnityWindowStyle::Get() |
483 | 80 | { | 130 | { |
484 | 81 | // This is set only the first time; | 131 | // This is set only the first time; |
485 | @@ -83,19 +133,19 @@ | |||
486 | 83 | return instance; | 133 | return instance; |
487 | 84 | } | 134 | } |
488 | 85 | 135 | ||
502 | 86 | int UnityWindowStyle::GetBorderSize() const | 136 | int UnityWindowStyle::GetBorderSize(double scale) const |
503 | 87 | { | 137 | { |
504 | 88 | return 30; // as measured from textures | 138 | return BORDER_SIZE.CP(scale); // as measured from textures |
505 | 89 | } | 139 | } |
506 | 90 | 140 | ||
507 | 91 | int UnityWindowStyle::GetInternalOffset() const | 141 | int UnityWindowStyle::GetInternalOffset(double scale) const |
508 | 92 | { | 142 | { |
509 | 93 | return 20; | 143 | return INTERNAL_OFFSET.CP(scale); |
510 | 94 | } | 144 | } |
511 | 95 | 145 | ||
512 | 96 | int UnityWindowStyle::GetCloseButtonPadding() const | 146 | int UnityWindowStyle::GetCloseButtonPadding(double scale) const |
513 | 97 | { | 147 | { |
514 | 98 | return 3; | 148 | return CLOSE_PADDING.CP(scale); |
515 | 99 | } | 149 | } |
516 | 100 | 150 | ||
517 | 101 | UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetTexture(double scale, WindowTextureType const& type) | 151 | UnityWindowStyle::BaseTexturePtr UnityWindowStyle::GetTexture(double scale, WindowTextureType const& type) |
518 | 102 | 152 | ||
519 | === modified file 'unity-shared/UnityWindowStyle.h' | |||
520 | --- unity-shared/UnityWindowStyle.h 2014-05-16 00:33:37 +0000 | |||
521 | +++ unity-shared/UnityWindowStyle.h 2014-05-16 00:33:37 +0000 | |||
522 | @@ -52,9 +52,9 @@ | |||
523 | 52 | static UnityWindowStyle::Ptr const& Get(); | 52 | static UnityWindowStyle::Ptr const& Get(); |
524 | 53 | 53 | ||
525 | 54 | BaseTexturePtr GetTexture(double scale, WindowTextureType const& type); | 54 | BaseTexturePtr GetTexture(double scale, WindowTextureType const& type); |
529 | 55 | int GetCloseButtonPadding() const; | 55 | int GetCloseButtonPadding(double scale) const; |
530 | 56 | int GetBorderSize() const; | 56 | int GetBorderSize(double scale) const; |
531 | 57 | int GetInternalOffset() const; | 57 | int GetInternalOffset(double scale) const; |
532 | 58 | 58 | ||
533 | 59 | private: | 59 | private: |
534 | 60 | UnityWindowStyle(); | 60 | UnityWindowStyle(); |
535 | @@ -63,6 +63,9 @@ | |||
536 | 63 | void LoadAllTextureInScale(double scale); | 63 | void LoadAllTextureInScale(double scale); |
537 | 64 | nux::BaseTexture* LoadTexture(double scale, const char* const texture_name) const; | 64 | nux::BaseTexture* LoadTexture(double scale, const char* const texture_name) const; |
538 | 65 | RawPixel GetDefaultMaxTextureSize(const char* const texture_name) const; | 65 | RawPixel GetDefaultMaxTextureSize(const char* const texture_name) const; |
539 | 66 | |||
540 | 67 | void OnMonitorChanged(int primary, std::vector<nux::Geometry> const& monitors); | ||
541 | 68 | void CleanUpUnusedTextures(); | ||
542 | 66 | 69 | ||
543 | 67 | typedef std::array<BaseTexturePtr, size_t(WindowTextureType::Size)> UnityWindowTextures; | 70 | typedef std::array<BaseTexturePtr, size_t(WindowTextureType::Size)> UnityWindowTextures; |
544 | 68 | std::unordered_map<double, UnityWindowTextures> unity_window_textures_; | 71 | std::unordered_map<double, UnityWindowTextures> unity_window_textures_; |
545 | 69 | 72 | ||
546 | === modified file 'unity-shared/UnityWindowView.cpp' | |||
547 | --- unity-shared/UnityWindowView.cpp 2014-05-16 00:33:37 +0000 | |||
548 | +++ unity-shared/UnityWindowView.cpp 2014-05-16 00:33:37 +0000 | |||
549 | @@ -70,7 +70,7 @@ | |||
550 | 70 | 70 | ||
551 | 71 | if (internal_layout_) | 71 | if (internal_layout_) |
552 | 72 | { | 72 | { |
554 | 73 | int offset = RawPixel(style()->GetInternalOffset()).CP(scale); | 73 | int offset = style()->GetInternalOffset(scale); |
555 | 74 | view_layout_->SetPadding(offset, offset); | 74 | view_layout_->SetPadding(offset, offset); |
556 | 75 | } | 75 | } |
557 | 76 | } | 76 | } |
558 | @@ -138,7 +138,7 @@ | |||
559 | 138 | } | 138 | } |
560 | 139 | 139 | ||
561 | 140 | auto const& texture = style()->GetTexture(scale, WindowTextureType::CLOSE_ICON); | 140 | auto const& texture = style()->GetTexture(scale, WindowTextureType::CLOSE_ICON); |
563 | 141 | int padding = RawPixel(style()->GetCloseButtonPadding()).CP(scale); | 141 | int padding = style()->GetCloseButtonPadding(scale); |
564 | 142 | 142 | ||
565 | 143 | close_button_ = new IconTexture(texture); | 143 | close_button_ = new IconTexture(texture); |
566 | 144 | close_button_->SetBaseXY(padding, padding); | 144 | close_button_->SetBaseXY(padding, padding); |
567 | @@ -179,7 +179,7 @@ | |||
568 | 179 | { | 179 | { |
569 | 180 | if (layout && layout->IsLayout()) | 180 | if (layout && layout->IsLayout()) |
570 | 181 | { | 181 | { |
572 | 182 | int offset = RawPixel(style()->GetInternalOffset()).CP(scale); | 182 | int offset = style()->GetInternalOffset(scale); |
573 | 183 | 183 | ||
574 | 184 | // We wrap the internal layout adding some padding, so that inherited classes | 184 | // We wrap the internal layout adding some padding, so that inherited classes |
575 | 185 | // can ignore the offsets we define here. | 185 | // can ignore the offsets we define here. |
576 | @@ -204,7 +204,8 @@ | |||
577 | 204 | 204 | ||
578 | 205 | nux::Geometry UnityWindowView::GetInternalBackground() | 205 | nux::Geometry UnityWindowView::GetInternalBackground() |
579 | 206 | { | 206 | { |
581 | 207 | int offset = RawPixel(style()->GetInternalOffset()).CP(scale); | 207 | int offset = style()->GetInternalOffset(scale); |
582 | 208 | |||
583 | 208 | return GetBackgroundGeometry().GetExpand(-offset, -offset); | 209 | return GetBackgroundGeometry().GetExpand(-offset, -offset); |
584 | 209 | } | 210 | } |
585 | 210 | 211 | ||
586 | @@ -354,7 +355,8 @@ | |||
587 | 354 | 355 | ||
588 | 355 | void UnityWindowView::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo) | 356 | void UnityWindowView::DrawBackground(nux::GraphicsEngine& GfxContext, nux::Geometry const& geo) |
589 | 356 | { | 357 | { |
591 | 357 | int border = RawPixel(style()->GetBorderSize()).CP(scale); | 358 | int border = style()->GetBorderSize(scale); |
592 | 359 | |||
593 | 358 | auto background_corner_textrue = style()->GetTexture(scale, WindowTextureType::BACKGROUND_CORNER)->GetDeviceTexture(); | 360 | auto background_corner_textrue = style()->GetTexture(scale, WindowTextureType::BACKGROUND_CORNER)->GetDeviceTexture(); |
594 | 359 | 361 | ||
595 | 360 | GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | 362 | GfxContext.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
FAILED: Continuous integration, rev:3805 jenkins. qa.ubuntu. com/job/ unity-ci/ 919/ jenkins. qa.ubuntu. com/job/ unity-utopic- amd64-ci/ 6/console jenkins. qa.ubuntu. com/job/ unity-utopic- armhf-ci/ 6/console jenkins. qa.ubuntu. com/job/ unity-utopic- i386-ci/ 6/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/919/ rebuild
http://