Merge lp:~ksamak/compiz/switcher_add_size_multiplier into lp:compiz/0.9.13

Proposed by ksamak
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 4070
Merged at revision: 4076
Proposed branch: lp:~ksamak/compiz/switcher_add_size_multiplier
Merge into: lp:compiz/0.9.13
Diff against target: 309 lines (+93/-55)
3 files modified
plugins/switcher/src/switcher.cpp (+73/-52)
plugins/switcher/src/switcher.h (+12/-3)
plugins/switcher/switcher.xml.in (+8/-0)
To merge this branch: bzr merge lp:~ksamak/compiz/switcher_add_size_multiplier
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
ksamak (community) Needs Resubmitting
Sam Spilsbury style, code, functionality Needs Fixing
Review via email: mp+299613@code.launchpad.net

This proposal supersedes a proposal from 2016-07-04.

Commit message

switcher: adds a size multiplier for A11Y purposes (sight impaired people)

Description of the change

this patch adds a size modifier to the base switcher, for sight impaired people.
It allows to set a variable in ccsm that will make the switchWindow bigger

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

I see some indentation issues, but a part from that it looks ok

Revision history for this message
ksamak (ksamak) wrote : Posted in a previous version of this proposal

On Tue, Jul 05, 2016 at 10:38:13AM -0000, Marco Trevisan (Treviño) wrote:
> I see some indentation issues, but a part from that it looks ok

You want me to have a look, and try to straighten that?
i guess should re-request a merge then.
--
Ksamak
hypra.fr Team

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

No need to re-request a merge. Just update this branch; MP will update automatically.

Just comment here once you've done.

Revision history for this message
ksamak (ksamak) wrote : Posted in a previous version of this proposal

indents modifs done.
I just remember i need to set noexpandtab in my vim. differences didn't appear in my buffer.
don't know if you can squash commits with bzr too (like in git) to get rid of parasite revisions.

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

Thanks for the patch ksamak. It is important that the existing plugins can accommodate users with a need to magnify on-screen widgets, so this is valuable work.

I've noted a few things which should be fixed before this is merged in.

As for squashing commits - it might be possible to do that, but it isn't recommended. Bazaar's history is intended to be immutable. After having used git for a few years, I'm not the biggest fan of this design, but it is what it is.

review: Needs Fixing (style, code, functionality)
Revision history for this message
Sam Spilsbury (smspillaz) :
4067. By ksamak <ksamak@ksalaptop>

switcher: fixed coding style, minor refactoring

4068. By ksamak <ksamak@ksalaptop>

switcher: fixed coding style

4069. By ksamak <ksamak@ksalaptop>

switcher: fixed indentation

Revision history for this message
ksamak (ksamak) wrote :

Hi sam, and thank you for the review.

I fixed the coding style, according to the original indents, although i don't fully understand why there could be eg: 4 spaces, then 2 tabs, then 2 spaces in some lines ;-)

I took into account your comments on float multiplications of course, i should have seen that on my own...
I also deleted the boolean flag switch, which appeared to work in one of my tests (in a VM), but was apparently a twitch in gsettings.

thanks again, hope this revision is up to standards.

review: Needs Resubmitting
4070. By ksamak <ksamak@ksalaptop>

