Merge lp:~unity-team/unity/unity.viewport-bias into lp:unity

Proposed by Jason Smith
Status: Merged
Merged at revision: 1632
Proposed branch: lp:~unity-team/unity/unity.viewport-bias
Merge into: lp:unity
Diff against target: 190 lines (+27/-11)
11 files modified
plugins/unityshell/src/AbstractLauncherIcon.h (+1/-1)
plugins/unityshell/src/BamfLauncherIcon.cpp (+2/-2)
plugins/unityshell/src/BamfLauncherIcon.h (+1/-1)
plugins/unityshell/src/LauncherIcon.h (+1/-1)
plugins/unityshell/src/MockLauncherIcon.h (+1/-1)
plugins/unityshell/src/PluginAdapter.cpp (+8/-2)
plugins/unityshell/src/PluginAdapter.h (+3/-1)
plugins/unityshell/src/WindowManager.cpp (+1/-1)
plugins/unityshell/src/WindowManager.h (+1/-1)
plugins/unityshell/src/unityshell.cpp (+3/-0)
plugins/unityshell/unityshell.xml.in (+5/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.viewport-bias
Reviewer Review Type Date Requested Status
Sam Spilsbury (community) Needs Fixing
Tim Penhey (community) Approve
Review via email: mp+77088@code.launchpad.net

Description of the change

Adds an option to allow alt-tab to bias towards the current viewport rather than globally. Net effect is a behavior much closer to natty alt-tab

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Seems reasonable on first glance.

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> result = result << 32;

That doesn't work on some compilers. If you want the high bit you should use << 31

review: Needs Fixing
Revision history for this message
Tim Penhey (thumper) wrote :

Sam, that works fine with G++ on an unsigned long long which is guaranteed to be 64 bit.

Note that this is shift left, not trying to get the high bit.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/AbstractLauncherIcon.h'
--- plugins/unityshell/src/AbstractLauncherIcon.h 2011-09-13 22:06:17 +0000
+++ plugins/unityshell/src/AbstractLauncherIcon.h 2011-09-27 03:44:24 +0000
@@ -152,7 +152,7 @@
152152
153 virtual bool ShowInSwitcher() = 0;153 virtual bool ShowInSwitcher() = 0;
154154
155 virtual unsigned int SwitcherPriority() = 0;155 virtual unsigned long long SwitcherPriority() = 0;
156156
157 virtual bool GetQuirk(Quirk quirk) = 0;157 virtual bool GetQuirk(Quirk quirk) = 0;
158158
159159
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
--- plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-26 10:58:35 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-27 03:44:24 +0000
@@ -1167,12 +1167,12 @@
1167 return GetQuirk(QUIRK_RUNNING) && GetQuirk(QUIRK_VISIBLE);1167 return GetQuirk(QUIRK_RUNNING) && GetQuirk(QUIRK_VISIBLE);
1168}1168}
11691169
1170unsigned int1170unsigned long long
1171BamfLauncherIcon::SwitcherPriority()1171BamfLauncherIcon::SwitcherPriority()
1172{1172{
1173 GList* children, *l;1173 GList* children, *l;
1174 BamfView* view;1174 BamfView* view;
1175 unsigned int result = 0;1175 unsigned long long result = 0;
11761176
1177 children = bamf_view_get_children(BAMF_VIEW(m_App));1177 children = bamf_view_get_children(BAMF_VIEW(m_App));
11781178
11791179
=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
--- plugins/unityshell/src/BamfLauncherIcon.h 2011-09-22 15:14:00 +0000
+++ plugins/unityshell/src/BamfLauncherIcon.h 2011-09-27 03:44:24 +0000
@@ -47,7 +47,7 @@
47 void ActivateLauncherIcon(ActionArg arg);47 void ActivateLauncherIcon(ActionArg arg);
4848
49 virtual bool ShowInSwitcher();49 virtual bool ShowInSwitcher();
50 virtual unsigned int SwitcherPriority();50 virtual unsigned long long SwitcherPriority();
5151
52 std::vector<Window> RelatedXids ();52 std::vector<Window> RelatedXids ();
5353
5454
=== modified file 'plugins/unityshell/src/LauncherIcon.h'
--- plugins/unityshell/src/LauncherIcon.h 2011-09-15 17:46:44 +0000
+++ plugins/unityshell/src/LauncherIcon.h 2011-09-27 03:44:24 +0000
@@ -126,7 +126,7 @@
126 return false;126 return false;
127 };127 };
128128
129 virtual unsigned int SwitcherPriority()129 virtual unsigned long long SwitcherPriority()
130 {130 {
131 return 0;131 return 0;
132 }132 }
133133
=== modified file 'plugins/unityshell/src/MockLauncherIcon.h'
--- plugins/unityshell/src/MockLauncherIcon.h 2011-09-20 01:38:21 +0000
+++ plugins/unityshell/src/MockLauncherIcon.h 2011-09-27 03:44:24 +0000
@@ -133,7 +133,7 @@
133 return true;133 return true;
134 }134 }
135135
136 unsigned int SwitcherPriority()136 unsigned long long SwitcherPriority()
137 {137 {
138 return 0;138 return 0;
139 }139 }
140140
=== modified file 'plugins/unityshell/src/PluginAdapter.cpp'
--- plugins/unityshell/src/PluginAdapter.cpp 2011-09-23 00:49:51 +0000
+++ plugins/unityshell/src/PluginAdapter.cpp 2011-09-27 03:44:24 +0000
@@ -69,6 +69,7 @@
69 _grab_hide_action = 0;69 _grab_hide_action = 0;
70 _grab_toggle_action = 0;70 _grab_toggle_action = 0;
71 _coverage_area_before_automaximize = 0.75;71 _coverage_area_before_automaximize = 0.75;
72 bias_active_to_viewport = false;
72}73}
7374
74PluginAdapter::~PluginAdapter()75PluginAdapter::~PluginAdapter()
@@ -271,7 +272,7 @@
271 }272 }
272}273}
273274
274unsigned int 275unsigned long long
275PluginAdapter::GetWindowActiveNumber (guint32 xid)276PluginAdapter::GetWindowActiveNumber (guint32 xid)
276{277{
277 Window win = (Window)xid;278 Window win = (Window)xid;
@@ -281,7 +282,12 @@
281282
282 if (window)283 if (window)
283 {284 {
284 return window->activeNum ();285 // result is actually an unsigned int (32 bits)
286 unsigned long long result = window->activeNum ();
287 if (bias_active_to_viewport() && window->defaultViewport() == m_Screen->vp())
288 result = result << 32;
289
290 return result;
285 }291 }
286292
287 return 0;293 return 0;
288294
=== modified file 'plugins/unityshell/src/PluginAdapter.h'
--- plugins/unityshell/src/PluginAdapter.h 2011-09-21 03:40:33 +0000
+++ plugins/unityshell/src/PluginAdapter.h 2011-09-27 03:44:24 +0000
@@ -64,6 +64,8 @@
6464
65 static void Initialize(CompScreen* screen);65 static void Initialize(CompScreen* screen);
6666
67 nux::Property<bool> bias_active_to_viewport;
68
67 ~PluginAdapter();69 ~PluginAdapter();
6870
69 void SetScaleAction(MultiActionList& scale);71 void SetScaleAction(MultiActionList& scale);
@@ -130,7 +132,7 @@
130 bool IsScreenGrabbed();132 bool IsScreenGrabbed();
131 bool IsViewPortSwitchStarted();133 bool IsViewPortSwitchStarted();
132134
133 unsigned int GetWindowActiveNumber (guint32 xid);135 unsigned long long GetWindowActiveNumber (guint32 xid);
134136
135 void MaximizeIfBigEnough(CompWindow* window);137 void MaximizeIfBigEnough(CompWindow* window);
136138
137139
=== modified file 'plugins/unityshell/src/WindowManager.cpp'
--- plugins/unityshell/src/WindowManager.cpp 2011-09-23 00:49:51 +0000
+++ plugins/unityshell/src/WindowManager.cpp 2011-09-27 03:44:24 +0000
@@ -23,7 +23,7 @@
2323
24class WindowManagerDummy : public WindowManager24class WindowManagerDummy : public WindowManager
25{25{
26 unsigned int GetWindowActiveNumber (guint32 xid)26 unsigned long long GetWindowActiveNumber (guint32 xid)
27 {27 {
28 return 0;28 return 0;
29 }29 }
3030
=== modified file 'plugins/unityshell/src/WindowManager.h'
--- plugins/unityshell/src/WindowManager.h 2011-09-19 16:36:21 +0000
+++ plugins/unityshell/src/WindowManager.h 2011-09-27 03:44:24 +0000
@@ -84,7 +84,7 @@
84 virtual nux::Geometry GetWindowGeometry(guint32 xid) = 0;84 virtual nux::Geometry GetWindowGeometry(guint32 xid) = 0;
85 virtual nux::Geometry GetScreenGeometry() = 0;85 virtual nux::Geometry GetScreenGeometry() = 0;
8686
87 virtual unsigned int GetWindowActiveNumber (guint32 xid) = 0;87 virtual unsigned long long GetWindowActiveNumber (guint32 xid) = 0;
8888
89 virtual void SetWindowIconGeometry(Window window, nux::Geometry const& geo) = 0;89 virtual void SetWindowIconGeometry(Window window, nux::Geometry const& geo) = 0;
9090
9191
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2011-09-26 07:34:11 +0000
+++ plugins/unityshell/src/unityshell.cpp 2011-09-27 03:44:24 +0000
@@ -254,6 +254,7 @@
254 optionSetLauncherRevealEdgeTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));254 optionSetLauncherRevealEdgeTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
255 optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));255 optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
256 optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));256 optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
257 optionSetAltTabBiasViewportNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
257258
258 optionSetAltTabForwardInitiate(boost::bind(&UnityScreen::altTabForwardInitiate, this, _1, _2, _3));259 optionSetAltTabForwardInitiate(boost::bind(&UnityScreen::altTabForwardInitiate, this, _1, _2, _3));
259 optionSetAltTabForwardTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3));260 optionSetAltTabForwardTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3));
@@ -1877,6 +1878,8 @@
1877 break;1878 break;
1878 case UnityshellOptions::AltTabTimeout:1879 case UnityshellOptions::AltTabTimeout:
1879 switcherController->detail_on_timeout = optionGetAltTabTimeout();1880 switcherController->detail_on_timeout = optionGetAltTabTimeout();
1881 case UnityshellOptions::AltTabBiasViewport:
1882 PluginAdapter::Default()->bias_active_to_viewport = optionGetAltTabBiasViewport();
1880 break;1883 break;
1881 case UnityshellOptions::ShowMinimizedWindows:1884 case UnityshellOptions::ShowMinimizedWindows:
1882 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::setFunctions (optionGetShowMinimizedWindows ());1885 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::setFunctions (optionGetShowMinimizedWindows ());
18831886
=== modified file 'plugins/unityshell/unityshell.xml.in'
--- plugins/unityshell/unityshell.xml.in 2011-09-14 23:28:26 +0000
+++ plugins/unityshell/unityshell.xml.in 2011-09-27 03:44:24 +0000
@@ -105,6 +105,11 @@
105 <_long>fixme</_long>105 <_long>fixme</_long>
106 <default>true</default>106 <default>true</default>
107 </option>107 </option>
108 <option name="alt_tab_bias_viewport" type="bool">
109 <_short>Bias alt-tab sorting to prefer windows on the current viewport</_short>
110 <_long>fixme</_long>
111 <default>false</default>
112 </option>
108 <option name="alt_tab_forward" type="key">113 <option name="alt_tab_forward" type="key">
109 <_short>Key to start the switcher</_short>114 <_short>Key to start the switcher</_short>
110 <_long>fixme</_long>115 <_long>fixme</_long>