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
1=== modified file 'plugins/unityshell/src/AbstractLauncherIcon.h'
2--- plugins/unityshell/src/AbstractLauncherIcon.h 2011-09-13 22:06:17 +0000
3+++ plugins/unityshell/src/AbstractLauncherIcon.h 2011-09-27 03:44:24 +0000
4@@ -152,7 +152,7 @@
5
6 virtual bool ShowInSwitcher() = 0;
7
8- virtual unsigned int SwitcherPriority() = 0;
9+ virtual unsigned long long SwitcherPriority() = 0;
10
11 virtual bool GetQuirk(Quirk quirk) = 0;
12
13
14=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
15--- plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-26 10:58:35 +0000
16+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2011-09-27 03:44:24 +0000
17@@ -1167,12 +1167,12 @@
18 return GetQuirk(QUIRK_RUNNING) && GetQuirk(QUIRK_VISIBLE);
19 }
20
21-unsigned int
22+unsigned long long
23 BamfLauncherIcon::SwitcherPriority()
24 {
25 GList* children, *l;
26 BamfView* view;
27- unsigned int result = 0;
28+ unsigned long long result = 0;
29
30 children = bamf_view_get_children(BAMF_VIEW(m_App));
31
32
33=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
34--- plugins/unityshell/src/BamfLauncherIcon.h 2011-09-22 15:14:00 +0000
35+++ plugins/unityshell/src/BamfLauncherIcon.h 2011-09-27 03:44:24 +0000
36@@ -47,7 +47,7 @@
37 void ActivateLauncherIcon(ActionArg arg);
38
39 virtual bool ShowInSwitcher();
40- virtual unsigned int SwitcherPriority();
41+ virtual unsigned long long SwitcherPriority();
42
43 std::vector<Window> RelatedXids ();
44
45
46=== modified file 'plugins/unityshell/src/LauncherIcon.h'
47--- plugins/unityshell/src/LauncherIcon.h 2011-09-15 17:46:44 +0000
48+++ plugins/unityshell/src/LauncherIcon.h 2011-09-27 03:44:24 +0000
49@@ -126,7 +126,7 @@
50 return false;
51 };
52
53- virtual unsigned int SwitcherPriority()
54+ virtual unsigned long long SwitcherPriority()
55 {
56 return 0;
57 }
58
59=== modified file 'plugins/unityshell/src/MockLauncherIcon.h'
60--- plugins/unityshell/src/MockLauncherIcon.h 2011-09-20 01:38:21 +0000
61+++ plugins/unityshell/src/MockLauncherIcon.h 2011-09-27 03:44:24 +0000
62@@ -133,7 +133,7 @@
63 return true;
64 }
65
66- unsigned int SwitcherPriority()
67+ unsigned long long SwitcherPriority()
68 {
69 return 0;
70 }
71
72=== modified file 'plugins/unityshell/src/PluginAdapter.cpp'
73--- plugins/unityshell/src/PluginAdapter.cpp 2011-09-23 00:49:51 +0000
74+++ plugins/unityshell/src/PluginAdapter.cpp 2011-09-27 03:44:24 +0000
75@@ -69,6 +69,7 @@
76 _grab_hide_action = 0;
77 _grab_toggle_action = 0;
78 _coverage_area_before_automaximize = 0.75;
79+ bias_active_to_viewport = false;
80 }
81
82 PluginAdapter::~PluginAdapter()
83@@ -271,7 +272,7 @@
84 }
85 }
86
87-unsigned int
88+unsigned long long
89 PluginAdapter::GetWindowActiveNumber (guint32 xid)
90 {
91 Window win = (Window)xid;
92@@ -281,7 +282,12 @@
93
94 if (window)
95 {
96- return window->activeNum ();
97+ // result is actually an unsigned int (32 bits)
98+ unsigned long long result = window->activeNum ();
99+ if (bias_active_to_viewport() && window->defaultViewport() == m_Screen->vp())
100+ result = result << 32;
101+
102+ return result;
103 }
104
105 return 0;
106
107=== modified file 'plugins/unityshell/src/PluginAdapter.h'
108--- plugins/unityshell/src/PluginAdapter.h 2011-09-21 03:40:33 +0000
109+++ plugins/unityshell/src/PluginAdapter.h 2011-09-27 03:44:24 +0000
110@@ -64,6 +64,8 @@
111
112 static void Initialize(CompScreen* screen);
113
114+ nux::Property<bool> bias_active_to_viewport;
115+
116 ~PluginAdapter();
117
118 void SetScaleAction(MultiActionList& scale);
119@@ -130,7 +132,7 @@
120 bool IsScreenGrabbed();
121 bool IsViewPortSwitchStarted();
122
123- unsigned int GetWindowActiveNumber (guint32 xid);
124+ unsigned long long GetWindowActiveNumber (guint32 xid);
125
126 void MaximizeIfBigEnough(CompWindow* window);
127
128
129=== modified file 'plugins/unityshell/src/WindowManager.cpp'
130--- plugins/unityshell/src/WindowManager.cpp 2011-09-23 00:49:51 +0000
131+++ plugins/unityshell/src/WindowManager.cpp 2011-09-27 03:44:24 +0000
132@@ -23,7 +23,7 @@
133
134 class WindowManagerDummy : public WindowManager
135 {
136- unsigned int GetWindowActiveNumber (guint32 xid)
137+ unsigned long long GetWindowActiveNumber (guint32 xid)
138 {
139 return 0;
140 }
141
142=== modified file 'plugins/unityshell/src/WindowManager.h'
143--- plugins/unityshell/src/WindowManager.h 2011-09-19 16:36:21 +0000
144+++ plugins/unityshell/src/WindowManager.h 2011-09-27 03:44:24 +0000
145@@ -84,7 +84,7 @@
146 virtual nux::Geometry GetWindowGeometry(guint32 xid) = 0;
147 virtual nux::Geometry GetScreenGeometry() = 0;
148
149- virtual unsigned int GetWindowActiveNumber (guint32 xid) = 0;
150+ virtual unsigned long long GetWindowActiveNumber (guint32 xid) = 0;
151
152 virtual void SetWindowIconGeometry(Window window, nux::Geometry const& geo) = 0;
153
154
155=== modified file 'plugins/unityshell/src/unityshell.cpp'
156--- plugins/unityshell/src/unityshell.cpp 2011-09-26 07:34:11 +0000
157+++ plugins/unityshell/src/unityshell.cpp 2011-09-27 03:44:24 +0000
158@@ -254,6 +254,7 @@
159 optionSetLauncherRevealEdgeTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
160 optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
161 optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
162+ optionSetAltTabBiasViewportNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
163
164 optionSetAltTabForwardInitiate(boost::bind(&UnityScreen::altTabForwardInitiate, this, _1, _2, _3));
165 optionSetAltTabForwardTerminate(boost::bind(&UnityScreen::altTabTerminateCommon, this, _1, _2, _3));
166@@ -1877,6 +1878,8 @@
167 break;
168 case UnityshellOptions::AltTabTimeout:
169 switcherController->detail_on_timeout = optionGetAltTabTimeout();
170+ case UnityshellOptions::AltTabBiasViewport:
171+ PluginAdapter::Default()->bias_active_to_viewport = optionGetAltTabBiasViewport();
172 break;
173 case UnityshellOptions::ShowMinimizedWindows:
174 compiz::CompizMinimizedWindowHandler<UnityScreen, UnityWindow>::setFunctions (optionGetShowMinimizedWindows ());
175
176=== modified file 'plugins/unityshell/unityshell.xml.in'
177--- plugins/unityshell/unityshell.xml.in 2011-09-14 23:28:26 +0000
178+++ plugins/unityshell/unityshell.xml.in 2011-09-27 03:44:24 +0000
179@@ -105,6 +105,11 @@
180 <_long>fixme</_long>
181 <default>true</default>
182 </option>
183+ <option name="alt_tab_bias_viewport" type="bool">
184+ <_short>Bias alt-tab sorting to prefer windows on the current viewport</_short>
185+ <_long>fixme</_long>
186+ <default>false</default>
187+ </option>
188 <option name="alt_tab_forward" type="key">
189 <_short>Key to start the switcher</_short>
190 <_long>fixme</_long>