Merge lp:~3v1n0/unity/expo-dnd-removal into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3148
Proposed branch: lp:~3v1n0/unity/expo-dnd-removal
Merge into: lp:unity
Prerequisite: lp:~3v1n0/unity/favorites-migration-hardcoded
Diff against target: 170 lines (+46/-6)
8 files modified
launcher/ExpoLauncherIcon.cpp (+5/-0)
launcher/ExpoLauncherIcon.h (+1/-0)
tests/test_expo_launcher_icon.cpp (+13/-4)
unity-shared/PluginAdapter.cpp (+20/-0)
unity-shared/PluginAdapter.h (+1/-0)
unity-shared/StandaloneWindowManager.cpp (+4/-1)
unity-shared/StandaloneWindowManager.h (+1/-1)
unity-shared/WindowManager.h (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/expo-dnd-removal
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+147724@code.launchpad.net

Commit message

ExpoLauncherIcon: Set the viewport size to 1,1 (i.e. diable workspaces) on icon Removal

Like when dragged to trash!

Description of the change

This is the last part of the so awaited saga "Launcher - Workspace switcher should not be in the Launcher by default".

Now dragging the WS icon to the trash, disables the workspaces.

It requires the compiz fix lp:~3v1n0/compiz/ccp-core-options-save-fix/+merge/147716 in order to work after a compiz reboot (i.e. to actually save the setting)

Tests added.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/ExpoLauncherIcon.cpp'
--- launcher/ExpoLauncherIcon.cpp 2012-12-03 16:09:51 +0000
+++ launcher/ExpoLauncherIcon.cpp 2013-02-11 17:32:24 +0000
@@ -66,6 +66,11 @@
66 }66 }
67}67}
6868
69void ExpoLauncherIcon::AboutToRemove()
70{
71 WindowManager::Default().SetViewportSize(1, 1);
72}
73
69void ExpoLauncherIcon::UpdateIcon()74void ExpoLauncherIcon::UpdateIcon()
70{75{
71 auto const& vp = WindowManager::Default().GetCurrentViewport();76 auto const& vp = WindowManager::Default().GetCurrentViewport();
7277
=== modified file 'launcher/ExpoLauncherIcon.h'
--- launcher/ExpoLauncherIcon.h 2012-12-03 15:34:23 +0000
+++ launcher/ExpoLauncherIcon.h 2013-02-11 17:32:24 +0000
@@ -32,6 +32,7 @@
32public:32public:
33 ExpoLauncherIcon();33 ExpoLauncherIcon();
34 void Stick(bool save);34 void Stick(bool save);
35 void AboutToRemove();
3536
36protected:37protected:
37 void ActivateLauncherIcon(ActionArg arg);38 void ActivateLauncherIcon(ActionArg arg);
3839
=== modified file 'tests/test_expo_launcher_icon.cpp'
--- tests/test_expo_launcher_icon.cpp 2012-12-03 16:09:51 +0000
+++ tests/test_expo_launcher_icon.cpp 2013-02-11 17:32:24 +0000
@@ -71,14 +71,14 @@
71 wm->SetCurrentViewport(nux::Point(0, 1));71 wm->SetCurrentViewport(nux::Point(0, 1));
72 wm->screen_viewport_switch_ended.emit();72 wm->screen_viewport_switch_ended.emit();
73 EXPECT_EQ(icon.icon_name, "workspace-switcher-left-bottom");73 EXPECT_EQ(icon.icon_name, "workspace-switcher-left-bottom");
74 74
75 wm->SetCurrentViewport(nux::Point(1, 1));75 wm->SetCurrentViewport(nux::Point(1, 1));
76 wm->screen_viewport_switch_ended.emit();76 wm->screen_viewport_switch_ended.emit();
77 EXPECT_EQ(icon.icon_name, "workspace-switcher-right-bottom");77 EXPECT_EQ(icon.icon_name, "workspace-switcher-right-bottom");
7878
79 wm->SetCurrentViewport(nux::Point(0, 0));79 wm->SetCurrentViewport(nux::Point(0, 0));
80 wm->screen_viewport_switch_ended.emit();80 wm->screen_viewport_switch_ended.emit();
81 EXPECT_EQ(icon.icon_name, "workspace-switcher-top-left"); 81 EXPECT_EQ(icon.icon_name, "workspace-switcher-top-left");
82}82}
8383
84TEST_F(TestExpoLauncherIcon, Icon2x2Layout_Expo)84TEST_F(TestExpoLauncherIcon, Icon2x2Layout_Expo)
@@ -92,14 +92,14 @@
92 wm->SetCurrentViewport(nux::Point(0, 1));92 wm->SetCurrentViewport(nux::Point(0, 1));
93 wm->terminate_expo.emit();93 wm->terminate_expo.emit();
94 EXPECT_EQ(icon.icon_name, "workspace-switcher-left-bottom");94 EXPECT_EQ(icon.icon_name, "workspace-switcher-left-bottom");
95 95
96 wm->SetCurrentViewport(nux::Point(1, 1));96 wm->SetCurrentViewport(nux::Point(1, 1));
97 wm->terminate_expo.emit();97 wm->terminate_expo.emit();
98 EXPECT_EQ(icon.icon_name, "workspace-switcher-right-bottom");98 EXPECT_EQ(icon.icon_name, "workspace-switcher-right-bottom");
9999
100 wm->SetCurrentViewport(nux::Point(0, 0));100 wm->SetCurrentViewport(nux::Point(0, 0));
101 wm->terminate_expo.emit();101 wm->terminate_expo.emit();
102 EXPECT_EQ(icon.icon_name, "workspace-switcher-top-left"); 102 EXPECT_EQ(icon.icon_name, "workspace-switcher-top-left");
103}103}
104104
105TEST_F(TestExpoLauncherIcon, IconNot2x2Layout)105TEST_F(TestExpoLauncherIcon, IconNot2x2Layout)
@@ -116,4 +116,13 @@
116 EXPECT_EQ(icon.icon_name, "workspace-switcher-top-left");116 EXPECT_EQ(icon.icon_name, "workspace-switcher-top-left");
117}117}
118118
119TEST_F(TestExpoLauncherIcon, AboutToRemoveDisablesViewport)
120{
121 wm->SetViewportSize(2, 2);
122
123 icon.AboutToRemove();
124 EXPECT_EQ(wm->GetViewportHSize(), 1);
125 EXPECT_EQ(wm->GetViewportVSize(), 1);
126}
127
119}128}
120129
=== modified file 'unity-shared/PluginAdapter.cpp'
--- unity-shared/PluginAdapter.cpp 2013-02-04 23:09:24 +0000
+++ unity-shared/PluginAdapter.cpp 2013-02-11 17:32:24 +0000
@@ -1113,6 +1113,26 @@
1113 return nux::Point(vp.x(), vp.y());1113 return nux::Point(vp.x(), vp.y());
1114}1114}
11151115
1116void PluginAdapter::SetViewportSize(int horizontal, int vertical)
1117{
1118 if (horizontal < 1 || vertical < 1)
1119 {
1120 LOG_ERROR(logger) << "Impossible to set viewport to invalid values "
1121 << horizontal << "x" << vertical;
1122 return;
1123 }
1124
1125 CompOption::Value hsize;
1126 hsize.set<int>(horizontal);
1127 m_Screen->setOptionForPlugin("core", "hsize", hsize);
1128
1129 CompOption::Value vsize(vertical);
1130 vsize.set<int>(vertical);
1131 m_Screen->setOptionForPlugin("core", "vsize", vsize);
1132
1133 LOG_INFO(logger) << "Setting viewport size to " << hsize.i() << "x" << vsize.i();
1134}
1135
1116int PluginAdapter::GetViewportHSize() const1136int PluginAdapter::GetViewportHSize() const
1117{1137{
1118 return m_Screen->vpSize().width();1138 return m_Screen->vpSize().width();
11191139
=== modified file 'unity-shared/PluginAdapter.h'
--- unity-shared/PluginAdapter.h 2013-02-04 23:09:24 +0000
+++ unity-shared/PluginAdapter.h 2013-02-11 17:32:24 +0000
@@ -180,6 +180,7 @@
180 int WorkspaceCount() const;180 int WorkspaceCount() const;
181181
182 nux::Point GetCurrentViewport() const override;182 nux::Point GetCurrentViewport() const override;
183 void SetViewportSize(int horizontal, int vertical) override;
183 int GetViewportHSize() const override;184 int GetViewportHSize() const override;
184 int GetViewportVSize() const override;185 int GetViewportVSize() const override;
185186
186187
=== modified file 'unity-shared/StandaloneWindowManager.cpp'
--- unity-shared/StandaloneWindowManager.cpp 2013-02-05 21:12:51 +0000
+++ unity-shared/StandaloneWindowManager.cpp 2013-02-11 17:32:24 +0000
@@ -492,8 +492,11 @@
492{492{
493}493}
494494
495void StandaloneWindowManager::SetViewportSize(unsigned horizontal, unsigned vertical)495void StandaloneWindowManager::SetViewportSize(int horizontal, int vertical)
496{496{
497 if (horizontal < 1 || vertical < 1)
498 return;
499
497 nux::Size new_size(horizontal, vertical);500 nux::Size new_size(horizontal, vertical);
498501
499 if (viewport_size_ == new_size)502 if (viewport_size_ == new_size)
500503
=== modified file 'unity-shared/StandaloneWindowManager.h'
--- unity-shared/StandaloneWindowManager.h 2013-02-04 23:15:07 +0000
+++ unity-shared/StandaloneWindowManager.h 2013-02-11 17:32:24 +0000
@@ -136,6 +136,7 @@
136 virtual int WorkspaceCount() const;136 virtual int WorkspaceCount() const;
137137
138 nux::Point GetCurrentViewport() const override;138 nux::Point GetCurrentViewport() const override;
139 void SetViewportSize(int horizontal, int vertical);
139 int GetViewportHSize() const override;140 int GetViewportHSize() const override;
140 int GetViewportVSize() const override;141 int GetViewportVSize() const override;
141142
@@ -152,7 +153,6 @@
152 void SetScaleActiveForGroup(bool scale_active_for_group);153 void SetScaleActiveForGroup(bool scale_active_for_group);
153 void SetCurrentDesktop(unsigned desktop_id);154 void SetCurrentDesktop(unsigned desktop_id);
154155
155 void SetViewportSize(unsigned horizontal, unsigned vertical);
156 void SetCurrentViewport(nux::Point const& vp);156 void SetCurrentViewport(nux::Point const& vp);
157 void SetWorkareaGeometry(nux::Geometry const& geo);157 void SetWorkareaGeometry(nux::Geometry const& geo);
158158
159159
=== modified file 'unity-shared/WindowManager.h'
--- unity-shared/WindowManager.h 2013-02-04 23:09:24 +0000
+++ unity-shared/WindowManager.h 2013-02-11 17:32:24 +0000
@@ -145,6 +145,7 @@
145 virtual int WorkspaceCount() const = 0;145 virtual int WorkspaceCount() const = 0;
146146
147 virtual nux::Point GetCurrentViewport() const = 0;147 virtual nux::Point GetCurrentViewport() const = 0;
148 virtual void SetViewportSize(int horizontal, int vertical) = 0;
148 virtual int GetViewportHSize() const = 0;149 virtual int GetViewportHSize() const = 0;
149 virtual int GetViewportVSize() const = 0;150 virtual int GetViewportVSize() const = 0;
150151