switcher: fixed typo

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Fine for me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/switcher/src/switcher.cpp'
2--- plugins/switcher/src/switcher.cpp 2015-08-22 21:46:01 +0000
3+++ plugins/switcher/src/switcher.cpp 2016-07-20 09:53:18 +0000
4@@ -20,7 +20,9 @@
5 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
6 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
7 *
8- * Author: David Reveman <davidr@novell.com>
9+ * Author(s):
10+ * - David Reveman <davidr@novell.com>
11+ * - Auboyneau Vincent <ksamak@riseup.net> (size multiplier for A11Y)
12 */
13
14 #include "switcher.h"
15@@ -35,36 +37,6 @@
16
17 #define XWINDOWCHANGES_INIT {0, 0, 0, 0, 0, None, 0}
18
19-static float _boxVertices[] =
20-{
21- -(WIDTH >> 1), BOX_WIDTH, 0.0f,
22- (WIDTH >> 1), BOX_WIDTH, 0.0f,
23- -(WIDTH >> 1), 0.0f, 0.0f,
24- -(WIDTH >> 1), 0.0f, 0.0f,
25- (WIDTH >> 1), BOX_WIDTH, 0.0f,
26- (WIDTH >> 1), 0.0f, 0.0f,
27-
28- -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
29- -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
30- -(WIDTH >> 1), BOX_WIDTH, 0.0f,
31- -(WIDTH >> 1), BOX_WIDTH, 0.0f,
32- -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
33- -(WIDTH >> 1) + BOX_WIDTH, BOX_WIDTH, 0.0f,
34-
35- (WIDTH >> 1) - BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
36- (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
37- (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH, 0.0f,
38- (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH, 0.0f,
39- (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
40- (WIDTH >> 1), BOX_WIDTH, 0.0f,
41-
42- -(WIDTH >> 1), HEIGHT, 0.0f,
43- (WIDTH >> 1), HEIGHT, 0.0f,
44- -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
45- -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
46- (WIDTH >> 1), HEIGHT, 0.0f,
47- (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
48-};
49
50 void
51 SwitchScreen::updateWindowList (int count)
52@@ -78,7 +50,7 @@
53 count = 3;
54 }
55
56- pos = ((count >> 1) - (int)windows.size ()) * WIDTH;
57+ pos = ((count >> 1) - (int)windows.size ()) * modifiedWidth;
58 move = 0;
59
60 selectedWindow = windows.front ();
61@@ -184,9 +156,9 @@
62 SwitchScreen::handleSelectionChange (bool toNext, int nextIdx)
63 {
64 if (toNext)
65- move -= WIDTH;
66+ move -= modifiedWidth;
67 else
68- move += WIDTH;
69+ move += modifiedWidth;
70
71 moreAdjust = true;
72 }
73@@ -532,7 +504,7 @@
74
75 updateWindowList (count);
76
77- allWindowsWidth = windows.size () * WIDTH;
78+ allWindowsWidth = windows.size () * modifiedWidth;
79
80 foreach (CompWindow *win, windows)
81 {
82@@ -541,7 +513,7 @@
83 if (selectedWindow == selected)
84 break;
85
86- pos -= WIDTH;
87+ pos -= modifiedWidth;
88 if (pos < -allWindowsWidth)
89 pos += allWindowsWidth;
90 }
91@@ -650,7 +622,7 @@
92 float amount, chunk;
93 int allWindowsWidth;
94
95- allWindowsWidth = windows.size () * WIDTH;
96+ allWindowsWidth = windows.size () * modifiedWidth;
97
98 amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
99 steps = amount / (0.5f * optionGetTimestep ());
100@@ -878,10 +850,10 @@
101 mask,
102 x,
103 y,
104- WIDTH - (SPACE << 1),
105- HEIGHT - (SPACE << 1),
106- WIDTH - (WIDTH >> 2),
107- HEIGHT - (HEIGHT >> 2));
108+ sScreen->modifiedWidth - (SPACE << 1),
109+ sScreen->modifiedHeight - (SPACE << 1),
110+ sScreen->modifiedWidth - (sScreen->modifiedWidth >> 2),
111+ sScreen->modifiedHeight - (sScreen->modifiedHeight >> 2));
112 }
113
114 void
115@@ -901,8 +873,8 @@
116 else
117 sAttrib.xScale = sAttrib.yScale;
118
119- wx = x + WIDTH - icon->width () * sAttrib.xScale - SPACE;
120- wy = y + HEIGHT - icon->height () * sAttrib.yScale - SPACE;
121+ wx = x + sScreen->modifiedWidth - icon->width () * sAttrib.xScale - SPACE;
122+ wy = y + sScreen->modifiedWidth - icon->height () * sAttrib.yScale - SPACE;
123 }
124
125 void
126@@ -931,8 +903,8 @@
127 width = icon->width () * sAttrib.xScale;
128 height = icon->height () * sAttrib.yScale;
129
130- wx = x + SPACE + ((WIDTH - (SPACE << 1)) - width) / 2;
131- wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;
132+ wx = x + SPACE + (sScreen->modifiedWidth - (SPACE << 1) - width) / 2;
133+ wy = y + SPACE + (sScreen->modifiedHeight - (SPACE << 1) - height) / 2;
134 }
135
136 void
137@@ -943,8 +915,8 @@
138 float width,
139 float height)
140 {
141- wx = x + SPACE + ((WIDTH - (SPACE << 1)) - width) / 2;
142- wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;
143+ wx = x + SPACE + (sScreen->modifiedWidth - (SPACE << 1) - width) / 2;
144+ wy = y + SPACE + (sScreen->modifiedHeight - (SPACE << 1) - height) / 2;
145 }
146
147
148@@ -993,10 +965,11 @@
149
150 foreach (CompWindow *w, sScreen->windows)
151 {
152- if (x + WIDTH > x1)
153+ if (x + sScreen->modifiedWidth > x1) {
154 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),
155 transform, mask, x, y);
156- x += WIDTH;
157+ }
158+ x += sScreen->modifiedWidth;
159 }
160
161 foreach (CompWindow *w, sScreen->windows)
162@@ -1006,7 +979,7 @@
163
164 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),
165 transform, mask, x, y);
166- x += WIDTH;
167+ x += sScreen->modifiedWidth;
168 }
169
170 glDisable (GL_SCISSOR_TEST);
171@@ -1025,7 +998,7 @@
172 streamingBuffer->begin (GL_TRIANGLES);
173
174 streamingBuffer->addColors (1, color);
175- streamingBuffer->addVertices (24, _boxVertices);
176+ streamingBuffer->addVertices (24, sScreen->_boxVertices);
177
178 streamingBuffer->end ();
179 streamingBuffer->render (wTransform, attrib);
180@@ -1102,6 +1075,48 @@
181
182 }
183
184+void SwitchScreen::setSizeMultiplier () {
185+ sizeMultiplier = optionGetSizeMultiplier ();
186+
187+ modifiedWidth = static_cast<int> (WIDTH * sizeMultiplier);
188+ modifiedHeight = static_cast<int> (HEIGHT * sizeMultiplier);
189+
190+ float width = (WIDTH >> 1) * sizeMultiplier;
191+ float height = HEIGHT * sizeMultiplier;
192+ float box_width = BOX_WIDTH * sizeMultiplier;
193+ float boxVertices[72] =
194+ {
195+ -width, box_width, 0.0f,
196+ width, box_width, 0.0f,
197+ -width, 0.0f, 0.0f,
198+ -width, 0.0f, 0.0f,
199+ width, box_width, 0.0f,
200+ width, 0.0f, 0.0f,
201+
202+ -width, height - box_width, 0.0f,
203+ -width + box_width, height - box_width, 0.0f,
204+ -width, box_width, 0.0f,
205+ -width, box_width, 0.0f,
206+ -width + box_width, height - box_width, 0.0f,
207+ -width + box_width, box_width, 0.0f,
208+
209+ width - box_width, height - box_width, 0.0f,
210+ width, height - box_width, 0.0f,
211+ width - box_width, box_width, 0.0f,
212+ width - box_width, box_width, 0.0f,
213+ width, height - box_width, 0.0f,
214+ width, box_width, 0.0f,
215+
216+ -width, height, 0.0f,
217+ width, height, 0.0f,
218+ -width, height - box_width, 0.0f,
219+ -width, height - box_width, 0.0f,
220+ width, height, 0.0f,
221+ width, height - box_width, 0.0f,
222+ };
223+ std::copy (boxVertices, boxVertices + 72, _boxVertices);
224+}
225+
226 SwitchScreen::SwitchScreen (CompScreen *screen) :
227 BaseSwitchScreen (screen),
228 PluginClassHandler<SwitchScreen,CompScreen> (screen),
229@@ -1115,7 +1130,10 @@
230 pos (0),
231 move (0),
232 translate (0.0),
233- sTranslate (0.0)
234+ sTranslate (0.0),
235+ sizeMultiplier (1),
236+ modifiedWidth (WIDTH),
237+ modifiedHeight (HEIGHT)
238 {
239 zoom = optionGetZoom () / 30.0f;
240
241@@ -1123,6 +1141,9 @@
242
243 optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));
244
245+ setSizeMultiplier ();
246+ optionSetSizeMultiplierNotify (boost::bind (&SwitchScreen::setSizeMultiplier, this));
247+
248 auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};
249 optionSetUseBackgroundColorNotify (bgUpdater);
250 optionSetBackgroundColorNotify (bgUpdater);
251
252=== modified file 'plugins/switcher/src/switcher.h'
253--- plugins/switcher/src/switcher.h 2015-08-22 21:46:01 +0000
254+++ plugins/switcher/src/switcher.h 2016-07-20 09:53:18 +0000
255@@ -20,7 +20,9 @@
256 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
257 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
258 *
259- * Author: David Reveman <davidr@novell.com>
260+ * Author(s):
261+ * - David Reveman <davidr@novell.com>
262+ * - Auboyneau Vincent <ksamak@riseup.net> (size multiplier for A11Y)
263 */
264
265 #include <stdio.h>
266@@ -96,6 +98,13 @@
267
268 float translate;
269 float sTranslate;
270+
271+ void setSizeMultiplier ();
272+ float sizeMultiplier;
273+ int modifiedWidth;
274+ int modifiedHeight;
275+ float _boxVertices[72];
276+
277 };
278
279 class SwitchWindow :
280@@ -160,8 +169,8 @@
281
282 extern const unsigned short BOX_WIDTH;
283
284-#define WINDOW_WIDTH(count) (WIDTH * (count) + (SPACE << 1))
285-#define WINDOW_HEIGHT (HEIGHT + (SPACE << 1))
286+#define WINDOW_WIDTH(count) (static_cast<int>(WIDTH * sizeMultiplier) * (count) + (SPACE << 1))
287+#define WINDOW_HEIGHT (static_cast<int>(HEIGHT * sizeMultiplier) + (SPACE << 1))
288
289 #define SWITCH_SCREEN(s) \
290 SwitchScreen *ss = SwitchScreen::get (s)
291
292=== modified file 'plugins/switcher/switcher.xml.in'
293--- plugins/switcher/switcher.xml.in 2015-08-22 21:46:01 +0000
294+++ plugins/switcher/switcher.xml.in 2016-07-20 09:53:18 +0000
295@@ -98,6 +98,14 @@
296 <max>50</max>
297 <precision>0.1</precision>
298 </option>
299+ <option name="size_multiplier" type="float">
300+ <_short>Size multiplier</_short>
301+ <_long>adjusts the size of the switch windows</_long>
302+ <default>1</default>
303+ <min>0.1</min>
304+ <max>10</max>
305+ <precision>0.1</precision>
306+ </option>
307 <option name="window_match" type="match">
308 <_short>Switcher windows</_short>
309 <_long>Windows that should be shown in switcher</_long>

Subscribers

People subscribed via source and target branches

to all changes: