Merge lp:~brandontschaefer/unity/panel-height-dynamic-dpi-over-decorations-branch into lp:unity
- panel-height-dynamic-dpi-over-decorations-branch
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3670 |
Proposed branch: | lp:~brandontschaefer/unity/panel-height-dynamic-dpi-over-decorations-branch |
Merge into: | lp:unity |
Prerequisite: | lp:~3v1n0/unity/unity-decorations |
Diff against target: |
1708 lines (+401/-128) 44 files modified
dash/DashController.cpp (+1/-1) dash/DashView.cpp (+17/-12) hud/HudController.cpp (+6/-4) launcher/Launcher.cpp (+5/-3) launcher/LauncherController.cpp (+17/-0) panel/PanelController.cpp (+15/-2) panel/PanelController.h (+1/-0) panel/PanelIndicatorEntryDropdownView.cpp (+1/-1) panel/PanelIndicatorEntryView.cpp (+73/-14) panel/PanelIndicatorEntryView.h (+16/-3) panel/PanelIndicatorsView.cpp (+23/-11) panel/PanelIndicatorsView.h (+4/-0) panel/PanelMenuView.cpp (+16/-10) panel/PanelMenuView.h (+3/-2) panel/PanelTray.cpp (+6/-4) panel/PanelTray.h (+3/-1) panel/PanelView.cpp (+17/-3) panel/PanelView.h (+2/-0) panel/StandalonePanel.cpp (+1/-1) plugins/unityshell/src/unityshell.cpp (+9/-4) tests/test_em_converter.cpp (+1/-1) tests/test_launcher_controller.cpp (+6/-6) tests/test_panel_controller.cpp (+3/-3) tests/test_panel_indicator_entry_dropdown_view.cpp (+2/-2) tests/test_panel_menu_view.cpp (+1/-1) tests/test_panel_style.cpp (+12/-0) tests/test_raw_pixel.cpp (+3/-3) unity-shared/EMConverter.cpp (+1/-1) unity-shared/EMConverter.h (+5/-1) unity-shared/OverlayWindowButtons.cpp (+1/-1) unity-shared/PanelStyle.cpp (+20/-13) unity-shared/PanelStyle.h (+11/-3) unity-shared/PluginAdapter.cpp (+15/-0) unity-shared/PluginAdapter.h (+1/-0) unity-shared/RawPixel.cpp (+2/-2) unity-shared/RawPixel.h (+1/-1) unity-shared/StandaloneWindowManager.cpp (+6/-0) unity-shared/StandaloneWindowManager.h (+1/-0) unity-shared/UnitySettings.cpp (+23/-8) unity-shared/UnitySettings.h (+2/-1) unity-shared/WindowButtonPriv.h (+11/-1) unity-shared/WindowButtons.cpp (+34/-4) unity-shared/WindowButtons.h (+2/-0) unity-shared/WindowManager.h (+1/-0) |
To merge this branch: | bzr merge lp:~brandontschaefer/unity/panel-height-dynamic-dpi-over-decorations-branch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Marco Trevisan (Treviño) | Needs Fixing | ||
Eleni Maria Stea (community) | Approve | ||
Review via email: mp+202960@code.launchpad.net |
Commit message
Remove the nux::Property panel_height; Replace it with a function.
Now PanelStyle holds up to monitors::MAX panel_height. Now to get the panel height for the monitor you just use PanelHeight(int monitor).
Added a signal panel_height_
Description of the change
Remove the nux::Property panel_height; Replace it with a function.
Now PanelStyle holds up to monitors::MAX panel_height. Now to get the panel height for the monitor you just use PanelHeight(int monitor).
Added a signal panel_height_
** NOTE **
Not all the PanelHeights() take into account the monitor. Things will need to be refactored to get the correct monitor. For now, I did all the easy ones I found and will go back and slowly get them all into place. Some will not be easy.
Taken from these 2 branches:
https:/
https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3904
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3905
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3907
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3908
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3909
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Eleni Maria Stea (hikiko) wrote : | # |
Nice job! Just a small suggestion: in some files where you need the height or other sizes too many times you could use a variable to store it to avoid too many calls for the same value in one file (for example you could store panel_style.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3910
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3911
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3912
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3913
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3914
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
813 + WindowManager& wm = WindowManager:
It doesn't change much, but why defining it at this level, instead that when you actually use it?
206 + panels_
230 + panel_ptr-
This won't probably happen since the children of the panel will request to be bigger, but why not setting the MinimumWidth as well to the same value?
In this way we ensure it will scale both up and down.
Anyuway the first call is quite useless since the same it will done inside PanelView:
As for PanelIndicatorE
610 + unity::
Get rid of this lambda from PanelMenuView and PanelTray at least... Or you use a connection:
Anyway consider the case where you can just do this once in PanelView (or even in PanelController) applying then this down to its children.
WindowButtons: see if you can share the same cv_ instead of passing down the same monitor for every children (probably something to be done in other places as well), but we leave it for the next steps.
805 + int panel_height = panel_style_
806 auto const& texture = panel_style_
807 graphics_
In theory here you only to paint each time for every outputdevice, with different size. But if you can't fix it now, please tag it with a FIXME for later (not that I like it, but at least we can track it :P).
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3915
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3917
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3918
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3920
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:3922
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:3923
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'dash/DashController.cpp' | |||
2 | --- dash/DashController.cpp 2013-11-21 19:38:45 +0000 | |||
3 | +++ dash/DashController.cpp 2014-02-19 01:47:39 +0000 | |||
4 | @@ -250,7 +250,7 @@ | |||
5 | 250 | view_->Relayout(); | 250 | view_->Relayout(); |
6 | 251 | window_->SetGeometry(geo); | 251 | window_->SetGeometry(geo); |
7 | 252 | panel::Style &panel_style = panel::Style::Instance(); | 252 | panel::Style &panel_style = panel::Style::Instance(); |
9 | 253 | view_->SetMonitorOffset(launcher_width, panel_style.panel_height); | 253 | view_->SetMonitorOffset(launcher_width, panel_style.PanelHeight(monitor_)); |
10 | 254 | } | 254 | } |
11 | 255 | 255 | ||
12 | 256 | void Controller::OnMouseDownOutsideWindow(int x, int y, | 256 | void Controller::OnMouseDownOutsideWindow(int x, int y, |
13 | 257 | 257 | ||
14 | === modified file 'dash/DashView.cpp' | |||
15 | --- dash/DashView.cpp 2014-02-10 15:31:44 +0000 | |||
16 | +++ dash/DashView.cpp 2014-02-19 01:47:39 +0000 | |||
17 | @@ -519,12 +519,13 @@ | |||
18 | 519 | { | 519 | { |
19 | 520 | dash::Style& style = dash::Style::Instance(); | 520 | dash::Style& style = dash::Style::Instance(); |
20 | 521 | panel::Style &panel_style = panel::Style::Instance(); | 521 | panel::Style &panel_style = panel::Style::Instance(); |
21 | 522 | int panel_height = panel_style.PanelHeight(); | ||
22 | 522 | 523 | ||
23 | 523 | layout_ = new nux::VLayout(); | 524 | layout_ = new nux::VLayout(); |
24 | 524 | layout_->SetLeftAndRightPadding(style.GetVSeparatorSize(), 0); | 525 | layout_->SetLeftAndRightPadding(style.GetVSeparatorSize(), 0); |
25 | 525 | layout_->SetTopAndBottomPadding(style.GetHSeparatorSize(), 0); | 526 | layout_->SetTopAndBottomPadding(style.GetHSeparatorSize(), 0); |
26 | 526 | SetLayout(layout_); | 527 | SetLayout(layout_); |
28 | 527 | layout_->AddLayout(new nux::SpaceLayout(0, 0, panel_style.panel_height, panel_style.panel_height), 0); | 528 | layout_->AddLayout(new nux::SpaceLayout(0, 0, panel_height, panel_height), 0); |
29 | 528 | 529 | ||
30 | 529 | content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); | 530 | content_layout_ = new DashLayout(NUX_TRACKER_LOCATION); |
31 | 530 | content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding(), 0); | 531 | content_layout_->SetTopAndBottomPadding(style.GetDashViewTopPadding(), 0); |
32 | @@ -611,6 +612,7 @@ | |||
33 | 611 | { | 612 | { |
34 | 612 | dash::Style& style = dash::Style::Instance(); | 613 | dash::Style& style = dash::Style::Instance(); |
35 | 613 | panel::Style &panel_style = panel::Style::Instance(); | 614 | panel::Style &panel_style = panel::Style::Instance(); |
36 | 615 | int panel_height = panel_style.PanelHeight(); | ||
37 | 614 | 616 | ||
38 | 615 | int width = 0, height = 0; | 617 | int width = 0, height = 0; |
39 | 616 | int tile_width = style.GetTileWidth(); | 618 | int tile_width = style.GetTileWidth(); |
40 | @@ -635,14 +637,14 @@ | |||
41 | 635 | 637 | ||
42 | 636 | // width/height shouldn't be bigger than the geo available. | 638 | // width/height shouldn't be bigger than the geo available. |
43 | 637 | width = std::min(width, for_geo.width); // launcher width is taken into account in for_geo. | 639 | width = std::min(width, for_geo.width); // launcher width is taken into account in for_geo. |
45 | 638 | height = std::min(height, for_geo.height - panel_style.panel_height); // panel height is not taken into account in for_geo. | 640 | height = std::min(height, for_geo.height - panel_height); // panel height is not taken into account in for_geo. |
46 | 639 | 641 | ||
47 | 640 | if (style.always_maximised) | 642 | if (style.always_maximised) |
48 | 641 | { | 643 | { |
49 | 642 | width = std::max(0, for_geo.width); | 644 | width = std::max(0, for_geo.width); |
51 | 643 | height = std::max(0, for_geo.height - panel_style.panel_height); | 645 | height = std::max(0, for_geo.height - panel_height); |
52 | 644 | } | 646 | } |
54 | 645 | return nux::Geometry(0, panel_style.panel_height, width, height); | 647 | return nux::Geometry(0, panel_height, width, height); |
55 | 646 | } | 648 | } |
56 | 647 | 649 | ||
57 | 648 | void DashView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) | 650 | void DashView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) |
58 | @@ -650,9 +652,10 @@ | |||
59 | 650 | panel::Style &panel_style = panel::Style::Instance(); | 652 | panel::Style &panel_style = panel::Style::Instance(); |
60 | 651 | nux::Geometry const& renderer_geo_abs(GetRenderAbsoluteGeometry()); | 653 | nux::Geometry const& renderer_geo_abs(GetRenderAbsoluteGeometry()); |
61 | 652 | nux::Geometry renderer_geo(GetGeometry()); | 654 | nux::Geometry renderer_geo(GetGeometry()); |
62 | 655 | int panel_height = panel_style.PanelHeight(); | ||
63 | 653 | 656 | ||
66 | 654 | renderer_geo.y += panel_style.panel_height; | 657 | renderer_geo.y += panel_height; |
67 | 655 | renderer_geo.height += panel_style.panel_height; | 658 | renderer_geo.height += panel_height; |
68 | 656 | 659 | ||
69 | 657 | renderer_.DrawFull(graphics_engine, content_geo_, renderer_geo_abs, renderer_geo, false); | 660 | renderer_.DrawFull(graphics_engine, content_geo_, renderer_geo_abs, renderer_geo, false); |
70 | 658 | } | 661 | } |
71 | @@ -660,14 +663,15 @@ | |||
72 | 660 | void DashView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) | 663 | void DashView::DrawContent(nux::GraphicsEngine& graphics_engine, bool force_draw) |
73 | 661 | { | 664 | { |
74 | 662 | panel::Style& panel_style = panel::Style::Instance(); | 665 | panel::Style& panel_style = panel::Style::Instance(); |
75 | 666 | int panel_height = panel_style.PanelHeight(); | ||
76 | 663 | 667 | ||
77 | 664 | nux::Geometry renderer_geo_abs(GetAbsoluteGeometry()); | 668 | nux::Geometry renderer_geo_abs(GetAbsoluteGeometry()); |
80 | 665 | renderer_geo_abs.y += panel_style.panel_height; | 669 | renderer_geo_abs.y += panel_height; |
81 | 666 | renderer_geo_abs.height -= panel_style.panel_height; | 670 | renderer_geo_abs.height -= panel_height; |
82 | 667 | 671 | ||
83 | 668 | nux::Geometry renderer_geo(GetGeometry()); | 672 | nux::Geometry renderer_geo(GetGeometry()); |
86 | 669 | renderer_geo.y += panel_style.panel_height; | 673 | renderer_geo.y += panel_height; |
87 | 670 | renderer_geo.height += panel_style.panel_height; | 674 | renderer_geo.height += panel_height; |
88 | 671 | 675 | ||
89 | 672 | renderer_.DrawInner(graphics_engine, content_geo_, renderer_geo_abs, renderer_geo); | 676 | renderer_.DrawInner(graphics_engine, content_geo_, renderer_geo_abs, renderer_geo); |
90 | 673 | 677 | ||
91 | @@ -1689,10 +1693,11 @@ | |||
92 | 1689 | nux::Geometry DashView::GetRenderAbsoluteGeometry() const | 1693 | nux::Geometry DashView::GetRenderAbsoluteGeometry() const |
93 | 1690 | { | 1694 | { |
94 | 1691 | panel::Style &panel_style = panel::Style::Instance(); | 1695 | panel::Style &panel_style = panel::Style::Instance(); |
95 | 1696 | int panel_height = panel_style.PanelHeight(); | ||
96 | 1692 | 1697 | ||
97 | 1693 | nux::Geometry renderer_geo_abs(GetAbsoluteGeometry()); | 1698 | nux::Geometry renderer_geo_abs(GetAbsoluteGeometry()); |
100 | 1694 | renderer_geo_abs.y += panel_style.panel_height; | 1699 | renderer_geo_abs.y += panel_height; |
101 | 1695 | renderer_geo_abs.height -= panel_style.panel_height; | 1700 | renderer_geo_abs.height -= panel_height; |
102 | 1696 | return renderer_geo_abs; | 1701 | return renderer_geo_abs; |
103 | 1697 | } | 1702 | } |
104 | 1698 | 1703 | ||
105 | 1699 | 1704 | ||
106 | === modified file 'hud/HudController.cpp' | |||
107 | --- hud/HudController.cpp 2014-02-05 15:49:03 +0000 | |||
108 | +++ hud/HudController.cpp 2014-02-19 01:47:39 +0000 | |||
109 | @@ -231,13 +231,15 @@ | |||
110 | 231 | int ideal_monitor = GetIdealMonitor(); | 231 | int ideal_monitor = GetIdealMonitor(); |
111 | 232 | auto monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(ideal_monitor); | 232 | auto monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(ideal_monitor); |
112 | 233 | 233 | ||
113 | 234 | panel::Style &panel_style = panel::Style::Instance(); | ||
114 | 235 | int panel_height = panel_style.PanelHeight(ideal_monitor); | ||
115 | 236 | |||
116 | 234 | // We want to cover as much of the screen as possible to grab any mouse events | 237 | // We want to cover as much of the screen as possible to grab any mouse events |
117 | 235 | // outside of our window | 238 | // outside of our window |
118 | 236 | panel::Style &panel_style = panel::Style::Instance(); | ||
119 | 237 | nux::Geometry geo(monitor_geo.x, | 239 | nux::Geometry geo(monitor_geo.x, |
121 | 238 | monitor_geo.y + panel_style.panel_height, | 240 | monitor_geo.y + panel_height, |
122 | 239 | monitor_geo.width, | 241 | monitor_geo.width, |
124 | 240 | monitor_geo.height - panel_style.panel_height); | 242 | monitor_geo.height - panel_height); |
125 | 241 | 243 | ||
126 | 242 | if (IsLockedToLauncher(ideal_monitor)) | 244 | if (IsLockedToLauncher(ideal_monitor)) |
127 | 243 | { | 245 | { |
128 | @@ -261,7 +263,7 @@ | |||
129 | 261 | view_->QueueDraw(); | 263 | view_->QueueDraw(); |
130 | 262 | window_->SetGeometry(geo); | 264 | window_->SetGeometry(geo); |
131 | 263 | panel::Style &panel_style = panel::Style::Instance(); | 265 | panel::Style &panel_style = panel::Style::Instance(); |
133 | 264 | view_->SetMonitorOffset(launcher_width, panel_style.panel_height); | 266 | view_->SetMonitorOffset(launcher_width, panel_style.PanelHeight(monitor_index_)); |
134 | 265 | } | 267 | } |
135 | 266 | 268 | ||
136 | 267 | void Controller::OnMouseDownOutsideWindow(int x, int y, | 269 | void Controller::OnMouseDownOutsideWindow(int x, int y, |
137 | 268 | 270 | ||
138 | === modified file 'launcher/Launcher.cpp' | |||
139 | --- launcher/Launcher.cpp 2014-02-15 14:36:33 +0000 | |||
140 | +++ launcher/Launcher.cpp 2014-02-19 01:47:39 +0000 | |||
141 | @@ -1183,8 +1183,10 @@ | |||
142 | 1183 | UScreen* uscreen = UScreen::GetDefault(); | 1183 | UScreen* uscreen = UScreen::GetDefault(); |
143 | 1184 | auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); | 1184 | auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); |
144 | 1185 | unity::panel::Style &panel_style = panel::Style::Instance(); | 1185 | unity::panel::Style &panel_style = panel::Style::Instance(); |
147 | 1186 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_style.panel_height), | 1186 | int panel_height = panel_style.PanelHeight(new_monitor); |
148 | 1187 | monitor_geo.height - panel_style.panel_height); | 1187 | |
149 | 1188 | Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_height), | ||
150 | 1189 | monitor_geo.height - panel_height); | ||
151 | 1188 | icon_renderer_->monitor = new_monitor; | 1190 | icon_renderer_->monitor = new_monitor; |
152 | 1189 | } | 1191 | } |
153 | 1190 | 1192 | ||
154 | @@ -1748,7 +1750,7 @@ | |||
155 | 1748 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); | 1750 | texxform.SetTexCoordType(nux::TexCoordXForm::OFFSET_COORD); |
156 | 1749 | texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); | 1751 | texxform.SetWrap(nux::TEXWRAP_CLAMP, nux::TEXWRAP_CLAMP); |
157 | 1750 | texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()); // TODO (gord) don't use absolute values here | 1752 | texxform.uoffset = (1.0f / launcher_sheen_->GetWidth()); // TODO (gord) don't use absolute values here |
159 | 1751 | texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel::Style::Instance().panel_height; | 1753 | texxform.voffset = (1.0f / launcher_sheen_->GetHeight()) * panel::Style::Instance().PanelHeight(icon_renderer_->monitor); |
160 | 1752 | GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height, | 1754 | GfxContext.QRP_1Tex(base.x, base.y, base.width, base.height, |
161 | 1753 | launcher_sheen_->GetDeviceTexture(), | 1755 | launcher_sheen_->GetDeviceTexture(), |
162 | 1754 | texxform, | 1756 | texxform, |
163 | 1755 | 1757 | ||
164 | === modified file 'launcher/LauncherController.cpp' | |||
165 | --- launcher/LauncherController.cpp 2014-01-31 16:19:39 +0000 | |||
166 | +++ launcher/LauncherController.cpp 2014-02-19 01:47:39 +0000 | |||
167 | @@ -43,6 +43,8 @@ | |||
168 | 43 | #include "unity-shared/UScreen.h" | 43 | #include "unity-shared/UScreen.h" |
169 | 44 | #include "unity-shared/UBusMessages.h" | 44 | #include "unity-shared/UBusMessages.h" |
170 | 45 | #include "unity-shared/TimeUtil.h" | 45 | #include "unity-shared/TimeUtil.h" |
171 | 46 | #include "unity-shared/PanelStyle.h" | ||
172 | 47 | #include "unity-shared/UnitySettings.h" | ||
173 | 46 | 48 | ||
174 | 47 | namespace unity | 49 | namespace unity |
175 | 48 | { | 50 | { |
176 | @@ -169,6 +171,21 @@ | |||
177 | 169 | } | 171 | } |
178 | 170 | }); | 172 | }); |
179 | 171 | 173 | ||
180 | 174 | unity::Settings::Instance().dpi_changed.connect([this] { | ||
181 | 175 | for (auto const& launcher_ptr : launchers) | ||
182 | 176 | { | ||
183 | 177 | if (launcher_ptr) | ||
184 | 178 | { | ||
185 | 179 | nux::Geometry const& parent_geo = launcher_ptr->GetParent()->GetGeometry(); | ||
186 | 180 | int monitor = launcher_ptr->monitor(); | ||
187 | 181 | int height = panel::Style::Instance().PanelHeight(monitor); | ||
188 | 182 | int diff = height - parent_geo.y; | ||
189 | 183 | |||
190 | 184 | launcher_ptr->Resize(nux::Point(parent_geo.x, parent_geo.y + diff), parent_geo.height - diff); | ||
191 | 185 | } | ||
192 | 186 | } | ||
193 | 187 | }); | ||
194 | 188 | |||
195 | 172 | parent_->AddChild(model_.get()); | 189 | parent_->AddChild(model_.get()); |
196 | 173 | 190 | ||
197 | 174 | xdnd_manager_->dnd_started.connect(sigc::mem_fun(this, &Impl::OnDndStarted)); | 191 | xdnd_manager_->dnd_started.connect(sigc::mem_fun(this, &Impl::OnDndStarted)); |
198 | 175 | 192 | ||
199 | === modified file 'panel/PanelController.cpp' | |||
200 | --- panel/PanelController.cpp 2014-02-12 07:45:21 +0000 | |||
201 | +++ panel/PanelController.cpp 2014-02-19 01:47:39 +0000 | |||
202 | @@ -26,7 +26,6 @@ | |||
203 | 26 | 26 | ||
204 | 27 | #include "unity-shared/UScreen.h" | 27 | #include "unity-shared/UScreen.h" |
205 | 28 | #include "PanelView.h" | 28 | #include "PanelView.h" |
206 | 29 | #include "unity-shared/PanelStyle.h" | ||
207 | 30 | 29 | ||
208 | 31 | namespace unity | 30 | namespace unity |
209 | 32 | { | 31 | { |
210 | @@ -190,7 +189,6 @@ | |||
211 | 190 | nux::HLayout* layout = new nux::HLayout(NUX_TRACKER_LOCATION); | 189 | nux::HLayout* layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
212 | 191 | 190 | ||
213 | 192 | PanelView* view = new PanelView(panel_window, indicators_); | 191 | PanelView* view = new PanelView(panel_window, indicators_); |
214 | 193 | view->SetMaximumHeight(panel::Style::Instance().panel_height); | ||
215 | 194 | view->SetOpacity(opacity_); | 192 | view->SetOpacity(opacity_); |
216 | 195 | view->SetOpacityMaximizedToggle(opacity_maximized_toggle_); | 193 | view->SetOpacityMaximizedToggle(opacity_maximized_toggle_); |
217 | 196 | 194 | ||
218 | @@ -236,6 +234,8 @@ | |||
219 | 236 | screen->changed.connect(sigc::mem_fun(this, &Controller::OnScreenChanged)); | 234 | screen->changed.connect(sigc::mem_fun(this, &Controller::OnScreenChanged)); |
220 | 237 | OnScreenChanged(screen->GetPrimaryMonitor(), screen->GetMonitors()); | 235 | OnScreenChanged(screen->GetPrimaryMonitor(), screen->GetMonitors()); |
221 | 238 | 236 | ||
222 | 237 | unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &Controller::OnDPIChanged)); | ||
223 | 238 | |||
224 | 239 | launcher_width.changed.connect([this] (int width) | 239 | launcher_width.changed.connect([this] (int width) |
225 | 240 | { | 240 | { |
226 | 241 | pimpl->SetLauncherWidth(width); | 241 | pimpl->SetLauncherWidth(width); |
227 | @@ -245,6 +245,19 @@ | |||
228 | 245 | Controller::~Controller() | 245 | Controller::~Controller() |
229 | 246 | {} | 246 | {} |
230 | 247 | 247 | ||
231 | 248 | void Controller::OnDPIChanged() | ||
232 | 249 | { | ||
233 | 250 | for (auto& panel_ptr : pimpl->panels_) | ||
234 | 251 | { | ||
235 | 252 | if (panel_ptr) | ||
236 | 253 | { | ||
237 | 254 | int monitor = panel_ptr->GetMonitor(); | ||
238 | 255 | |||
239 | 256 | panel_ptr->SetMonitor(monitor); | ||
240 | 257 | } | ||
241 | 258 | } | ||
242 | 259 | } | ||
243 | 260 | |||
244 | 248 | void Controller::SetOpacity(float opacity) | 261 | void Controller::SetOpacity(float opacity) |
245 | 249 | { | 262 | { |
246 | 250 | pimpl->SetOpacity(opacity); | 263 | pimpl->SetOpacity(opacity); |
247 | 251 | 264 | ||
248 | === modified file 'panel/PanelController.h' | |||
249 | --- panel/PanelController.h 2014-02-12 07:45:21 +0000 | |||
250 | +++ panel/PanelController.h 2014-02-19 01:47:39 +0000 | |||
251 | @@ -62,6 +62,7 @@ | |||
252 | 62 | 62 | ||
253 | 63 | private: | 63 | private: |
254 | 64 | void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors); | 64 | void OnScreenChanged(int primary_monitor, std::vector<nux::Geometry>& monitors); |
255 | 65 | void OnDPIChanged(); | ||
256 | 65 | 66 | ||
257 | 66 | class Impl; | 67 | class Impl; |
258 | 67 | std::unique_ptr<Impl> pimpl; | 68 | std::unique_ptr<Impl> pimpl; |
259 | 68 | 69 | ||
260 | === modified file 'panel/PanelIndicatorEntryDropdownView.cpp' | |||
261 | --- panel/PanelIndicatorEntryDropdownView.cpp 2014-02-16 19:44:54 +0000 | |||
262 | +++ panel/PanelIndicatorEntryDropdownView.cpp 2014-02-19 01:47:39 +0000 | |||
263 | @@ -125,7 +125,7 @@ | |||
264 | 125 | entries.push_back(entry->GetEntry()); | 125 | entries.push_back(entry->GetEntry()); |
265 | 126 | 126 | ||
266 | 127 | auto const& geo = GetAbsoluteGeometry(); | 127 | auto const& geo = GetAbsoluteGeometry(); |
268 | 128 | indicators_->ShowEntriesDropdown(entries, active_entry_, 0, geo.x, geo.y + Style::Instance().panel_height); | 128 | indicators_->ShowEntriesDropdown(entries, active_entry_, 0, geo.x, geo.y + Style::Instance().PanelHeight(monitor_)); |
269 | 129 | } | 129 | } |
270 | 130 | 130 | ||
271 | 131 | bool PanelIndicatorEntryDropdownView::ActivateChild(PanelIndicatorEntryView::Ptr const& child) | 131 | bool PanelIndicatorEntryDropdownView::ActivateChild(PanelIndicatorEntryView::Ptr const& child) |
272 | 132 | 132 | ||
273 | === modified file 'panel/PanelIndicatorEntryView.cpp' | |||
274 | --- panel/PanelIndicatorEntryView.cpp 2014-02-16 19:44:54 +0000 | |||
275 | +++ panel/PanelIndicatorEntryView.cpp 2014-02-19 01:47:39 +0000 | |||
276 | @@ -30,13 +30,16 @@ | |||
277 | 30 | #include "unity-shared/CairoTexture.h" | 30 | #include "unity-shared/CairoTexture.h" |
278 | 31 | #include "unity-shared/PanelStyle.h" | 31 | #include "unity-shared/PanelStyle.h" |
279 | 32 | #include "unity-shared/WindowManager.h" | 32 | #include "unity-shared/WindowManager.h" |
280 | 33 | #include "unity-shared/UnitySettings.h" | ||
281 | 33 | 34 | ||
282 | 34 | namespace unity | 35 | namespace unity |
283 | 35 | { | 36 | { |
284 | 36 | 37 | ||
285 | 37 | namespace | 38 | namespace |
286 | 38 | { | 39 | { |
288 | 39 | const int DEFAULT_SPACING = 3; | 40 | const RawPixel DEFAULT_SPACING = 3_em; |
289 | 41 | |||
290 | 42 | const int SCALED_IMAGE_Y = 1; | ||
291 | 40 | } | 43 | } |
292 | 41 | 44 | ||
293 | 42 | using namespace indicator; | 45 | using namespace indicator; |
294 | @@ -49,6 +52,7 @@ | |||
295 | 49 | , spacing_(DEFAULT_SPACING) | 52 | , spacing_(DEFAULT_SPACING) |
296 | 50 | , left_padding_(padding < 0 ? 0 : padding) | 53 | , left_padding_(padding < 0 ? 0 : padding) |
297 | 51 | , right_padding_(left_padding_) | 54 | , right_padding_(left_padding_) |
298 | 55 | , monitor_(0) | ||
299 | 52 | , type_(type) | 56 | , type_(type) |
300 | 53 | , entry_texture_(nullptr) | 57 | , entry_texture_(nullptr) |
301 | 54 | , opacity_(1.0f) | 58 | , opacity_(1.0f) |
302 | @@ -56,6 +60,7 @@ | |||
303 | 56 | , overlay_showing_(false) | 60 | , overlay_showing_(false) |
304 | 57 | , disabled_(false) | 61 | , disabled_(false) |
305 | 58 | , focused_(true) | 62 | , focused_(true) |
306 | 63 | , cv_(unity::Settings::Instance().em(monitor_)) | ||
307 | 59 | { | 64 | { |
308 | 60 | proxy_->active_changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::OnActiveChanged)); | 65 | proxy_->active_changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::OnActiveChanged)); |
309 | 61 | proxy_->updated.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); | 66 | proxy_->updated.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); |
310 | @@ -70,6 +75,7 @@ | |||
311 | 70 | } | 75 | } |
312 | 71 | 76 | ||
313 | 72 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); | 77 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); |
314 | 78 | unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelIndicatorEntryView::Refresh)); | ||
315 | 73 | 79 | ||
316 | 74 | Refresh(); | 80 | Refresh(); |
317 | 75 | } | 81 | } |
318 | @@ -104,14 +110,13 @@ | |||
319 | 104 | }); | 110 | }); |
320 | 105 | 111 | ||
321 | 106 | wm.TerminateExpo(); | 112 | wm.TerminateExpo(); |
322 | 107 | return; | ||
323 | 108 | } | 113 | } |
324 | 109 | 114 | ||
325 | 110 | if (wm.IsScaleActive()) | 115 | if (wm.IsScaleActive()) |
326 | 111 | wm.TerminateScale(); | 116 | wm.TerminateScale(); |
327 | 112 | 117 | ||
328 | 113 | auto const& abs_geo = GetAbsoluteGeometry(); | 118 | auto const& abs_geo = GetAbsoluteGeometry(); |
330 | 114 | proxy_->ShowMenu(abs_geo.x, abs_geo.y + panel::Style::Instance().panel_height, button); | 119 | proxy_->ShowMenu(abs_geo.x, abs_geo.y + panel::Style::Instance().PanelHeight(monitor_), button); |
331 | 115 | } | 120 | } |
332 | 116 | 121 | ||
333 | 117 | void PanelIndicatorEntryView::OnMouseDown(int x, int y, long button_flags, long key_flags) | 122 | void PanelIndicatorEntryView::OnMouseDown(int x, int y, long button_flags, long key_flags) |
334 | @@ -195,7 +200,7 @@ | |||
335 | 195 | glib::Object<GdkPixbuf> pixbuf; | 200 | glib::Object<GdkPixbuf> pixbuf; |
336 | 196 | GtkIconTheme* theme = gtk_icon_theme_get_default(); | 201 | GtkIconTheme* theme = gtk_icon_theme_get_default(); |
337 | 197 | int image_type = proxy_->image_type(); | 202 | int image_type = proxy_->image_type(); |
339 | 198 | int size = (type_ != DROP_DOWN) ? 24 : 16; | 203 | RawPixel size = (type_ != DROP_DOWN) ? 24_em : 16_em; |
340 | 199 | 204 | ||
341 | 200 | if (image_type == GTK_IMAGE_PIXBUF) | 205 | if (image_type == GTK_IMAGE_PIXBUF) |
342 | 201 | { | 206 | { |
343 | @@ -214,14 +219,14 @@ | |||
344 | 214 | else if (image_type == GTK_IMAGE_STOCK || | 219 | else if (image_type == GTK_IMAGE_STOCK || |
345 | 215 | image_type == GTK_IMAGE_ICON_NAME) | 220 | image_type == GTK_IMAGE_ICON_NAME) |
346 | 216 | { | 221 | { |
348 | 217 | pixbuf = gtk_icon_theme_load_icon(theme, proxy_->image_data().c_str(), size, | 222 | pixbuf = gtk_icon_theme_load_icon(theme, proxy_->image_data().c_str(), size.CP(cv_), |
349 | 218 | (GtkIconLookupFlags)0, nullptr); | 223 | (GtkIconLookupFlags)0, nullptr); |
350 | 219 | } | 224 | } |
351 | 220 | else if (image_type == GTK_IMAGE_GICON) | 225 | else if (image_type == GTK_IMAGE_GICON) |
352 | 221 | { | 226 | { |
353 | 222 | glib::Object<GIcon> icon(g_icon_new_for_string(proxy_->image_data().c_str(), nullptr)); | 227 | glib::Object<GIcon> icon(g_icon_new_for_string(proxy_->image_data().c_str(), nullptr)); |
354 | 223 | 228 | ||
356 | 224 | gtk::IconInfo info(gtk_icon_theme_lookup_by_gicon(theme, icon, size, | 229 | gtk::IconInfo info(gtk_icon_theme_lookup_by_gicon(theme, icon, size.CP(cv_), |
357 | 225 | (GtkIconLookupFlags)0)); | 230 | (GtkIconLookupFlags)0)); |
358 | 226 | if (info) | 231 | if (info) |
359 | 227 | pixbuf = gtk_icon_info_load_icon(info, nullptr); | 232 | pixbuf = gtk_icon_info_load_icon(info, nullptr); |
360 | @@ -230,6 +235,33 @@ | |||
361 | 230 | return pixbuf; | 235 | return pixbuf; |
362 | 231 | } | 236 | } |
363 | 232 | 237 | ||
364 | 238 | int PanelIndicatorEntryView::PixbufWidth(glib::Object<GdkPixbuf> const& pixbuf) const | ||
365 | 239 | { | ||
366 | 240 | int image_type = proxy_->image_type(); | ||
367 | 241 | if (image_type == GTK_IMAGE_PIXBUF) | ||
368 | 242 | { | ||
369 | 243 | return RawPixel(gdk_pixbuf_get_width(pixbuf)).CP(cv_); | ||
370 | 244 | } | ||
371 | 245 | else | ||
372 | 246 | { | ||
373 | 247 | return gdk_pixbuf_get_width(pixbuf); | ||
374 | 248 | } | ||
375 | 249 | } | ||
376 | 250 | |||
377 | 251 | int PanelIndicatorEntryView::PixbufHeight(glib::Object<GdkPixbuf> const& pixbuf) const | ||
378 | 252 | { | ||
379 | 253 | int image_type = proxy_->image_type(); | ||
380 | 254 | if (image_type == GTK_IMAGE_PIXBUF) | ||
381 | 255 | { | ||
382 | 256 | return RawPixel(gdk_pixbuf_get_height(pixbuf)).CP(cv_); | ||
383 | 257 | } | ||
384 | 258 | else | ||
385 | 259 | { | ||
386 | 260 | return gdk_pixbuf_get_height(pixbuf); | ||
387 | 261 | } | ||
388 | 262 | |||
389 | 263 | } | ||
390 | 264 | |||
391 | 233 | void PanelIndicatorEntryView::DrawEntryPrelight(cairo_t* cr, unsigned int width, unsigned int height) | 265 | void PanelIndicatorEntryView::DrawEntryPrelight(cairo_t* cr, unsigned int width, unsigned int height) |
392 | 234 | { | 266 | { |
393 | 235 | GtkStyleContext* style_context = panel::Style::Instance().GetStyleContext(); | 267 | GtkStyleContext* style_context = panel::Style::Instance().GetStyleContext(); |
394 | @@ -254,9 +286,22 @@ | |||
395 | 254 | gtk_style_context_restore(style_context); | 286 | gtk_style_context_restore(style_context); |
396 | 255 | } | 287 | } |
397 | 256 | 288 | ||
398 | 289 | // FIXME Remove me when icons for the indicators aren't stuck as 22x22 images... | ||
399 | 290 | void PanelIndicatorEntryView::ScaleImageIcons(cairo_t* cr, int* x, int* y) | ||
400 | 291 | { | ||
401 | 292 | int image_type = proxy_->image_type(); | ||
402 | 293 | if (image_type == GTK_IMAGE_PIXBUF) | ||
403 | 294 | { | ||
404 | 295 | float aspect = cv_->DPIScale(); | ||
405 | 296 | *x = left_padding_; | ||
406 | 297 | *y = SCALED_IMAGE_Y; | ||
407 | 298 | cairo_scale(cr, aspect, aspect); | ||
408 | 299 | } | ||
409 | 300 | } | ||
410 | 301 | |||
411 | 257 | void PanelIndicatorEntryView::DrawEntryContent(cairo_t *cr, unsigned int width, unsigned int height, glib::Object<GdkPixbuf> const& pixbuf, glib::Object<PangoLayout> const& layout) | 302 | void PanelIndicatorEntryView::DrawEntryContent(cairo_t *cr, unsigned int width, unsigned int height, glib::Object<GdkPixbuf> const& pixbuf, glib::Object<PangoLayout> const& layout) |
412 | 258 | { | 303 | { |
414 | 259 | int x = left_padding_; | 304 | int x = left_padding_.CP(cv_); |
415 | 260 | 305 | ||
416 | 261 | if (IsActive()) | 306 | if (IsActive()) |
417 | 262 | DrawEntryPrelight(cr, width, height); | 307 | DrawEntryPrelight(cr, width, height); |
418 | @@ -264,7 +309,7 @@ | |||
419 | 264 | if (pixbuf && IsIconVisible()) | 309 | if (pixbuf && IsIconVisible()) |
420 | 265 | { | 310 | { |
421 | 266 | GtkStyleContext* style_context = panel::Style::Instance().GetStyleContext(); | 311 | GtkStyleContext* style_context = panel::Style::Instance().GetStyleContext(); |
423 | 267 | unsigned int icon_width = gdk_pixbuf_get_width(pixbuf); | 312 | unsigned int icon_width = PixbufWidth(pixbuf); |
424 | 268 | 313 | ||
425 | 269 | gtk_style_context_save(style_context); | 314 | gtk_style_context_save(style_context); |
426 | 270 | 315 | ||
427 | @@ -286,7 +331,8 @@ | |||
428 | 286 | gtk_style_context_set_state(style_context, GTK_STATE_FLAG_PRELIGHT); | 331 | gtk_style_context_set_state(style_context, GTK_STATE_FLAG_PRELIGHT); |
429 | 287 | } | 332 | } |
430 | 288 | 333 | ||
432 | 289 | int y = (int)((height - gdk_pixbuf_get_height(pixbuf)) / 2); | 334 | int y = (int)((height - PixbufHeight(pixbuf)) / 2); |
433 | 335 | |||
434 | 290 | if (overlay_showing_ && !IsActive()) | 336 | if (overlay_showing_ && !IsActive()) |
435 | 291 | { | 337 | { |
436 | 292 | /* Most of the images we get are straight pixbufs (annoyingly), so when | 338 | /* Most of the images we get are straight pixbufs (annoyingly), so when |
437 | @@ -295,6 +341,7 @@ | |||
438 | 295 | * icon themes/icons. | 341 | * icon themes/icons. |
439 | 296 | */ | 342 | */ |
440 | 297 | cairo_save(cr); | 343 | cairo_save(cr); |
441 | 344 | ScaleImageIcons(cr, &x, &y); | ||
442 | 298 | 345 | ||
443 | 299 | cairo_push_group(cr); | 346 | cairo_push_group(cr); |
444 | 300 | gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); | 347 | gdk_cairo_set_source_pixbuf(cr, pixbuf, x, y); |
445 | @@ -311,17 +358,22 @@ | |||
446 | 311 | } | 358 | } |
447 | 312 | else | 359 | else |
448 | 313 | { | 360 | { |
449 | 361 | cairo_save(cr); | ||
450 | 362 | ScaleImageIcons(cr, &x, &y); | ||
451 | 363 | |||
452 | 314 | cairo_push_group(cr); | 364 | cairo_push_group(cr); |
453 | 315 | gtk_render_icon(style_context, cr, pixbuf, x, y); | 365 | gtk_render_icon(style_context, cr, pixbuf, x, y); |
454 | 316 | cairo_pop_group_to_source(cr); | 366 | cairo_pop_group_to_source(cr); |
455 | 317 | cairo_paint_with_alpha(cr, (IsIconSensitive() && IsFocused()) ? 1.0 : 0.5); | 367 | cairo_paint_with_alpha(cr, (IsIconSensitive() && IsFocused()) ? 1.0 : 0.5); |
456 | 368 | |||
457 | 369 | cairo_restore(cr); | ||
458 | 318 | } | 370 | } |
459 | 319 | 371 | ||
460 | 320 | gtk_widget_path_free(widget_path); | 372 | gtk_widget_path_free(widget_path); |
461 | 321 | 373 | ||
462 | 322 | gtk_style_context_restore(style_context); | 374 | gtk_style_context_restore(style_context); |
463 | 323 | 375 | ||
465 | 324 | x += icon_width + spacing_; | 376 | x += icon_width + spacing_.CP(cv_); |
466 | 325 | } | 377 | } |
467 | 326 | 378 | ||
468 | 327 | if (layout) | 379 | if (layout) |
469 | @@ -399,12 +451,12 @@ | |||
470 | 399 | 451 | ||
471 | 400 | unsigned int width = 0; | 452 | unsigned int width = 0; |
472 | 401 | unsigned int icon_width = 0; | 453 | unsigned int icon_width = 0; |
474 | 402 | unsigned int height = panel::Style::Instance().panel_height; | 454 | unsigned int height = panel::Style::Instance().PanelHeight(monitor_); |
475 | 403 | 455 | ||
476 | 404 | // First lets figure out our size | 456 | // First lets figure out our size |
477 | 405 | if (pixbuf && IsIconVisible()) | 457 | if (pixbuf && IsIconVisible()) |
478 | 406 | { | 458 | { |
480 | 407 | width = gdk_pixbuf_get_width(pixbuf); | 459 | width = PixbufWidth(pixbuf); |
481 | 408 | icon_width = width; | 460 | icon_width = width; |
482 | 409 | } | 461 | } |
483 | 410 | 462 | ||
484 | @@ -457,14 +509,14 @@ | |||
485 | 457 | unsigned int text_width = log_rect.width / PANGO_SCALE; | 509 | unsigned int text_width = log_rect.width / PANGO_SCALE; |
486 | 458 | 510 | ||
487 | 459 | if (icon_width) | 511 | if (icon_width) |
489 | 460 | width += spacing_; | 512 | width += spacing_.CP(cv_); |
490 | 461 | width += text_width; | 513 | width += text_width; |
491 | 462 | 514 | ||
492 | 463 | pango_font_description_free(desc); | 515 | pango_font_description_free(desc); |
493 | 464 | } | 516 | } |
494 | 465 | 517 | ||
495 | 466 | if (width) | 518 | if (width) |
497 | 467 | width += left_padding_ + right_padding_; | 519 | width += left_padding_.CP(cv_) + right_padding_.CP(cv_); |
498 | 468 | 520 | ||
499 | 469 | SetMinimumWidth(width); | 521 | SetMinimumWidth(width); |
500 | 470 | SetMaximumWidth(width); | 522 | SetMaximumWidth(width); |
501 | @@ -529,6 +581,13 @@ | |||
502 | 529 | Refresh(); | 581 | Refresh(); |
503 | 530 | } | 582 | } |
504 | 531 | 583 | ||
505 | 584 | void PanelIndicatorEntryView::SetMonitor(int monitor) | ||
506 | 585 | { | ||
507 | 586 | monitor_ = monitor; | ||
508 | 587 | |||
509 | 588 | cv_ = unity::Settings::Instance().em(monitor); | ||
510 | 589 | } | ||
511 | 590 | |||
512 | 532 | void PanelIndicatorEntryView::SetOpacity(double opacity) | 591 | void PanelIndicatorEntryView::SetOpacity(double opacity) |
513 | 533 | { | 592 | { |
514 | 534 | opacity = CLAMP(opacity, 0.0f, 1.0f); | 593 | opacity = CLAMP(opacity, 0.0f, 1.0f); |
515 | 535 | 594 | ||
516 | === modified file 'panel/PanelIndicatorEntryView.h' | |||
517 | --- panel/PanelIndicatorEntryView.h 2014-02-05 10:36:28 +0000 | |||
518 | +++ panel/PanelIndicatorEntryView.h 2014-02-19 01:47:39 +0000 | |||
519 | @@ -32,7 +32,9 @@ | |||
520 | 32 | 32 | ||
521 | 33 | #include <gtk/gtk.h> | 33 | #include <gtk/gtk.h> |
522 | 34 | 34 | ||
523 | 35 | #include "unity-shared/EMConverter.h" | ||
524 | 35 | #include "unity-shared/Introspectable.h" | 36 | #include "unity-shared/Introspectable.h" |
525 | 37 | #include "unity-shared/RawPixel.h" | ||
526 | 36 | 38 | ||
527 | 37 | 39 | ||
528 | 38 | namespace unity | 40 | namespace unity |
529 | @@ -90,6 +92,8 @@ | |||
530 | 90 | void OverlayShown(); | 92 | void OverlayShown(); |
531 | 91 | void OverlayHidden(); | 93 | void OverlayHidden(); |
532 | 92 | 94 | ||
533 | 95 | virtual void SetMonitor(int monitor); | ||
534 | 96 | |||
535 | 93 | sigc::signal<void, PanelIndicatorEntryView*, bool> active_changed; | 97 | sigc::signal<void, PanelIndicatorEntryView*, bool> active_changed; |
536 | 94 | sigc::signal<void, PanelIndicatorEntryView*> refreshed; | 98 | sigc::signal<void, PanelIndicatorEntryView*> refreshed; |
537 | 95 | 99 | ||
538 | @@ -108,9 +112,11 @@ | |||
539 | 108 | virtual void ShowMenu(int button = 1); | 112 | virtual void ShowMenu(int button = 1); |
540 | 109 | 113 | ||
541 | 110 | indicator::Entry::Ptr proxy_; | 114 | indicator::Entry::Ptr proxy_; |
545 | 111 | unsigned int spacing_; | 115 | RawPixel spacing_; |
546 | 112 | unsigned int left_padding_; | 116 | RawPixel left_padding_; |
547 | 113 | unsigned int right_padding_; | 117 | RawPixel right_padding_; |
548 | 118 | |||
549 | 119 | int monitor_; | ||
550 | 114 | 120 | ||
551 | 115 | private: | 121 | private: |
552 | 116 | void OnMouseDown(int x, int y, long button_flags, long key_flags); | 122 | void OnMouseDown(int x, int y, long button_flags, long key_flags); |
553 | @@ -118,6 +124,11 @@ | |||
554 | 118 | void OnMouseWheel(int x, int y, int delta, unsigned long mouse_state, unsigned long key_state); | 124 | void OnMouseWheel(int x, int y, int delta, unsigned long mouse_state, unsigned long key_state); |
555 | 119 | void OnActiveChanged(bool is_active); | 125 | void OnActiveChanged(bool is_active); |
556 | 120 | 126 | ||
557 | 127 | int PixbufWidth(glib::Object<GdkPixbuf> const& pixbuf) const; | ||
558 | 128 | int PixbufHeight(glib::Object<GdkPixbuf> const& pixbuf) const; | ||
559 | 129 | |||
560 | 130 | void ScaleImageIcons(cairo_t* cr, int* x, int* y); | ||
561 | 131 | |||
562 | 121 | glib::Object<GdkPixbuf> MakePixbuf(); | 132 | glib::Object<GdkPixbuf> MakePixbuf(); |
563 | 122 | 133 | ||
564 | 123 | IndicatorEntryType type_; | 134 | IndicatorEntryType type_; |
565 | @@ -128,6 +139,8 @@ | |||
566 | 128 | bool overlay_showing_; | 139 | bool overlay_showing_; |
567 | 129 | bool disabled_; | 140 | bool disabled_; |
568 | 130 | bool focused_; | 141 | bool focused_; |
569 | 142 | |||
570 | 143 | EMConverter::Ptr cv_; | ||
571 | 131 | }; | 144 | }; |
572 | 132 | 145 | ||
573 | 133 | } | 146 | } |
574 | 134 | 147 | ||
575 | === modified file 'panel/PanelIndicatorsView.cpp' | |||
576 | --- panel/PanelIndicatorsView.cpp 2014-02-06 22:12:59 +0000 | |||
577 | +++ panel/PanelIndicatorsView.cpp 2014-02-19 01:47:39 +0000 | |||
578 | @@ -41,6 +41,7 @@ | |||
579 | 41 | : View(NUX_TRACKER_LOCATION) | 41 | : View(NUX_TRACKER_LOCATION) |
580 | 42 | , opacity(1.0f, sigc::mem_fun(this, &PanelIndicatorsView::SetOpacity)) | 42 | , opacity(1.0f, sigc::mem_fun(this, &PanelIndicatorsView::SetOpacity)) |
581 | 43 | , layout_(new nux::HLayout("", NUX_TRACKER_LOCATION)) | 43 | , layout_(new nux::HLayout("", NUX_TRACKER_LOCATION)) |
582 | 44 | , monitor_(0) | ||
583 | 44 | { | 45 | { |
584 | 45 | opacity.DisableNotifications(); | 46 | opacity.DisableNotifications(); |
585 | 46 | layout_->SetContentDistribution(nux::MAJOR_POSITION_END); | 47 | layout_->SetContentDistribution(nux::MAJOR_POSITION_END); |
586 | @@ -265,23 +266,27 @@ | |||
587 | 265 | if (!view) | 266 | if (!view) |
588 | 266 | return; | 267 | return; |
589 | 267 | 268 | ||
590 | 269 | auto const& entry_id = view->GetEntryID(); | ||
591 | 268 | int entry_pos = pos; | 270 | int entry_pos = pos; |
593 | 269 | auto const& entry_id = view->GetEntryID(); | 271 | bool known_entry = (entries_.find(entry_id) != entries_.end()); |
594 | 270 | view->SetOpacity(opacity()); | 272 | view->SetOpacity(opacity()); |
595 | 271 | 273 | ||
597 | 272 | if (entry_pos == IndicatorEntryPosition::AUTO) | 274 | if (!known_entry && dropdown_ && !dropdown_->Empty()) |
598 | 273 | { | 275 | { |
602 | 274 | entry_pos = nux::NUX_LAYOUT_BEGIN; | 276 | if (entry_pos == IndicatorEntryPosition::AUTO) |
600 | 275 | |||
601 | 276 | if (view->GetEntryPriority() > -1) | ||
603 | 277 | { | 277 | { |
605 | 278 | for (auto area : layout_->GetChildren()) | 278 | entry_pos = nux::NUX_LAYOUT_BEGIN; |
606 | 279 | |||
607 | 280 | if (view->GetEntryPriority() > -1) | ||
608 | 279 | { | 281 | { |
612 | 280 | auto en = static_cast<PanelIndicatorEntryView*>(area); | 282 | for (auto area : layout_->GetChildren()) |
613 | 281 | if (view->GetEntryPriority() <= en->GetEntryPriority()) | 283 | { |
614 | 282 | break; | 284 | auto en = static_cast<PanelIndicatorEntryView*>(area); |
615 | 285 | if (view->GetEntryPriority() <= en->GetEntryPriority()) | ||
616 | 286 | break; | ||
617 | 283 | 287 | ||
619 | 284 | ++entry_pos; | 288 | ++entry_pos; |
620 | 289 | } | ||
621 | 285 | } | 290 | } |
622 | 286 | } | 291 | } |
623 | 287 | } | 292 | } |
624 | @@ -292,7 +297,7 @@ | |||
625 | 292 | QueueRelayout(); | 297 | QueueRelayout(); |
626 | 293 | QueueDraw(); | 298 | QueueDraw(); |
627 | 294 | 299 | ||
629 | 295 | if (entries_.find(entry_id) == entries_.end()) | 300 | if (!known_entry) |
630 | 296 | { | 301 | { |
631 | 297 | view->refreshed.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryRefreshed)); | 302 | view->refreshed.connect(sigc::mem_fun(this, &PanelIndicatorsView::OnEntryRefreshed)); |
632 | 298 | entries_.insert({entry_id, view}); | 303 | entries_.insert({entry_id, view}); |
633 | @@ -306,6 +311,8 @@ | |||
634 | 306 | auto view = new PanelIndicatorEntryView(entry, padding, type); | 311 | auto view = new PanelIndicatorEntryView(entry, padding, type); |
635 | 307 | AddEntryView(view, pos); | 312 | AddEntryView(view, pos); |
636 | 308 | 313 | ||
637 | 314 | view->SetMonitor(monitor_); | ||
638 | 315 | |||
639 | 309 | return view; | 316 | return view; |
640 | 310 | } | 317 | } |
641 | 311 | 318 | ||
642 | @@ -357,6 +364,11 @@ | |||
643 | 357 | entry.second->OverlayHidden(); | 364 | entry.second->OverlayHidden(); |
644 | 358 | } | 365 | } |
645 | 359 | 366 | ||
646 | 367 | void PanelIndicatorsView::SetMonitor(int monitor) | ||
647 | 368 | { | ||
648 | 369 | monitor_ = monitor; | ||
649 | 370 | } | ||
650 | 371 | |||
651 | 360 | bool PanelIndicatorsView::SetOpacity(double& target, double const& new_value) | 372 | bool PanelIndicatorsView::SetOpacity(double& target, double const& new_value) |
652 | 361 | { | 373 | { |
653 | 362 | double opacity = CLAMP(new_value, 0.0f, 1.0f); | 374 | double opacity = CLAMP(new_value, 0.0f, 1.0f); |
654 | 363 | 375 | ||
655 | === modified file 'panel/PanelIndicatorsView.h' | |||
656 | --- panel/PanelIndicatorsView.h 2014-02-06 22:12:59 +0000 | |||
657 | +++ panel/PanelIndicatorsView.h 2014-02-19 01:47:39 +0000 | |||
658 | @@ -69,6 +69,8 @@ | |||
659 | 69 | 69 | ||
660 | 70 | void EnableDropdownMenu(bool, indicator::Indicators::Ptr const& i = nullptr); | 70 | void EnableDropdownMenu(bool, indicator::Indicators::Ptr const& i = nullptr); |
661 | 71 | 71 | ||
662 | 72 | virtual void SetMonitor(int monitor); | ||
663 | 73 | |||
664 | 72 | nux::Property<double> opacity; | 74 | nux::Property<double> opacity; |
665 | 73 | 75 | ||
666 | 74 | sigc::signal<void> on_indicator_updated; | 76 | sigc::signal<void> on_indicator_updated; |
667 | @@ -95,6 +97,8 @@ | |||
668 | 95 | typedef std::map<std::string, PanelIndicatorEntryView*> Entries; | 97 | typedef std::map<std::string, PanelIndicatorEntryView*> Entries; |
669 | 96 | Entries entries_; | 98 | Entries entries_; |
670 | 97 | 99 | ||
671 | 100 | int monitor_; | ||
672 | 101 | |||
673 | 98 | private: | 102 | private: |
674 | 99 | bool SetOpacity(double& target, double const& new_value); | 103 | bool SetOpacity(double& target, double const& new_value); |
675 | 100 | 104 | ||
676 | 101 | 105 | ||
677 | === modified file 'panel/PanelMenuView.cpp' | |||
678 | --- panel/PanelMenuView.cpp 2014-02-15 18:10:14 +0000 | |||
679 | +++ panel/PanelMenuView.cpp 2014-02-19 01:47:39 +0000 | |||
680 | @@ -68,7 +68,6 @@ | |||
681 | 68 | , show_now_activated_(false) | 68 | , show_now_activated_(false) |
682 | 69 | , we_control_active_(false) | 69 | , we_control_active_(false) |
683 | 70 | , new_app_menu_shown_(false) | 70 | , new_app_menu_shown_(false) |
684 | 71 | , monitor_(0) | ||
685 | 72 | , active_xid_(0) | 71 | , active_xid_(0) |
686 | 73 | , desktop_name_(_("Ubuntu Desktop")) | 72 | , desktop_name_(_("Ubuntu Desktop")) |
687 | 74 | { | 73 | { |
688 | @@ -83,13 +82,7 @@ | |||
689 | 83 | SetupWindowManagerSignals(); | 82 | SetupWindowManagerSignals(); |
690 | 84 | SetupUBusManagerInterests(); | 83 | SetupUBusManagerInterests(); |
691 | 85 | 84 | ||
699 | 86 | style_changed_connection_ = panel::Style::Instance().changed.connect([this] { | 85 | style_changed_connection_ = panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelMenuView::OnDPIChanged)); |
693 | 87 | window_buttons_->ComputeContentSize(); | ||
694 | 88 | layout_->SetLeftAndRightPadding(window_buttons_->GetContentWidth(), 0); | ||
695 | 89 | |||
696 | 90 | Refresh(true); | ||
697 | 91 | FullRedraw(); | ||
698 | 92 | }); | ||
700 | 93 | 86 | ||
701 | 94 | opacity = 0.0f; | 87 | opacity = 0.0f; |
702 | 95 | 88 | ||
703 | @@ -103,6 +96,19 @@ | |||
704 | 103 | titlebar_grab_area_->UnParentObject(); | 96 | titlebar_grab_area_->UnParentObject(); |
705 | 104 | } | 97 | } |
706 | 105 | 98 | ||
707 | 99 | void PanelMenuView::OnDPIChanged() | ||
708 | 100 | { | ||
709 | 101 | int height = panel::Style::Instance().PanelHeight(monitor_); | ||
710 | 102 | window_buttons_->SetMaximumHeight(height); | ||
711 | 103 | window_buttons_->UpdateDPIChanged(); | ||
712 | 104 | |||
713 | 105 | window_buttons_->ComputeContentSize(); | ||
714 | 106 | layout_->SetLeftAndRightPadding(window_buttons_->GetContentWidth(), 0); | ||
715 | 107 | |||
716 | 108 | Refresh(true); | ||
717 | 109 | FullRedraw(); | ||
718 | 110 | } | ||
719 | 111 | |||
720 | 106 | void PanelMenuView::SetupPanelMenuViewSignals() | 112 | void PanelMenuView::SetupPanelMenuViewSignals() |
721 | 107 | { | 113 | { |
722 | 108 | active_win_changed_signal_.Connect(matcher_, "active-window-changed", | 114 | active_win_changed_signal_.Connect(matcher_, "active-window-changed", |
723 | @@ -129,7 +135,7 @@ | |||
724 | 129 | window_buttons_->controlled_window = active_xid_; | 135 | window_buttons_->controlled_window = active_xid_; |
725 | 130 | window_buttons_->opacity = 0.0f; | 136 | window_buttons_->opacity = 0.0f; |
726 | 131 | window_buttons_->SetLeftAndRightPadding(MAIN_LEFT_PADDING, MENUBAR_PADDING); | 137 | window_buttons_->SetLeftAndRightPadding(MAIN_LEFT_PADDING, MENUBAR_PADDING); |
728 | 132 | window_buttons_->SetMaximumHeight(panel::Style::Instance().panel_height); | 138 | window_buttons_->SetMaximumHeight(panel::Style::Instance().PanelHeight(monitor_)); |
729 | 133 | window_buttons_->ComputeContentSize(); | 139 | window_buttons_->ComputeContentSize(); |
730 | 134 | 140 | ||
731 | 135 | window_buttons_->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter)); | 141 | window_buttons_->mouse_enter.connect(sigc::mem_fun(this, &PanelMenuView::OnPanelViewMouseEnter)); |
732 | @@ -145,7 +151,7 @@ | |||
733 | 145 | { | 151 | { |
734 | 146 | layout_->SetContentDistribution(nux::MAJOR_POSITION_START); | 152 | layout_->SetContentDistribution(nux::MAJOR_POSITION_START); |
735 | 147 | layout_->SetLeftAndRightPadding(window_buttons_->GetContentWidth(), 0); | 153 | layout_->SetLeftAndRightPadding(window_buttons_->GetContentWidth(), 0); |
737 | 148 | layout_->SetBaseHeight(panel::Style::Instance().panel_height); | 154 | layout_->SetBaseHeight(panel::Style::Instance().PanelHeight(monitor_)); |
738 | 149 | } | 155 | } |
739 | 150 | 156 | ||
740 | 151 | void PanelMenuView::SetupTitlebarGrabArea() | 157 | void PanelMenuView::SetupTitlebarGrabArea() |
741 | 152 | 158 | ||
742 | === modified file 'panel/PanelMenuView.h' | |||
743 | --- panel/PanelMenuView.h 2014-02-15 18:10:14 +0000 | |||
744 | +++ panel/PanelMenuView.h 2014-02-19 01:47:39 +0000 | |||
745 | @@ -45,7 +45,7 @@ | |||
746 | 45 | ~PanelMenuView(); | 45 | ~PanelMenuView(); |
747 | 46 | 46 | ||
748 | 47 | void SetMousePosition(int x, int y); | 47 | void SetMousePosition(int x, int y); |
750 | 48 | void SetMonitor(int monitor); | 48 | void SetMonitor(int monitor) override; |
751 | 49 | 49 | ||
752 | 50 | Window GetTopWindow() const; | 50 | Window GetTopWindow() const; |
753 | 51 | Window GetMaximizedWindow() const; | 51 | Window GetMaximizedWindow() const; |
754 | @@ -58,6 +58,8 @@ | |||
755 | 58 | virtual void OverlayShown(); | 58 | virtual void OverlayShown(); |
756 | 59 | virtual void OverlayHidden(); | 59 | virtual void OverlayHidden(); |
757 | 60 | 60 | ||
758 | 61 | void OnDPIChanged(); | ||
759 | 62 | |||
760 | 61 | protected: | 63 | protected: |
761 | 62 | std::string GetName() const; | 64 | std::string GetName() const; |
762 | 63 | void AddProperties(debug::IntrospectionData&); | 65 | void AddProperties(debug::IntrospectionData&); |
763 | @@ -177,7 +179,6 @@ | |||
764 | 177 | bool we_control_active_; | 179 | bool we_control_active_; |
765 | 178 | bool new_app_menu_shown_; | 180 | bool new_app_menu_shown_; |
766 | 179 | 181 | ||
767 | 180 | int monitor_; | ||
768 | 181 | Window active_xid_; | 182 | Window active_xid_; |
769 | 182 | nux::Geometry monitor_geo_; | 183 | nux::Geometry monitor_geo_; |
770 | 183 | const std::string desktop_name_; | 184 | const std::string desktop_name_; |
771 | 184 | 185 | ||
772 | === modified file 'panel/PanelTray.cpp' | |||
773 | --- panel/PanelTray.cpp 2013-09-19 16:44:03 +0000 | |||
774 | +++ panel/PanelTray.cpp 2014-02-19 01:47:39 +0000 | |||
775 | @@ -21,6 +21,7 @@ | |||
776 | 21 | 21 | ||
777 | 22 | #include "PanelTray.h" | 22 | #include "PanelTray.h" |
778 | 23 | #include "unity-shared/PanelStyle.h" | 23 | #include "unity-shared/PanelStyle.h" |
779 | 24 | #include "unity-shared/UnitySettings.h" | ||
780 | 24 | 25 | ||
781 | 25 | #include <NuxCore/Logger.h> | 26 | #include <NuxCore/Logger.h> |
782 | 26 | 27 | ||
783 | @@ -35,11 +36,12 @@ | |||
784 | 35 | namespace unity | 36 | namespace unity |
785 | 36 | { | 37 | { |
786 | 37 | 38 | ||
788 | 38 | PanelTray::PanelTray() | 39 | PanelTray::PanelTray(int monitor) |
789 | 39 | : View(NUX_TRACKER_LOCATION) | 40 | : View(NUX_TRACKER_LOCATION) |
790 | 40 | , window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)) | 41 | , window_(gtk_window_new(GTK_WINDOW_TOPLEVEL)) |
791 | 42 | , monitor_(monitor) | ||
792 | 41 | { | 43 | { |
794 | 42 | int panel_height = panel::Style::Instance().panel_height; | 44 | int panel_height = panel::Style::Instance().PanelHeight(monitor_); |
795 | 43 | 45 | ||
796 | 44 | auto gtkwindow = glib::object_cast<GtkWindow>(window_); | 46 | auto gtkwindow = glib::object_cast<GtkWindow>(window_); |
797 | 45 | gtk_window_set_type_hint(gtkwindow, GDK_WINDOW_TYPE_HINT_DOCK); | 47 | gtk_window_set_type_hint(gtkwindow, GDK_WINDOW_TYPE_HINT_DOCK); |
798 | @@ -113,7 +115,7 @@ | |||
799 | 113 | { | 115 | { |
800 | 114 | if (tray_) | 116 | if (tray_) |
801 | 115 | { | 117 | { |
803 | 116 | SetMinMaxSize(WidthOfTray() + (PADDING * 2), panel::Style::Instance().panel_height); | 118 | SetMinMaxSize(WidthOfTray() + (PADDING * 2), panel::Style::Instance().PanelHeight(monitor_)); |
804 | 117 | QueueRelayout(); | 119 | QueueRelayout(); |
805 | 118 | QueueDraw(); | 120 | QueueDraw(); |
806 | 119 | 121 | ||
807 | @@ -176,7 +178,7 @@ | |||
808 | 176 | bool PanelTray::IdleSync() | 178 | bool PanelTray::IdleSync() |
809 | 177 | { | 179 | { |
810 | 178 | int width = WidthOfTray(); | 180 | int width = WidthOfTray(); |
812 | 179 | gtk_window_resize(GTK_WINDOW(window_.RawPtr()), width, panel::Style::Instance().panel_height); | 181 | gtk_window_resize(GTK_WINDOW(window_.RawPtr()), width, panel::Style::Instance().PanelHeight(monitor_)); |
813 | 180 | Sync(); | 182 | Sync(); |
814 | 181 | 183 | ||
815 | 182 | return false; | 184 | return false; |
816 | 183 | 185 | ||
817 | === modified file 'panel/PanelTray.h' | |||
818 | --- panel/PanelTray.h 2013-09-19 16:44:03 +0000 | |||
819 | +++ panel/PanelTray.h 2014-02-19 01:47:39 +0000 | |||
820 | @@ -40,7 +40,7 @@ | |||
821 | 40 | class PanelTray : public nux::View, public unity::debug::Introspectable | 40 | class PanelTray : public nux::View, public unity::debug::Introspectable |
822 | 41 | { | 41 | { |
823 | 42 | public: | 42 | public: |
825 | 43 | PanelTray(); | 43 | PanelTray(int monitor); |
826 | 44 | ~PanelTray(); | 44 | ~PanelTray(); |
827 | 45 | 45 | ||
828 | 46 | void Sync(); | 46 | void Sync(); |
829 | @@ -70,6 +70,8 @@ | |||
830 | 70 | glib::Source::UniquePtr sync_idle_; | 70 | glib::Source::UniquePtr sync_idle_; |
831 | 71 | std::list<NaTrayChild*> children_; | 71 | std::list<NaTrayChild*> children_; |
832 | 72 | nux::Geometry last_geo_; | 72 | nux::Geometry last_geo_; |
833 | 73 | |||
834 | 74 | int monitor_; | ||
835 | 73 | }; | 75 | }; |
836 | 74 | 76 | ||
837 | 75 | } | 77 | } |
838 | 76 | 78 | ||
839 | === modified file 'panel/PanelView.cpp' | |||
840 | --- panel/PanelView.cpp 2014-02-17 13:43:43 +0000 | |||
841 | +++ panel/PanelView.cpp 2014-02-19 01:47:39 +0000 | |||
842 | @@ -73,6 +73,8 @@ | |||
843 | 73 | { | 73 | { |
844 | 74 | auto& wm = WindowManager::Default(); | 74 | auto& wm = WindowManager::Default(); |
845 | 75 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground)); | 75 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &PanelView::ForceUpdateBackground)); |
846 | 76 | unity::Settings::Instance().dpi_changed.connect(sigc::mem_fun(this, &PanelView::OnDPIChanged)); | ||
847 | 77 | |||
848 | 76 | wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate)); | 78 | wm.average_color.changed.connect(sigc::mem_fun(this, &PanelView::OnBackgroundUpdate)); |
849 | 77 | wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate)); | 79 | wm.initiate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadInitiate)); |
850 | 78 | wm.terminate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadTerminate)); | 80 | wm.terminate_spread.connect(sigc::mem_fun(this, &PanelView::OnSpreadTerminate)); |
851 | @@ -107,11 +109,12 @@ | |||
852 | 107 | 109 | ||
853 | 108 | SetCompositionLayout(layout_); | 110 | SetCompositionLayout(layout_); |
854 | 109 | 111 | ||
856 | 110 | tray_ = new PanelTray(); | 112 | tray_ = new PanelTray(monitor_); |
857 | 111 | layout_->AddView(tray_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); | 113 | layout_->AddView(tray_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_FULL); |
858 | 112 | AddChild(tray_); | 114 | AddChild(tray_); |
859 | 113 | 115 | ||
860 | 114 | indicators_ = new PanelIndicatorsView(); | 116 | indicators_ = new PanelIndicatorsView(); |
861 | 117 | indicators_->SetMonitor(monitor_); | ||
862 | 115 | AddPanelView(indicators_, 0); | 118 | AddPanelView(indicators_, 0); |
863 | 116 | 119 | ||
864 | 117 | for (auto const& object : remote_->GetIndicators()) | 120 | for (auto const& object : remote_->GetIndicators()) |
865 | @@ -168,6 +171,13 @@ | |||
866 | 168 | return tray_->xid(); | 171 | return tray_->xid(); |
867 | 169 | } | 172 | } |
868 | 170 | 173 | ||
869 | 174 | void PanelView::OnDPIChanged() | ||
870 | 175 | { | ||
871 | 176 | int height = panel::Style::Instance().PanelHeight(monitor_); | ||
872 | 177 | tray_->SetMinMaxSize(1, height); | ||
873 | 178 | menu_view_->OnDPIChanged(); | ||
874 | 179 | } | ||
875 | 180 | |||
876 | 171 | void PanelView::SetLauncherWidth(int width) | 181 | void PanelView::SetLauncherWidth(int width) |
877 | 172 | { | 182 | { |
878 | 173 | launcher_width_ = width; | 183 | launcher_width_ = width; |
879 | @@ -774,7 +784,11 @@ | |||
880 | 774 | { | 784 | { |
881 | 775 | monitor_ = monitor; | 785 | monitor_ = monitor; |
882 | 776 | menu_view_->SetMonitor(monitor); | 786 | menu_view_->SetMonitor(monitor); |
883 | 787 | indicators_->SetMonitor(monitor); | ||
884 | 777 | 788 | ||
885 | 789 | int height = panel::Style::Instance().PanelHeight(monitor_); | ||
886 | 790 | SetMinMaxSize(height, height); | ||
887 | 791 | |||
888 | 778 | UScreen* uscreen = UScreen::GetDefault(); | 792 | UScreen* uscreen = UScreen::GetDefault(); |
889 | 779 | auto monitor_geo = uscreen->GetMonitorGeometry(monitor); | 793 | auto monitor_geo = uscreen->GetMonitorGeometry(monitor); |
890 | 780 | Resize(nux::Point(monitor_geo.x, monitor_geo.y), monitor_geo.width); | 794 | Resize(nux::Point(monitor_geo.x, monitor_geo.y), monitor_geo.width); |
891 | @@ -784,8 +798,8 @@ | |||
892 | 784 | { | 798 | { |
893 | 785 | unity::panel::Style &panel_style = panel::Style::Instance(); | 799 | unity::panel::Style &panel_style = panel::Style::Instance(); |
894 | 786 | SetMaximumWidth(width); | 800 | SetMaximumWidth(width); |
897 | 787 | SetGeometry(nux::Geometry(0, 0, width, panel_style.panel_height)); | 801 | SetGeometry(nux::Geometry(0, 0, width, panel_style.PanelHeight(monitor_))); |
898 | 788 | parent_->SetGeometry(nux::Geometry(offset.x, offset.y, width, panel_style.panel_height)); | 802 | parent_->SetGeometry(nux::Geometry(offset.x, offset.y, width, panel_style.PanelHeight(monitor_))); |
899 | 789 | } | 803 | } |
900 | 790 | 804 | ||
901 | 791 | int PanelView::GetMonitor() const | 805 | int PanelView::GetMonitor() const |
902 | 792 | 806 | ||
903 | === modified file 'panel/PanelView.h' | |||
904 | --- panel/PanelView.h 2014-02-17 14:09:15 +0000 | |||
905 | +++ panel/PanelView.h 2014-02-19 01:47:39 +0000 | |||
906 | @@ -110,6 +110,8 @@ | |||
907 | 110 | bool TrackMenuPointer(); | 110 | bool TrackMenuPointer(); |
908 | 111 | void SyncGeometries(); | 111 | void SyncGeometries(); |
909 | 112 | void AddPanelView(PanelIndicatorsView* child, unsigned int stretchFactor); | 112 | void AddPanelView(PanelIndicatorsView* child, unsigned int stretchFactor); |
910 | 113 | |||
911 | 114 | void OnDPIChanged(); | ||
912 | 113 | 115 | ||
913 | 114 | MockableBaseWindow* parent_; | 116 | MockableBaseWindow* parent_; |
914 | 115 | indicator::Indicators::Ptr remote_; | 117 | indicator::Indicators::Ptr remote_; |
915 | 116 | 118 | ||
916 | === modified file 'panel/StandalonePanel.cpp' | |||
917 | --- panel/StandalonePanel.cpp 2014-02-12 07:13:01 +0000 | |||
918 | +++ panel/StandalonePanel.cpp 2014-02-19 01:47:39 +0000 | |||
919 | @@ -89,7 +89,7 @@ | |||
920 | 89 | panel_window->ShowWindow(true); | 89 | panel_window->ShowWindow(true); |
921 | 90 | panel_window->SetWidth(1024); | 90 | panel_window->SetWidth(1024); |
922 | 91 | panel_window->SetXY(0, 0); | 91 | panel_window->SetXY(0, 0); |
924 | 92 | panel_window->SetMaximumHeight(panel_style.panel_height()); | 92 | panel_window->SetMaximumHeight(panel_style.PanelHeight()); |
925 | 93 | 93 | ||
926 | 94 | wt->window_configuration.connect([this] (int x, int y, int w, int h) { | 94 | wt->window_configuration.connect([this] (int x, int y, int w, int h) { |
927 | 95 | panel_window->SetWidth(w); | 95 | panel_window->SetWidth(w); |
928 | 96 | 96 | ||
929 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
930 | --- plugins/unityshell/src/unityshell.cpp 2014-02-17 23:31:02 +0000 | |||
931 | +++ plugins/unityshell/src/unityshell.cpp 2014-02-19 01:47:39 +0000 | |||
932 | @@ -628,7 +628,8 @@ | |||
933 | 628 | if (_shadow_texture.empty ()) | 628 | if (_shadow_texture.empty ()) |
934 | 629 | return; | 629 | return; |
935 | 630 | 630 | ||
937 | 631 | float panel_h = static_cast<float>(panel_style_.panel_height); | 631 | int monitor = PluginAdapter::Default().MonitorGeometryIn(NuxGeometryFromCompRect(output)); |
938 | 632 | float panel_h = static_cast<float>(panel_style_.PanelHeight(monitor)); | ||
939 | 632 | float shadowX = output.x(); | 633 | float shadowX = output.x(); |
940 | 633 | float shadowY = output.y() + panel_h; | 634 | float shadowY = output.y() + panel_h; |
941 | 634 | float shadowWidth = output.width(); | 635 | float shadowWidth = output.width(); |
942 | @@ -907,7 +908,9 @@ | |||
943 | 907 | 908 | ||
944 | 908 | nux::TexCoordXForm texxform; | 909 | nux::TexCoordXForm texxform; |
945 | 909 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_CLAMP); | 910 | texxform.SetWrap(nux::TEXWRAP_REPEAT, nux::TEXWRAP_CLAMP); |
947 | 910 | int panel_height = panel_style_.panel_height; | 911 | |
948 | 912 | // FIXME Change to paint per monitor vs all at once | ||
949 | 913 | int panel_height = panel_style_.PanelHeight(); | ||
950 | 911 | auto const& texture = panel_style_.GetBackground()->GetDeviceTexture(); | 914 | auto const& texture = panel_style_.GetBackground()->GetDeviceTexture(); |
951 | 912 | graphics_engine->QRP_GLSL_1Tex(0, 0, screen->width(), panel_height, texture, texxform, nux::color::White); | 915 | graphics_engine->QRP_GLSL_1Tex(0, 0, screen->width(), panel_height, texture, texxform, nux::color::White); |
952 | 913 | } | 916 | } |
953 | @@ -2907,9 +2910,11 @@ | |||
954 | 2907 | !(window->state() & CompWindowStateFullscreenMask) && | 2910 | !(window->state() & CompWindowStateFullscreenMask) && |
955 | 2908 | !(window->type() & CompWindowTypeFullscreenMask)) | 2911 | !(window->type() & CompWindowTypeFullscreenMask)) |
956 | 2909 | { | 2912 | { |
957 | 2913 | WindowManager& wm = WindowManager::Default(); | ||
958 | 2910 | auto const& output = uScreen->screen->currentOutputDev(); | 2914 | auto const& output = uScreen->screen->currentOutputDev(); |
959 | 2915 | int monitor = wm.MonitorGeometryIn(NuxGeometryFromCompRect(output)); | ||
960 | 2911 | 2916 | ||
962 | 2912 | if (window->y() - window->border().top < output.y() + uScreen->panel_style_.panel_height) | 2917 | if (window->y() - window->border().top < output.y() + uScreen->panel_style_.PanelHeight(monitor)) |
963 | 2913 | { | 2918 | { |
964 | 2914 | draw_panel_shadow = DrawPanelShadow::OVER_WINDOW; | 2919 | draw_panel_shadow = DrawPanelShadow::OVER_WINDOW; |
965 | 2915 | } | 2920 | } |
966 | @@ -3622,7 +3627,7 @@ | |||
967 | 3622 | hud_controller_->launcher_width = launcher_width; | 3627 | hud_controller_->launcher_width = launcher_width; |
968 | 3623 | dash_controller_->launcher_width = launcher_width; | 3628 | dash_controller_->launcher_width = launcher_width; |
969 | 3624 | panel_controller_->launcher_width = launcher_width; | 3629 | panel_controller_->launcher_width = launcher_width; |
971 | 3625 | shortcut_controller_->SetAdjustment(launcher_width, panel_style_.panel_height); | 3630 | shortcut_controller_->SetAdjustment(launcher_width, panel_style_.PanelHeight()); |
972 | 3626 | 3631 | ||
973 | 3627 | CompOption::Value v(launcher_width); | 3632 | CompOption::Value v(launcher_width); |
974 | 3628 | screen->setOptionForPlugin("expo", "x_offset", v); | 3633 | screen->setOptionForPlugin("expo", "x_offset", v); |
975 | 3629 | 3634 | ||
976 | === modified file 'tests/test_em_converter.cpp' | |||
977 | --- tests/test_em_converter.cpp 2014-01-29 22:40:20 +0000 | |||
978 | +++ tests/test_em_converter.cpp 2014-02-19 01:47:39 +0000 | |||
979 | @@ -64,7 +64,7 @@ | |||
980 | 64 | 64 | ||
981 | 65 | TEST_F(TestEMConverter, TestConvertPixel) | 65 | TEST_F(TestEMConverter, TestConvertPixel) |
982 | 66 | { | 66 | { |
984 | 67 | EXPECT_EQ(PIXEL_SIZE, em_converter.ConvertPixels(PIXEL_SIZE)); | 67 | EXPECT_EQ(PIXEL_SIZE, em_converter.CP(PIXEL_SIZE)); |
985 | 68 | } | 68 | } |
986 | 69 | 69 | ||
987 | 70 | TEST_F(TestEMConverter, TestDPIScale) | 70 | TEST_F(TestEMConverter, TestDPIScale) |
988 | 71 | 71 | ||
989 | === modified file 'tests/test_launcher_controller.cpp' | |||
990 | --- tests/test_launcher_controller.cpp 2013-11-06 11:21:43 +0000 | |||
991 | +++ tests/test_launcher_controller.cpp 2014-02-19 01:47:39 +0000 | |||
992 | @@ -464,8 +464,8 @@ | |||
993 | 464 | auto const& monitor_geo = uscreen.GetMonitorGeometry(i); | 464 | auto const& monitor_geo = uscreen.GetMonitorGeometry(i); |
994 | 465 | auto const& launcher_geo = lc.launchers()[i]->GetAbsoluteGeometry(); | 465 | auto const& launcher_geo = lc.launchers()[i]->GetAbsoluteGeometry(); |
995 | 466 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); | 466 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); |
998 | 467 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.panel_height); | 467 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.PanelHeight(i)); |
999 | 468 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.panel_height); | 468 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight(i)); |
1000 | 469 | } | 469 | } |
1001 | 470 | } | 470 | } |
1002 | 471 | 471 | ||
1003 | @@ -476,15 +476,15 @@ | |||
1004 | 476 | uscreen.SetMonitors({monitor_geo}); | 476 | uscreen.SetMonitors({monitor_geo}); |
1005 | 477 | nux::Geometry launcher_geo = lc.launcher().GetAbsoluteGeometry(); | 477 | nux::Geometry launcher_geo = lc.launcher().GetAbsoluteGeometry(); |
1006 | 478 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); | 478 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); |
1009 | 479 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.panel_height); | 479 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.PanelHeight()); |
1010 | 480 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.panel_height); | 480 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight()); |
1011 | 481 | 481 | ||
1012 | 482 | uscreen.Reset(); | 482 | uscreen.Reset(); |
1013 | 483 | monitor_geo = uscreen.GetMonitorGeometry(0); | 483 | monitor_geo = uscreen.GetMonitorGeometry(0); |
1014 | 484 | launcher_geo = lc.launcher().GetAbsoluteGeometry(); | 484 | launcher_geo = lc.launcher().GetAbsoluteGeometry(); |
1015 | 485 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); | 485 | ASSERT_EQ(launcher_geo.x, monitor_geo.x); |
1018 | 486 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.panel_height); | 486 | ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.PanelHeight()); |
1019 | 487 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.panel_height); | 487 | ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.PanelHeight()); |
1020 | 488 | } | 488 | } |
1021 | 489 | 489 | ||
1022 | 490 | TEST_F(TestLauncherController, IconCentersResetsOnMonitorsUpdated) | 490 | TEST_F(TestLauncherController, IconCentersResetsOnMonitorsUpdated) |
1023 | 491 | 491 | ||
1024 | === modified file 'tests/test_panel_controller.cpp' | |||
1025 | --- tests/test_panel_controller.cpp 2014-02-12 07:13:01 +0000 | |||
1026 | +++ tests/test_panel_controller.cpp 2014-02-19 01:47:39 +0000 | |||
1027 | @@ -148,7 +148,7 @@ | |||
1028 | 148 | ASSERT_EQ(panel_geo.x, monitor_geo.x); | 148 | ASSERT_EQ(panel_geo.x, monitor_geo.x); |
1029 | 149 | ASSERT_EQ(panel_geo.y, monitor_geo.y); | 149 | ASSERT_EQ(panel_geo.y, monitor_geo.y); |
1030 | 150 | ASSERT_EQ(panel_geo.width, monitor_geo.width); | 150 | ASSERT_EQ(panel_geo.width, monitor_geo.width); |
1032 | 151 | ASSERT_EQ(panel_geo.height, panel_style.panel_height); | 151 | ASSERT_EQ(panel_geo.height, panel_style.PanelHeight(i)); |
1033 | 152 | } | 152 | } |
1034 | 153 | } | 153 | } |
1035 | 154 | } | 154 | } |
1036 | @@ -164,7 +164,7 @@ | |||
1037 | 164 | ASSERT_EQ(panel_geo.x, monitor_geo.x); | 164 | ASSERT_EQ(panel_geo.x, monitor_geo.x); |
1038 | 165 | ASSERT_EQ(panel_geo.y, monitor_geo.y); | 165 | ASSERT_EQ(panel_geo.y, monitor_geo.y); |
1039 | 166 | ASSERT_EQ(panel_geo.width, monitor_geo.width); | 166 | ASSERT_EQ(panel_geo.width, monitor_geo.width); |
1041 | 167 | ASSERT_EQ(panel_geo.height, panel_style.panel_height); | 167 | ASSERT_EQ(panel_geo.height, panel_style.PanelHeight()); |
1042 | 168 | 168 | ||
1043 | 169 | uscreen.Reset(); | 169 | uscreen.Reset(); |
1044 | 170 | monitor_geo = uscreen.GetMonitorGeometry(0); | 170 | monitor_geo = uscreen.GetMonitorGeometry(0); |
1045 | @@ -172,7 +172,7 @@ | |||
1046 | 172 | ASSERT_EQ(panel_geo.x, monitor_geo.x); | 172 | ASSERT_EQ(panel_geo.x, monitor_geo.x); |
1047 | 173 | ASSERT_EQ(panel_geo.y, monitor_geo.y); | 173 | ASSERT_EQ(panel_geo.y, monitor_geo.y); |
1048 | 174 | ASSERT_EQ(panel_geo.width, monitor_geo.width); | 174 | ASSERT_EQ(panel_geo.width, monitor_geo.width); |
1050 | 175 | ASSERT_EQ(panel_geo.height, panel_style.panel_height); | 175 | ASSERT_EQ(panel_geo.height, panel_style.PanelHeight()); |
1051 | 176 | } | 176 | } |
1052 | 177 | 177 | ||
1053 | 178 | TEST_F(TestPanelController, MultiMonitorEdgeBarrierSubscriptions) | 178 | TEST_F(TestPanelController, MultiMonitorEdgeBarrierSubscriptions) |
1054 | 179 | 179 | ||
1055 | === modified file 'tests/test_panel_indicator_entry_dropdown_view.cpp' | |||
1056 | --- tests/test_panel_indicator_entry_dropdown_view.cpp 2014-01-30 19:46:58 +0000 | |||
1057 | +++ tests/test_panel_indicator_entry_dropdown_view.cpp 2014-02-19 01:47:39 +0000 | |||
1058 | @@ -230,7 +230,7 @@ | |||
1059 | 230 | } | 230 | } |
1060 | 231 | 231 | ||
1061 | 232 | auto const& geo = dropdown.GetGeometry(); | 232 | auto const& geo = dropdown.GetGeometry(); |
1063 | 233 | EXPECT_CALL(*indicators_, ShowEntriesDropdown(entries, Entry::Ptr(), 0, geo.x, geo.y + Style::Instance().panel_height)); | 233 | EXPECT_CALL(*indicators_, ShowEntriesDropdown(entries, Entry::Ptr(), 0, geo.x, geo.y + Style::Instance().PanelHeight())); |
1064 | 234 | dropdown.ShowMenu(); | 234 | dropdown.ShowMenu(); |
1065 | 235 | } | 235 | } |
1066 | 236 | 236 | ||
1067 | @@ -249,7 +249,7 @@ | |||
1068 | 249 | auto active = views[g_random_int() % views.size()]; | 249 | auto active = views[g_random_int() % views.size()]; |
1069 | 250 | auto const& geo = dropdown.GetGeometry(); | 250 | auto const& geo = dropdown.GetGeometry(); |
1070 | 251 | 251 | ||
1072 | 252 | EXPECT_CALL(*indicators_, ShowEntriesDropdown(entries, active->GetEntry(), 0, geo.x, geo.y + Style::Instance().panel_height)); | 252 | EXPECT_CALL(*indicators_, ShowEntriesDropdown(entries, active->GetEntry(), 0, geo.x, geo.y + Style::Instance().PanelHeight())); |
1073 | 253 | dropdown.ActivateChild(active); | 253 | dropdown.ActivateChild(active); |
1074 | 254 | } | 254 | } |
1075 | 255 | 255 | ||
1076 | 256 | 256 | ||
1077 | === modified file 'tests/test_panel_menu_view.cpp' | |||
1078 | --- tests/test_panel_menu_view.cpp 2014-02-17 15:36:53 +0000 | |||
1079 | +++ tests/test_panel_menu_view.cpp 2014-02-19 01:47:39 +0000 | |||
1080 | @@ -61,7 +61,7 @@ | |||
1081 | 61 | nux::ObjectPtr<nux::BaseWindow> panel_win(new nux::BaseWindow()); | 61 | nux::ObjectPtr<nux::BaseWindow> panel_win(new nux::BaseWindow()); |
1082 | 62 | auto const& monitor_geo = uscreen.GetMonitorGeometry(monitor); | 62 | auto const& monitor_geo = uscreen.GetMonitorGeometry(monitor); |
1083 | 63 | panel_win->SetGeometry(monitor_geo); | 63 | panel_win->SetGeometry(monitor_geo); |
1085 | 64 | panel_win->SetMaximumHeight(panelStyle.panel_height()); | 64 | panel_win->SetMaximumHeight(panelStyle.PanelHeight(monitor)); |
1086 | 65 | panel_win->SetLayout(new nux::HLayout(NUX_TRACKER_LOCATION)); | 65 | panel_win->SetLayout(new nux::HLayout(NUX_TRACKER_LOCATION)); |
1087 | 66 | panel_win->GetLayout()->AddView(&menu_view, 1); | 66 | panel_win->GetLayout()->AddView(&menu_view, 1); |
1088 | 67 | panel_win->GetLayout()->SetContentDistribution(nux::MAJOR_POSITION_START); | 67 | panel_win->GetLayout()->SetContentDistribution(nux::MAJOR_POSITION_START); |
1089 | 68 | 68 | ||
1090 | === modified file 'tests/test_panel_style.cpp' | |||
1091 | --- tests/test_panel_style.cpp 2013-07-09 04:29:25 +0000 | |||
1092 | +++ tests/test_panel_style.cpp 2014-02-19 01:47:39 +0000 | |||
1093 | @@ -27,6 +27,8 @@ | |||
1094 | 27 | #include "unity-shared/UnitySettings.h" | 27 | #include "unity-shared/UnitySettings.h" |
1095 | 28 | #include "test_utils.h" | 28 | #include "test_utils.h" |
1096 | 29 | 29 | ||
1097 | 30 | #include "MultiMonitor.h" | ||
1098 | 31 | |||
1099 | 30 | using namespace unity; | 32 | using namespace unity; |
1100 | 31 | using namespace testing; | 33 | using namespace testing; |
1101 | 32 | 34 | ||
1102 | @@ -83,4 +85,14 @@ | |||
1103 | 83 | g_free (old_font); | 85 | g_free (old_font); |
1104 | 84 | } | 86 | } |
1105 | 85 | 87 | ||
1106 | 88 | TEST_F(TestPanelStyle, TestPanelHeightUnderBounds) | ||
1107 | 89 | { | ||
1108 | 90 | ASSERT_EQ(panel_style_instance->PanelHeight(-1), 0); | ||
1109 | 91 | } | ||
1110 | 92 | |||
1111 | 93 | TEST_F(TestPanelStyle, TestPanelHeightOverBounds) | ||
1112 | 94 | { | ||
1113 | 95 | ASSERT_EQ(panel_style_instance->PanelHeight(monitors::MAX), 0); | ||
1114 | 96 | } | ||
1115 | 97 | |||
1116 | 86 | } | 98 | } |
1117 | 87 | 99 | ||
1118 | === modified file 'tests/test_raw_pixel.cpp' | |||
1119 | --- tests/test_raw_pixel.cpp 2014-02-07 21:50:15 +0000 | |||
1120 | +++ tests/test_raw_pixel.cpp 2014-02-19 01:47:39 +0000 | |||
1121 | @@ -32,13 +32,13 @@ | |||
1122 | 32 | { | 32 | { |
1123 | 33 | public: | 33 | public: |
1124 | 34 | TestRawPixel() | 34 | TestRawPixel() |
1126 | 35 | : cv(FONT_SIZE, DPI) | 35 | : cv(std::make_shared<EMConverter>(FONT_SIZE, DPI)) |
1127 | 36 | , p_i(10_em) | 36 | , p_i(10_em) |
1128 | 37 | , p_f(10.0_em) | 37 | , p_f(10.0_em) |
1129 | 38 | { | 38 | { |
1130 | 39 | } | 39 | } |
1131 | 40 | 40 | ||
1133 | 41 | EMConverter cv; | 41 | EMConverter::Ptr cv; |
1134 | 42 | RawPixel p_i; | 42 | RawPixel p_i; |
1135 | 43 | RawPixel p_f; | 43 | RawPixel p_f; |
1136 | 44 | }; | 44 | }; |
1137 | @@ -67,7 +67,7 @@ | |||
1138 | 67 | 67 | ||
1139 | 68 | TEST_F(TestRawPixel, TestConverterTimesTwo) | 68 | TEST_F(TestRawPixel, TestConverterTimesTwo) |
1140 | 69 | { | 69 | { |
1142 | 70 | cv.SetDPI(DPI * 2); | 70 | cv->SetDPI(DPI * 2); |
1143 | 71 | ASSERT_EQ(p_i.CP(cv), 20); | 71 | ASSERT_EQ(p_i.CP(cv), 20); |
1144 | 72 | } | 72 | } |
1145 | 73 | 73 | ||
1146 | 74 | 74 | ||
1147 | === modified file 'unity-shared/EMConverter.cpp' | |||
1148 | --- unity-shared/EMConverter.cpp 2014-02-07 21:50:15 +0000 | |||
1149 | +++ unity-shared/EMConverter.cpp 2014-02-19 01:47:39 +0000 | |||
1150 | @@ -96,7 +96,7 @@ | |||
1151 | 96 | return (pixels / base_pixels_per_em_); | 96 | return (pixels / base_pixels_per_em_); |
1152 | 97 | } | 97 | } |
1153 | 98 | 98 | ||
1155 | 99 | double EMConverter::ConvertPixels(int pixels) const | 99 | double EMConverter::CP(int pixels) const |
1156 | 100 | { | 100 | { |
1157 | 101 | double pixels_em = PixelsToBaseEM(pixels); | 101 | double pixels_em = PixelsToBaseEM(pixels); |
1158 | 102 | return EMToPixels(pixels_em); | 102 | return EMToPixels(pixels_em); |
1159 | 103 | 103 | ||
1160 | === modified file 'unity-shared/EMConverter.h' | |||
1161 | --- unity-shared/EMConverter.h 2014-02-07 21:50:15 +0000 | |||
1162 | +++ unity-shared/EMConverter.h 2014-02-19 01:47:39 +0000 | |||
1163 | @@ -20,12 +20,16 @@ | |||
1164 | 20 | #ifndef EM_CONVERTER_H | 20 | #ifndef EM_CONVERTER_H |
1165 | 21 | #define EM_CONVERTER_H | 21 | #define EM_CONVERTER_H |
1166 | 22 | 22 | ||
1167 | 23 | #include <memory> | ||
1168 | 24 | |||
1169 | 23 | namespace unity | 25 | namespace unity |
1170 | 24 | { | 26 | { |
1171 | 25 | 27 | ||
1172 | 26 | class EMConverter | 28 | class EMConverter |
1173 | 27 | { | 29 | { |
1174 | 28 | public: | 30 | public: |
1175 | 31 | typedef std::shared_ptr<EMConverter> Ptr; | ||
1176 | 32 | |||
1177 | 29 | EMConverter(int font_size = 0, double dpi = 96.0); | 33 | EMConverter(int font_size = 0, double dpi = 96.0); |
1178 | 30 | 34 | ||
1179 | 31 | void SetFontSize(int font_size); | 35 | void SetFontSize(int font_size); |
1180 | @@ -34,7 +38,7 @@ | |||
1181 | 34 | int GetFontSize() const; | 38 | int GetFontSize() const; |
1182 | 35 | double GetDPI() const; | 39 | double GetDPI() const; |
1183 | 36 | 40 | ||
1185 | 37 | double ConvertPixels(int pixels) const; | 41 | double CP(int pixels) const; |
1186 | 38 | double DPIScale() const; | 42 | double DPIScale() const; |
1187 | 39 | 43 | ||
1188 | 40 | double PtToPx(int pt); | 44 | double PtToPx(int pt); |
1189 | 41 | 45 | ||
1190 | === modified file 'unity-shared/OverlayWindowButtons.cpp' | |||
1191 | --- unity-shared/OverlayWindowButtons.cpp 2014-02-10 15:31:44 +0000 | |||
1192 | +++ unity-shared/OverlayWindowButtons.cpp 2014-02-19 01:47:39 +0000 | |||
1193 | @@ -60,7 +60,7 @@ | |||
1194 | 60 | 60 | ||
1195 | 61 | SetX(geo.x + MAIN_LEFT_PADDING); | 61 | SetX(geo.x + MAIN_LEFT_PADDING); |
1196 | 62 | SetY(geo.y + MENUBAR_PADDING); | 62 | SetY(geo.y + MENUBAR_PADDING); |
1198 | 63 | SetHeight(panel::Style::Instance().panel_height); | 63 | SetHeight(panel::Style::Instance().PanelHeight(monitor)); |
1199 | 64 | 64 | ||
1200 | 65 | window_buttons_->monitor = monitor; | 65 | window_buttons_->monitor = monitor; |
1201 | 66 | } | 66 | } |
1202 | 67 | 67 | ||
1203 | === modified file 'unity-shared/PanelStyle.cpp' | |||
1204 | --- unity-shared/PanelStyle.cpp 2014-01-16 13:20:16 +0000 | |||
1205 | +++ unity-shared/PanelStyle.cpp 2014-02-19 01:47:39 +0000 | |||
1206 | @@ -27,6 +27,8 @@ | |||
1207 | 27 | #include "unity-shared/TextureCache.h" | 27 | #include "unity-shared/TextureCache.h" |
1208 | 28 | #include "unity-shared/UnitySettings.h" | 28 | #include "unity-shared/UnitySettings.h" |
1209 | 29 | 29 | ||
1210 | 30 | #include "MultiMonitor.h" | ||
1211 | 31 | |||
1212 | 30 | namespace unity | 32 | namespace unity |
1213 | 31 | { | 33 | { |
1214 | 32 | namespace panel | 34 | namespace panel |
1215 | @@ -38,6 +40,7 @@ | |||
1216 | 38 | DECLARE_LOGGER(logger, "unity.panel.style"); | 40 | DECLARE_LOGGER(logger, "unity.panel.style"); |
1217 | 39 | const int BUTTONS_SIZE = 16; | 41 | const int BUTTONS_SIZE = 16; |
1218 | 40 | const int BUTTONS_PADDING = 1; | 42 | const int BUTTONS_PADDING = 1; |
1219 | 43 | const int BASE_PANEL_HEIGHT = 24; | ||
1220 | 41 | 44 | ||
1221 | 42 | std::string button_id(WindowButtonType type, WindowState ws) | 45 | std::string button_id(WindowButtonType type, WindowState ws) |
1222 | 43 | { | 46 | { |
1223 | @@ -50,8 +53,8 @@ | |||
1224 | 50 | } | 53 | } |
1225 | 51 | 54 | ||
1226 | 52 | Style::Style() | 55 | Style::Style() |
1229 | 53 | : panel_height(24) | 56 | : style_context_(gtk_style_context_new()) |
1230 | 54 | , style_context_(gtk_style_context_new()) | 57 | , panel_heights_(monitors::MAX, BASE_PANEL_HEIGHT) |
1231 | 55 | { | 58 | { |
1232 | 56 | if (style_instance) | 59 | if (style_instance) |
1233 | 57 | { | 60 | { |
1234 | @@ -62,15 +65,6 @@ | |||
1235 | 62 | style_instance = this; | 65 | style_instance = this; |
1236 | 63 | } | 66 | } |
1237 | 64 | 67 | ||
1238 | 65 | if (Settings::Instance().form_factor() == FormFactor::TV) | ||
1239 | 66 | panel_height = 0; | ||
1240 | 67 | |||
1241 | 68 | Settings::Instance().form_factor.changed.connect([this](FormFactor form_factor) | ||
1242 | 69 | { | ||
1243 | 70 | if (form_factor == FormFactor::TV) | ||
1244 | 71 | panel_height = 0; | ||
1245 | 72 | }); | ||
1246 | 73 | |||
1247 | 74 | GtkWidgetPath* widget_path = gtk_widget_path_new(); | 68 | GtkWidgetPath* widget_path = gtk_widget_path_new(); |
1248 | 75 | gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_WINDOW); | 69 | gint pos = gtk_widget_path_append_type(widget_path, GTK_TYPE_WINDOW); |
1249 | 76 | gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget"); | 70 | gtk_widget_path_iter_set_name(widget_path, pos, "UnityPanelWidget"); |
1250 | @@ -115,10 +109,23 @@ | |||
1251 | 115 | RefreshContext(); | 109 | RefreshContext(); |
1252 | 116 | } | 110 | } |
1253 | 117 | 111 | ||
1254 | 112 | int Style::PanelHeight(int monitor) const | ||
1255 | 113 | { | ||
1256 | 114 | if (monitor < 0 || monitor >= (int)monitors::MAX) | ||
1257 | 115 | { | ||
1258 | 116 | LOG_ERROR(logger) << "Invalid monitor index: " << monitor; | ||
1259 | 117 | return 0; | ||
1260 | 118 | } | ||
1261 | 119 | |||
1262 | 120 | EMConverter::Ptr const& cv = unity::Settings::Instance().em(monitor); | ||
1263 | 121 | return panel_heights_[monitor].CP(cv); | ||
1264 | 122 | } | ||
1265 | 123 | |||
1266 | 118 | void Style::RefreshContext() | 124 | void Style::RefreshContext() |
1267 | 119 | { | 125 | { |
1268 | 120 | gtk_style_context_invalidate(style_context_); | 126 | gtk_style_context_invalidate(style_context_); |
1269 | 121 | bg_texture_.Release(); | 127 | bg_texture_.Release(); |
1270 | 128 | |||
1271 | 122 | changed.emit(); | 129 | changed.emit(); |
1272 | 123 | } | 130 | } |
1273 | 124 | 131 | ||
1274 | @@ -127,13 +134,13 @@ | |||
1275 | 127 | return style_context_; | 134 | return style_context_; |
1276 | 128 | } | 135 | } |
1277 | 129 | 136 | ||
1279 | 130 | BaseTexturePtr Style::GetBackground() | 137 | BaseTexturePtr Style::GetBackground(int monitor) |
1280 | 131 | { | 138 | { |
1281 | 132 | if (bg_texture_) | 139 | if (bg_texture_) |
1282 | 133 | return bg_texture_; | 140 | return bg_texture_; |
1283 | 134 | 141 | ||
1284 | 135 | int width = 1; | 142 | int width = 1; |
1286 | 136 | int height = panel_height(); | 143 | int height = PanelHeight(monitor); |
1287 | 137 | 144 | ||
1288 | 138 | nux::CairoGraphics context(CAIRO_FORMAT_ARGB32, width, height); | 145 | nux::CairoGraphics context(CAIRO_FORMAT_ARGB32, width, height); |
1289 | 139 | 146 | ||
1290 | 140 | 147 | ||
1291 | === modified file 'unity-shared/PanelStyle.h' | |||
1292 | --- unity-shared/PanelStyle.h 2014-01-14 17:18:17 +0000 | |||
1293 | +++ unity-shared/PanelStyle.h 2014-02-19 01:47:39 +0000 | |||
1294 | @@ -28,6 +28,9 @@ | |||
1295 | 28 | #include <gtk/gtk.h> | 28 | #include <gtk/gtk.h> |
1296 | 29 | #include <UnityCore/GLibWrapper.h> | 29 | #include <UnityCore/GLibWrapper.h> |
1297 | 30 | 30 | ||
1298 | 31 | #include "unity-shared/EMConverter.h" | ||
1299 | 32 | #include "unity-shared/RawPixel.h" | ||
1300 | 33 | |||
1301 | 31 | namespace unity | 34 | namespace unity |
1302 | 32 | { | 35 | { |
1303 | 33 | namespace decoration | 36 | namespace decoration |
1304 | @@ -57,23 +60,28 @@ | |||
1305 | 57 | 60 | ||
1306 | 58 | static Style& Instance(); | 61 | static Style& Instance(); |
1307 | 59 | 62 | ||
1308 | 60 | nux::Property<int> panel_height; | ||
1309 | 61 | |||
1310 | 62 | GtkStyleContext* GetStyleContext(); | 63 | GtkStyleContext* GetStyleContext(); |
1312 | 63 | BaseTexturePtr GetBackground(); | 64 | BaseTexturePtr GetBackground(int monitor = 0); |
1313 | 64 | BaseTexturePtr GetWindowButton(WindowButtonType type, WindowState state); | 65 | BaseTexturePtr GetWindowButton(WindowButtonType type, WindowState state); |
1314 | 65 | BaseTexturePtr GetFallbackWindowButton(WindowButtonType type, WindowState state); | 66 | BaseTexturePtr GetFallbackWindowButton(WindowButtonType type, WindowState state); |
1315 | 66 | std::string GetFontDescription(PanelItem item); | 67 | std::string GetFontDescription(PanelItem item); |
1316 | 67 | int GetTextDPI(); | 68 | int GetTextDPI(); |
1317 | 68 | 69 | ||
1318 | 70 | int PanelHeight(int monitor = 0) const; | ||
1319 | 71 | |||
1320 | 69 | sigc::signal<void> changed; | 72 | sigc::signal<void> changed; |
1321 | 70 | 73 | ||
1322 | 71 | private: | 74 | private: |
1323 | 72 | void OnThemeChanged(std::string const&); | 75 | void OnThemeChanged(std::string const&); |
1324 | 73 | void RefreshContext(); | 76 | void RefreshContext(); |
1325 | 74 | 77 | ||
1326 | 78 | void UpdateFontSize(); | ||
1327 | 79 | void UpdatePanelHeight(); | ||
1328 | 80 | |||
1329 | 75 | glib::Object<GtkStyleContext> style_context_; | 81 | glib::Object<GtkStyleContext> style_context_; |
1330 | 76 | BaseTexturePtr bg_texture_; | 82 | BaseTexturePtr bg_texture_; |
1331 | 83 | |||
1332 | 84 | std::vector<RawPixel> panel_heights_; | ||
1333 | 77 | }; | 85 | }; |
1334 | 78 | 86 | ||
1335 | 79 | } | 87 | } |
1336 | 80 | 88 | ||
1337 | === modified file 'unity-shared/PluginAdapter.cpp' | |||
1338 | --- unity-shared/PluginAdapter.cpp 2014-02-18 00:59:30 +0000 | |||
1339 | +++ unity-shared/PluginAdapter.cpp 2014-02-19 01:47:39 +0000 | |||
1340 | @@ -23,6 +23,7 @@ | |||
1341 | 23 | #include "DecorationStyle.h" | 23 | #include "DecorationStyle.h" |
1342 | 24 | #include "PluginAdapter.h" | 24 | #include "PluginAdapter.h" |
1343 | 25 | #include "CompizUtils.h" | 25 | #include "CompizUtils.h" |
1344 | 26 | #include "MultiMonitor.h" | ||
1345 | 26 | 27 | ||
1346 | 27 | #include <scale/scale.h> | 28 | #include <scale/scale.h> |
1347 | 28 | #include <NuxCore/Logger.h> | 29 | #include <NuxCore/Logger.h> |
1348 | @@ -411,6 +412,20 @@ | |||
1349 | 411 | return ret; | 412 | return ret; |
1350 | 412 | } | 413 | } |
1351 | 413 | 414 | ||
1352 | 415 | int PluginAdapter::MonitorGeometryIn(nux::Geometry const& geo) const | ||
1353 | 416 | { | ||
1354 | 417 | std::vector<nux::Geometry> const& monitors = unity::UScreen::GetDefault()->GetMonitors(); | ||
1355 | 418 | for (unsigned i = 0; i < monitors.size(); ++i) | ||
1356 | 419 | { | ||
1357 | 420 | nux::Geometry const& i_g = geo.Intersect(monitors[i]); | ||
1358 | 421 | |||
1359 | 422 | if (i_g.width > 0 && i_g.height > 0) | ||
1360 | 423 | return i; | ||
1361 | 424 | } | ||
1362 | 425 | |||
1363 | 426 | return 0; | ||
1364 | 427 | } | ||
1365 | 428 | |||
1366 | 414 | bool PluginAdapter::IsTopWindowFullscreenOnMonitorWithMouse() const | 429 | bool PluginAdapter::IsTopWindowFullscreenOnMonitorWithMouse() const |
1367 | 415 | { | 430 | { |
1368 | 416 | int monitor = unity::UScreen::GetDefault()->GetMonitorWithMouse(); | 431 | int monitor = unity::UScreen::GetDefault()->GetMonitorWithMouse(); |
1369 | 417 | 432 | ||
1370 | === modified file 'unity-shared/PluginAdapter.h' | |||
1371 | --- unity-shared/PluginAdapter.h 2014-02-15 14:46:47 +0000 | |||
1372 | +++ unity-shared/PluginAdapter.h 2014-02-19 01:47:39 +0000 | |||
1373 | @@ -115,6 +115,7 @@ | |||
1374 | 115 | Window GetActiveWindow() const; | 115 | Window GetActiveWindow() const; |
1375 | 116 | std::vector<Window> GetWindowsInStackingOrder() const override; | 116 | std::vector<Window> GetWindowsInStackingOrder() const override; |
1376 | 117 | 117 | ||
1377 | 118 | int MonitorGeometryIn(nux::Geometry const& geo) const override; | ||
1378 | 118 | bool IsTopWindowFullscreenOnMonitorWithMouse() const override; | 119 | bool IsTopWindowFullscreenOnMonitorWithMouse() const override; |
1379 | 119 | 120 | ||
1380 | 120 | // WindowManager implementation | 121 | // WindowManager implementation |
1381 | 121 | 122 | ||
1382 | === modified file 'unity-shared/RawPixel.cpp' | |||
1383 | --- unity-shared/RawPixel.cpp 2014-02-07 21:50:15 +0000 | |||
1384 | +++ unity-shared/RawPixel.cpp 2014-02-19 01:47:39 +0000 | |||
1385 | @@ -37,9 +37,9 @@ | |||
1386 | 37 | { | 37 | { |
1387 | 38 | } | 38 | } |
1388 | 39 | 39 | ||
1390 | 40 | float RawPixel::CP(EMConverter const& converter) const | 40 | float RawPixel::CP(EMConverter::Ptr const& converter) const |
1391 | 41 | { | 41 | { |
1393 | 42 | return converter.ConvertPixels(raw_pixel_); | 42 | return converter->CP(raw_pixel_); |
1394 | 43 | } | 43 | } |
1395 | 44 | 44 | ||
1396 | 45 | RawPixel::operator float() const | 45 | RawPixel::operator float() const |
1397 | 46 | 46 | ||
1398 | === modified file 'unity-shared/RawPixel.h' | |||
1399 | --- unity-shared/RawPixel.h 2014-02-07 21:50:15 +0000 | |||
1400 | +++ unity-shared/RawPixel.h 2014-02-19 01:47:39 +0000 | |||
1401 | @@ -30,7 +30,7 @@ | |||
1402 | 30 | public: | 30 | public: |
1403 | 31 | RawPixel(float raw_pixel); | 31 | RawPixel(float raw_pixel); |
1404 | 32 | 32 | ||
1406 | 33 | float CP(EMConverter const& converter) const; | 33 | float CP(EMConverter::Ptr const& converter) const; |
1407 | 34 | 34 | ||
1408 | 35 | operator float() const; | 35 | operator float() const; |
1409 | 36 | 36 | ||
1410 | 37 | 37 | ||
1411 | === modified file 'unity-shared/StandaloneWindowManager.cpp' | |||
1412 | --- unity-shared/StandaloneWindowManager.cpp 2014-02-17 15:22:39 +0000 | |||
1413 | +++ unity-shared/StandaloneWindowManager.cpp 2014-02-19 01:47:39 +0000 | |||
1414 | @@ -129,6 +129,12 @@ | |||
1415 | 129 | 129 | ||
1416 | 130 | return ret; | 130 | return ret; |
1417 | 131 | } | 131 | } |
1418 | 132 | |||
1419 | 133 | int StandaloneWindowManager::MonitorGeometryIn(nux::Geometry const& geo) const | ||
1420 | 134 | { | ||
1421 | 135 | // TODO | ||
1422 | 136 | return 0; | ||
1423 | 137 | } | ||
1424 | 132 | 138 | ||
1425 | 133 | bool StandaloneWindowManager::IsTopWindowFullscreenOnMonitorWithMouse() const | 139 | bool StandaloneWindowManager::IsTopWindowFullscreenOnMonitorWithMouse() const |
1426 | 134 | { | 140 | { |
1427 | 135 | 141 | ||
1428 | === modified file 'unity-shared/StandaloneWindowManager.h' | |||
1429 | --- unity-shared/StandaloneWindowManager.h 2014-02-14 03:05:02 +0000 | |||
1430 | +++ unity-shared/StandaloneWindowManager.h 2014-02-19 01:47:39 +0000 | |||
1431 | @@ -71,6 +71,7 @@ | |||
1432 | 71 | virtual Window GetActiveWindow() const; | 71 | virtual Window GetActiveWindow() const; |
1433 | 72 | std::vector<Window> GetWindowsInStackingOrder() const override; | 72 | std::vector<Window> GetWindowsInStackingOrder() const override; |
1434 | 73 | 73 | ||
1435 | 74 | virtual int MonitorGeometryIn(nux::Geometry const& geo) const override; | ||
1436 | 74 | virtual bool IsTopWindowFullscreenOnMonitorWithMouse() const override; | 75 | virtual bool IsTopWindowFullscreenOnMonitorWithMouse() const override; |
1437 | 75 | 76 | ||
1438 | 76 | virtual bool IsWindowMaximized(Window window_id) const; | 77 | virtual bool IsWindowMaximized(Window window_id) const; |
1439 | 77 | 78 | ||
1440 | === modified file 'unity-shared/UnitySettings.cpp' | |||
1441 | --- unity-shared/UnitySettings.cpp 2014-01-31 21:20:30 +0000 | |||
1442 | +++ unity-shared/UnitySettings.cpp 2014-02-19 01:47:39 +0000 | |||
1443 | @@ -39,6 +39,10 @@ | |||
1444 | 39 | const std::string SETTINGS_NAME = "com.canonical.Unity"; | 39 | const std::string SETTINGS_NAME = "com.canonical.Unity"; |
1445 | 40 | const std::string FORM_FACTOR = "form-factor"; | 40 | const std::string FORM_FACTOR = "form-factor"; |
1446 | 41 | const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate"; | 41 | const std::string DOUBLE_CLICK_ACTIVATE = "double-click-activate"; |
1447 | 42 | |||
1448 | 43 | // FIXME Remove me when hikikos settings changes land in unity | ||
1449 | 44 | const std::string GNOME_SETTINGS = "org.gnome.desktop.interface"; | ||
1450 | 45 | const std::string TEXT_SCALING_FACTOR = "text-scaling-factor"; | ||
1451 | 42 | } | 46 | } |
1452 | 43 | 47 | ||
1453 | 44 | // | 48 | // |
1454 | @@ -50,11 +54,14 @@ | |||
1455 | 50 | Impl(Settings* owner) | 54 | Impl(Settings* owner) |
1456 | 51 | : parent_(owner) | 55 | : parent_(owner) |
1457 | 52 | , gsettings_(g_settings_new(SETTINGS_NAME.c_str())) | 56 | , gsettings_(g_settings_new(SETTINGS_NAME.c_str())) |
1458 | 57 | , gnome_settings_(g_settings_new(GNOME_SETTINGS.c_str())) | ||
1459 | 53 | , cached_form_factor_(FormFactor::DESKTOP) | 58 | , cached_form_factor_(FormFactor::DESKTOP) |
1460 | 54 | , cached_double_click_activate_(true) | 59 | , cached_double_click_activate_(true) |
1461 | 55 | , lowGfx_(false) | 60 | , lowGfx_(false) |
1462 | 56 | , em_converters_(monitors::MAX) | ||
1463 | 57 | { | 61 | { |
1464 | 62 | for (int i = 0; i < (int)monitors::MAX; i++) | ||
1465 | 63 | em_converters_.push_back(std::make_shared<EMConverter>()); | ||
1466 | 64 | |||
1467 | 58 | CacheFormFactor(); | 65 | CacheFormFactor(); |
1468 | 59 | CacheDoubleClickActivate(); | 66 | CacheDoubleClickActivate(); |
1469 | 60 | 67 | ||
1470 | @@ -67,6 +74,10 @@ | |||
1471 | 67 | parent_->double_click_activate.changed.emit(cached_double_click_activate_); | 74 | parent_->double_click_activate.changed.emit(cached_double_click_activate_); |
1472 | 68 | }); | 75 | }); |
1473 | 69 | 76 | ||
1474 | 77 | signals_.Add<void, GSettings*, const gchar*>(gnome_settings_, "changed::" + TEXT_SCALING_FACTOR, [this] (GSettings*, const gchar* t) { | ||
1475 | 78 | UpdateEMConverter(); | ||
1476 | 79 | }); | ||
1477 | 80 | |||
1478 | 70 | UpdateEMConverter(); | 81 | UpdateEMConverter(); |
1479 | 71 | } | 82 | } |
1480 | 72 | 83 | ||
1481 | @@ -124,10 +135,10 @@ | |||
1482 | 124 | // FIXME Add in getting the specific dpi scale from each monitor | 135 | // FIXME Add in getting the specific dpi scale from each monitor |
1483 | 125 | int GetDPI(int monitor = 0) const | 136 | int GetDPI(int monitor = 0) const |
1484 | 126 | { | 137 | { |
1487 | 127 | int dpi = 0; | 138 | int dpi = 96; |
1488 | 128 | g_object_get(gtk_settings_get_default(), "gtk-xft-dpi", &dpi, nullptr); | 139 | float scale = g_settings_get_double(gnome_settings_, TEXT_SCALING_FACTOR.c_str()); |
1489 | 129 | 140 | ||
1491 | 130 | return dpi / 1024; | 141 | return dpi * scale; |
1492 | 131 | } | 142 | } |
1493 | 132 | 143 | ||
1494 | 133 | void UpdateFontSize() | 144 | void UpdateFontSize() |
1495 | @@ -135,7 +146,7 @@ | |||
1496 | 135 | int font_size = GetFontSize(); | 146 | int font_size = GetFontSize(); |
1497 | 136 | 147 | ||
1498 | 137 | for (auto& em : em_converters_) | 148 | for (auto& em : em_converters_) |
1500 | 138 | em.SetFontSize(font_size); | 149 | em->SetFontSize(font_size); |
1501 | 139 | } | 150 | } |
1502 | 140 | 151 | ||
1503 | 141 | void UpdateDPI() | 152 | void UpdateDPI() |
1504 | @@ -143,8 +154,10 @@ | |||
1505 | 143 | for (int i = 0; i < (int)em_converters_.size(); ++i) | 154 | for (int i = 0; i < (int)em_converters_.size(); ++i) |
1506 | 144 | { | 155 | { |
1507 | 145 | int dpi = GetDPI(i); | 156 | int dpi = GetDPI(i); |
1509 | 146 | em_converters_[i].SetDPI(dpi); | 157 | em_converters_[i]->SetDPI(dpi); |
1510 | 147 | } | 158 | } |
1511 | 159 | |||
1512 | 160 | parent_->dpi_changed.emit(); | ||
1513 | 148 | } | 161 | } |
1514 | 149 | 162 | ||
1515 | 150 | void UpdateEMConverter() | 163 | void UpdateEMConverter() |
1516 | @@ -155,6 +168,7 @@ | |||
1517 | 155 | 168 | ||
1518 | 156 | Settings* parent_; | 169 | Settings* parent_; |
1519 | 157 | glib::Object<GSettings> gsettings_; | 170 | glib::Object<GSettings> gsettings_; |
1520 | 171 | glib::Object<GSettings> gnome_settings_; | ||
1521 | 158 | FormFactor cached_form_factor_; | 172 | FormFactor cached_form_factor_; |
1522 | 159 | bool cached_double_click_activate_; | 173 | bool cached_double_click_activate_; |
1523 | 160 | bool lowGfx_; | 174 | bool lowGfx_; |
1524 | @@ -162,7 +176,8 @@ | |||
1525 | 162 | glib::Signal<void, GSettings*, gchar* > form_factor_changed_; | 176 | glib::Signal<void, GSettings*, gchar* > form_factor_changed_; |
1526 | 163 | glib::Signal<void, GSettings*, gchar* > double_click_activate_changed_; | 177 | glib::Signal<void, GSettings*, gchar* > double_click_activate_changed_; |
1527 | 164 | 178 | ||
1529 | 165 | std::vector<EMConverter> em_converters_; | 179 | glib::SignalManager signals_; |
1530 | 180 | std::vector<EMConverter::Ptr> em_converters_; | ||
1531 | 166 | }; | 181 | }; |
1532 | 167 | 182 | ||
1533 | 168 | // | 183 | // |
1534 | @@ -215,7 +230,7 @@ | |||
1535 | 215 | pimpl->lowGfx_ = low_gfx; | 230 | pimpl->lowGfx_ = low_gfx; |
1536 | 216 | } | 231 | } |
1537 | 217 | 232 | ||
1539 | 218 | EMConverter const& Settings::em(int monitor) const | 233 | EMConverter::Ptr const& Settings::em(int monitor) const |
1540 | 219 | { | 234 | { |
1541 | 220 | if (monitor < 0 || monitor >= (int)monitors::MAX) | 235 | if (monitor < 0 || monitor >= (int)monitors::MAX) |
1542 | 221 | { | 236 | { |
1543 | 222 | 237 | ||
1544 | === modified file 'unity-shared/UnitySettings.h' | |||
1545 | --- unity-shared/UnitySettings.h 2014-01-31 21:01:53 +0000 | |||
1546 | +++ unity-shared/UnitySettings.h 2014-02-19 01:47:39 +0000 | |||
1547 | @@ -51,7 +51,8 @@ | |||
1548 | 51 | nux::Property<bool> is_standalone; | 51 | nux::Property<bool> is_standalone; |
1549 | 52 | nux::ROProperty<bool> double_click_activate; | 52 | nux::ROProperty<bool> double_click_activate; |
1550 | 53 | 53 | ||
1552 | 54 | EMConverter const& em(int monitor = 0) const; | 54 | sigc::signal<void> dpi_changed; |
1553 | 55 | EMConverter::Ptr const& em(int monitor = 0) const; | ||
1554 | 55 | 56 | ||
1555 | 56 | private: | 57 | private: |
1556 | 57 | class Impl; | 58 | class Impl; |
1557 | 58 | 59 | ||
1558 | === modified file 'unity-shared/WindowButtonPriv.h' | |||
1559 | --- unity-shared/WindowButtonPriv.h 2014-01-14 13:13:11 +0000 | |||
1560 | +++ unity-shared/WindowButtonPriv.h 2014-02-19 01:47:39 +0000 | |||
1561 | @@ -24,9 +24,11 @@ | |||
1562 | 24 | #include <Nux/Button.h> | 24 | #include <Nux/Button.h> |
1563 | 25 | 25 | ||
1564 | 26 | #include "unity-shared/DecorationStyle.h" | 26 | #include "unity-shared/DecorationStyle.h" |
1565 | 27 | #include "unity-shared/Introspectable.h" | ||
1566 | 27 | #include "unity-shared/PanelStyle.h" | 28 | #include "unity-shared/PanelStyle.h" |
1567 | 29 | #include "unity-shared/RawPixel.h" | ||
1568 | 28 | #include "unity-shared/UBusWrapper.h" | 30 | #include "unity-shared/UBusWrapper.h" |
1570 | 29 | #include "unity-shared/Introspectable.h" | 31 | #include "unity-shared/UnitySettings.h" |
1571 | 30 | 32 | ||
1572 | 31 | namespace unity | 33 | namespace unity |
1573 | 32 | { | 34 | { |
1574 | @@ -44,6 +46,9 @@ | |||
1575 | 44 | panel::WindowButtonType GetType() const; | 46 | panel::WindowButtonType GetType() const; |
1576 | 45 | void SetVisualState(nux::ButtonVisualState new_state); | 47 | void SetVisualState(nux::ButtonVisualState new_state); |
1577 | 46 | 48 | ||
1578 | 49 | void OnMonitorChanged(int monitor); | ||
1579 | 50 | void UpdateDPIChanged(); | ||
1580 | 51 | |||
1581 | 47 | nux::RWProperty<bool> enabled; | 52 | nux::RWProperty<bool> enabled; |
1582 | 48 | nux::Property<bool> overlay_mode; | 53 | nux::Property<bool> overlay_mode; |
1583 | 49 | 54 | ||
1584 | @@ -58,6 +63,8 @@ | |||
1585 | 58 | bool EnabledSetter(bool enabled); | 63 | bool EnabledSetter(bool enabled); |
1586 | 59 | static nux::ObjectPtr<nux::BaseTexture> GetDashWindowButton(panel::WindowButtonType type, panel::WindowState state); | 64 | static nux::ObjectPtr<nux::BaseTexture> GetDashWindowButton(panel::WindowButtonType type, panel::WindowState state); |
1587 | 60 | 65 | ||
1588 | 66 | void UpdateGeometry(); | ||
1589 | 67 | |||
1590 | 61 | inline WindowButtons* Parent() const | 68 | inline WindowButtons* Parent() const |
1591 | 62 | { | 69 | { |
1592 | 63 | return static_cast<WindowButtons*>(GetParentObject()); | 70 | return static_cast<WindowButtons*>(GetParentObject()); |
1593 | @@ -66,6 +73,9 @@ | |||
1594 | 66 | private: | 73 | private: |
1595 | 67 | panel::WindowButtonType type_; | 74 | panel::WindowButtonType type_; |
1596 | 68 | 75 | ||
1597 | 76 | int monitor_; | ||
1598 | 77 | EMConverter::Ptr cv_; | ||
1599 | 78 | |||
1600 | 69 | nux::ObjectPtr<nux::BaseTexture> normal_tex_; | 79 | nux::ObjectPtr<nux::BaseTexture> normal_tex_; |
1601 | 70 | nux::ObjectPtr<nux::BaseTexture> prelight_tex_; | 80 | nux::ObjectPtr<nux::BaseTexture> prelight_tex_; |
1602 | 71 | nux::ObjectPtr<nux::BaseTexture> pressed_tex_; | 81 | nux::ObjectPtr<nux::BaseTexture> pressed_tex_; |
1603 | 72 | 82 | ||
1604 | === modified file 'unity-shared/WindowButtons.cpp' | |||
1605 | --- unity-shared/WindowButtons.cpp 2014-02-15 17:33:02 +0000 | |||
1606 | +++ unity-shared/WindowButtons.cpp 2014-02-19 01:47:39 +0000 | |||
1607 | @@ -43,11 +43,25 @@ | |||
1608 | 43 | sigc::mem_fun(this, &WindowButton::EnabledSetter)) | 43 | sigc::mem_fun(this, &WindowButton::EnabledSetter)) |
1609 | 44 | , overlay_mode(false) | 44 | , overlay_mode(false) |
1610 | 45 | , type_(type) | 45 | , type_(type) |
1611 | 46 | , monitor_(0) | ||
1612 | 47 | , cv_(unity::Settings::Instance().em(0)) | ||
1613 | 46 | { | 48 | { |
1614 | 47 | overlay_mode.changed.connect([this] (bool) { UpdateSize(); QueueDraw(); }); | 49 | overlay_mode.changed.connect([this] (bool) { UpdateSize(); QueueDraw(); }); |
1615 | 48 | SetAcceptKeyNavFocusOnMouseDown(false); | 50 | SetAcceptKeyNavFocusOnMouseDown(false); |
1616 | 49 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &WindowButton::LoadImages)); | 51 | panel::Style::Instance().changed.connect(sigc::mem_fun(this, &WindowButton::LoadImages)); |
1618 | 50 | LoadImages(); | 52 | |
1619 | 53 | LoadImages(); | ||
1620 | 54 | } | ||
1621 | 55 | |||
1622 | 56 | void WindowButton::UpdateDPIChanged() | ||
1623 | 57 | { | ||
1624 | 58 | LoadImages(); | ||
1625 | 59 | } | ||
1626 | 60 | |||
1627 | 61 | void WindowButton::OnMonitorChanged(int monitor) | ||
1628 | 62 | { | ||
1629 | 63 | monitor_ = monitor; | ||
1630 | 64 | cv_ = unity::Settings::Instance().em(monitor); | ||
1631 | 51 | } | 65 | } |
1632 | 52 | 66 | ||
1633 | 53 | void WindowButton::SetVisualState(nux::ButtonVisualState new_state) | 67 | void WindowButton::SetVisualState(nux::ButtonVisualState new_state) |
1634 | @@ -133,7 +147,7 @@ | |||
1635 | 133 | 147 | ||
1636 | 134 | void WindowButton::UpdateSize() | 148 | void WindowButton::UpdateSize() |
1637 | 135 | { | 149 | { |
1639 | 136 | int panel_height = panel::Style::Instance().panel_height; | 150 | int panel_height = panel::Style::Instance().PanelHeight(monitor_); |
1640 | 137 | nux::BaseTexture* tex; | 151 | nux::BaseTexture* tex; |
1641 | 138 | tex = (overlay_mode()) ? normal_dash_tex_.GetPointer() : normal_tex_.GetPointer(); | 152 | tex = (overlay_mode()) ? normal_dash_tex_.GetPointer() : normal_tex_.GetPointer(); |
1642 | 139 | int width = 0; | 153 | int width = 0; |
1643 | @@ -141,8 +155,10 @@ | |||
1644 | 141 | 155 | ||
1645 | 142 | if (tex) | 156 | if (tex) |
1646 | 143 | { | 157 | { |
1649 | 144 | width = std::min(panel_height, tex->GetWidth()); | 158 | int tex_w = RawPixel(tex->GetWidth()).CP(cv_); |
1650 | 145 | height = std::min(panel_height, tex->GetHeight()); | 159 | int tex_h = RawPixel(tex->GetHeight()).CP(cv_); |
1651 | 160 | width = std::min(panel_height, tex_w); | ||
1652 | 161 | height = std::min(panel_height, tex_h); | ||
1653 | 146 | } | 162 | } |
1654 | 147 | 163 | ||
1655 | 148 | SetMinMaxSize(width, height); | 164 | SetMinMaxSize(width, height); |
1656 | @@ -321,6 +337,20 @@ | |||
1657 | 321 | WindowManager::Default().terminate_spread.connect(sigc::mem_fun(this, &WindowButtons::OnSpreadTerminate)); | 337 | WindowManager::Default().terminate_spread.connect(sigc::mem_fun(this, &WindowButtons::OnSpreadTerminate)); |
1658 | 322 | } | 338 | } |
1659 | 323 | 339 | ||
1660 | 340 | |||
1661 | 341 | void WindowButtons::UpdateDPIChanged() | ||
1662 | 342 | { | ||
1663 | 343 | for (auto area : GetChildren()) | ||
1664 | 344 | static_cast<internal::WindowButton*>(area)->UpdateDPIChanged(); | ||
1665 | 345 | } | ||
1666 | 346 | |||
1667 | 347 | void WindowButtons::OnMonitorChanged(int monitor) | ||
1668 | 348 | { | ||
1669 | 349 | // Need to update the EMConverter in each window button if the monitor changes | ||
1670 | 350 | for (auto area : GetChildren()) | ||
1671 | 351 | static_cast<internal::WindowButton*>(area)->OnMonitorChanged(monitor); | ||
1672 | 352 | } | ||
1673 | 353 | |||
1674 | 324 | nux::Area* WindowButtons::FindAreaUnderMouse(const nux::Point& mouse, nux::NuxEventType event_type) | 354 | nux::Area* WindowButtons::FindAreaUnderMouse(const nux::Point& mouse, nux::NuxEventType event_type) |
1675 | 325 | { | 355 | { |
1676 | 326 | if (!GetInputEventSensitivity()) | 356 | if (!GetInputEventSensitivity()) |
1677 | 327 | 357 | ||
1678 | === modified file 'unity-shared/WindowButtons.h' | |||
1679 | --- unity-shared/WindowButtons.h 2014-02-15 17:33:02 +0000 | |||
1680 | +++ unity-shared/WindowButtons.h 2014-02-19 01:47:39 +0000 | |||
1681 | @@ -44,6 +44,7 @@ | |||
1682 | 44 | nux::Property<bool> focused; | 44 | nux::Property<bool> focused; |
1683 | 45 | 45 | ||
1684 | 46 | bool IsMouseOwner(); | 46 | bool IsMouseOwner(); |
1685 | 47 | void UpdateDPIChanged(); | ||
1686 | 47 | virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_pos, nux::NuxEventType event_type); | 48 | virtual nux::Area* FindAreaUnderMouse(const nux::Point& mouse_pos, nux::NuxEventType event_type); |
1687 | 48 | 49 | ||
1688 | 49 | sigc::signal<void> close_clicked; | 50 | sigc::signal<void> close_clicked; |
1689 | @@ -71,6 +72,7 @@ | |||
1690 | 71 | void OnControlledWindowChanged(Window xid); | 72 | void OnControlledWindowChanged(Window xid); |
1691 | 72 | void ResetNormalButtonState(); | 73 | void ResetNormalButtonState(); |
1692 | 73 | bool OpacitySetter(double& target, double new_value); | 74 | bool OpacitySetter(double& target, double new_value); |
1693 | 75 | void OnMonitorChanged(int monitor); | ||
1694 | 74 | 76 | ||
1695 | 75 | std::string active_overlay_; | 77 | std::string active_overlay_; |
1696 | 76 | UBusManager ubus_manager_; | 78 | UBusManager ubus_manager_; |
1697 | 77 | 79 | ||
1698 | === modified file 'unity-shared/WindowManager.h' | |||
1699 | --- unity-shared/WindowManager.h 2014-02-14 03:05:02 +0000 | |||
1700 | +++ unity-shared/WindowManager.h 2014-02-19 01:47:39 +0000 | |||
1701 | @@ -77,6 +77,7 @@ | |||
1702 | 77 | virtual Window GetActiveWindow() const = 0; | 77 | virtual Window GetActiveWindow() const = 0; |
1703 | 78 | virtual std::vector<Window> GetWindowsInStackingOrder() const = 0; | 78 | virtual std::vector<Window> GetWindowsInStackingOrder() const = 0; |
1704 | 79 | 79 | ||
1705 | 80 | virtual int MonitorGeometryIn(nux::Geometry const& geo) const = 0; | ||
1706 | 80 | virtual bool IsTopWindowFullscreenOnMonitorWithMouse() const = 0; | 81 | virtual bool IsTopWindowFullscreenOnMonitorWithMouse() const = 0; |
1707 | 81 | 82 | ||
1708 | 82 | virtual bool IsWindowMaximized(Window window_id) const = 0; | 83 | virtual bool IsWindowMaximized(Window window_id) const = 0; |
PASSED: Continuous integration, rev:3903 jenkins. qa.ubuntu. com/job/ unity-ci/ 570/ jenkins. qa.ubuntu. com/job/ unity-trusty- amd64-ci/ 106 jenkins. qa.ubuntu. com/job/ unity-trusty- armhf-ci/ 102 jenkins. qa.ubuntu. com/job/ unity-trusty- i386-ci/ 104
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- ci/570/ rebuild
http://