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
=== modified file 'plugins/switcher/src/switcher.cpp'
--- plugins/switcher/src/switcher.cpp 2015-08-22 21:46:01 +0000
+++ plugins/switcher/src/switcher.cpp 2016-07-20 09:53:18 +0000
@@ -20,7 +20,9 @@
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *22 *
23 * Author: David Reveman <davidr@novell.com>23 * Author(s):
24 * - David Reveman <davidr@novell.com>
25 * - Auboyneau Vincent <ksamak@riseup.net> (size multiplier for A11Y)
24 */26 */
2527
26#include "switcher.h"28#include "switcher.h"
@@ -35,36 +37,6 @@
3537
36#define XWINDOWCHANGES_INIT {0, 0, 0, 0, 0, None, 0}38#define XWINDOWCHANGES_INIT {0, 0, 0, 0, 0, None, 0}
3739
38static float _boxVertices[] =
39{
40 -(WIDTH >> 1), BOX_WIDTH, 0.0f,
41 (WIDTH >> 1), BOX_WIDTH, 0.0f,
42 -(WIDTH >> 1), 0.0f, 0.0f,
43 -(WIDTH >> 1), 0.0f, 0.0f,
44 (WIDTH >> 1), BOX_WIDTH, 0.0f,
45 (WIDTH >> 1), 0.0f, 0.0f,
46
47 -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
48 -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
49 -(WIDTH >> 1), BOX_WIDTH, 0.0f,
50 -(WIDTH >> 1), BOX_WIDTH, 0.0f,
51 -(WIDTH >> 1) + BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
52 -(WIDTH >> 1) + BOX_WIDTH, BOX_WIDTH, 0.0f,
53
54 (WIDTH >> 1) - BOX_WIDTH, HEIGHT - BOX_WIDTH, 0.0f,
55 (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
56 (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH, 0.0f,
57 (WIDTH >> 1) - BOX_WIDTH, BOX_WIDTH, 0.0f,
58 (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
59 (WIDTH >> 1), BOX_WIDTH, 0.0f,
60
61 -(WIDTH >> 1), HEIGHT, 0.0f,
62 (WIDTH >> 1), HEIGHT, 0.0f,
63 -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
64 -(WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
65 (WIDTH >> 1), HEIGHT, 0.0f,
66 (WIDTH >> 1), HEIGHT - BOX_WIDTH, 0.0f,
67};
6840
69void41void
70SwitchScreen::updateWindowList (int count)42SwitchScreen::updateWindowList (int count)
@@ -78,7 +50,7 @@
78 count = 3;50 count = 3;
79 }51 }
8052
81 pos = ((count >> 1) - (int)windows.size ()) * WIDTH;53 pos = ((count >> 1) - (int)windows.size ()) * modifiedWidth;
82 move = 0;54 move = 0;
8355
84 selectedWindow = windows.front ();56 selectedWindow = windows.front ();
@@ -184,9 +156,9 @@
184SwitchScreen::handleSelectionChange (bool toNext, int nextIdx)156SwitchScreen::handleSelectionChange (bool toNext, int nextIdx)
185{157{
186 if (toNext)158 if (toNext)
187 move -= WIDTH;159 move -= modifiedWidth;
188 else160 else
189 move += WIDTH;161 move += modifiedWidth;
190162
191 moreAdjust = true;163 moreAdjust = true;
192}164}
@@ -532,7 +504,7 @@
532504
533 updateWindowList (count);505 updateWindowList (count);
534506
535 allWindowsWidth = windows.size () * WIDTH;507 allWindowsWidth = windows.size () * modifiedWidth;
536508
537 foreach (CompWindow *win, windows)509 foreach (CompWindow *win, windows)
538 {510 {
@@ -541,7 +513,7 @@
541 if (selectedWindow == selected)513 if (selectedWindow == selected)
542 break;514 break;
543515
544 pos -= WIDTH;516 pos -= modifiedWidth;
545 if (pos < -allWindowsWidth)517 if (pos < -allWindowsWidth)
546 pos += allWindowsWidth;518 pos += allWindowsWidth;
547 }519 }
@@ -650,7 +622,7 @@
650 float amount, chunk;622 float amount, chunk;
651 int allWindowsWidth;623 int allWindowsWidth;
652624
653 allWindowsWidth = windows.size () * WIDTH;625 allWindowsWidth = windows.size () * modifiedWidth;
654626
655 amount = msSinceLastPaint * 0.05f * optionGetSpeed ();627 amount = msSinceLastPaint * 0.05f * optionGetSpeed ();
656 steps = amount / (0.5f * optionGetTimestep ());628 steps = amount / (0.5f * optionGetTimestep ());
@@ -878,10 +850,10 @@
878 mask,850 mask,
879 x,851 x,
880 y,852 y,
881 WIDTH - (SPACE << 1),853 sScreen->modifiedWidth - (SPACE << 1),
882 HEIGHT - (SPACE << 1),854 sScreen->modifiedHeight - (SPACE << 1),
883 WIDTH - (WIDTH >> 2),855 sScreen->modifiedWidth - (sScreen->modifiedWidth >> 2),
884 HEIGHT - (HEIGHT >> 2));856 sScreen->modifiedHeight - (sScreen->modifiedHeight >> 2));
885}857}
886858
887void859void
@@ -901,8 +873,8 @@
901 else873 else
902 sAttrib.xScale = sAttrib.yScale;874 sAttrib.xScale = sAttrib.yScale;
903875
904 wx = x + WIDTH - icon->width () * sAttrib.xScale - SPACE;876 wx = x + sScreen->modifiedWidth - icon->width () * sAttrib.xScale - SPACE;
905 wy = y + HEIGHT - icon->height () * sAttrib.yScale - SPACE;877 wy = y + sScreen->modifiedWidth - icon->height () * sAttrib.yScale - SPACE;
906}878}
907879
908void880void
@@ -931,8 +903,8 @@
931 width = icon->width () * sAttrib.xScale;903 width = icon->width () * sAttrib.xScale;
932 height = icon->height () * sAttrib.yScale;904 height = icon->height () * sAttrib.yScale;
933905
934 wx = x + SPACE + ((WIDTH - (SPACE << 1)) - width) / 2;906 wx = x + SPACE + (sScreen->modifiedWidth - (SPACE << 1) - width) / 2;
935 wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;907 wy = y + SPACE + (sScreen->modifiedHeight - (SPACE << 1) - height) / 2;
936}908}
937909
938void910void
@@ -943,8 +915,8 @@
943 float width,915 float width,
944 float height)916 float height)
945{917{
946 wx = x + SPACE + ((WIDTH - (SPACE << 1)) - width) / 2;918 wx = x + SPACE + (sScreen->modifiedWidth - (SPACE << 1) - width) / 2;
947 wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;919 wy = y + SPACE + (sScreen->modifiedHeight - (SPACE << 1) - height) / 2;
948}920}
949921
950922
@@ -993,10 +965,11 @@
993965
994 foreach (CompWindow *w, sScreen->windows)966 foreach (CompWindow *w, sScreen->windows)
995 {967 {
996 if (x + WIDTH > x1)968 if (x + sScreen->modifiedWidth > x1) {
997 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),969 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),
998 transform, mask, x, y);970 transform, mask, x, y);
999 x += WIDTH;971 }
972 x += sScreen->modifiedWidth;
1000 }973 }
1001974
1002 foreach (CompWindow *w, sScreen->windows)975 foreach (CompWindow *w, sScreen->windows)
@@ -1006,7 +979,7 @@
1006979
1007 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),980 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),
1008 transform, mask, x, y);981 transform, mask, x, y);
1009 x += WIDTH;982 x += sScreen->modifiedWidth;
1010 }983 }
1011984
1012 glDisable (GL_SCISSOR_TEST);985 glDisable (GL_SCISSOR_TEST);
@@ -1025,7 +998,7 @@
1025 streamingBuffer->begin (GL_TRIANGLES);998 streamingBuffer->begin (GL_TRIANGLES);
1026999
1027 streamingBuffer->addColors (1, color);1000 streamingBuffer->addColors (1, color);
1028 streamingBuffer->addVertices (24, _boxVertices);1001 streamingBuffer->addVertices (24, sScreen->_boxVertices);
10291002
1030 streamingBuffer->end ();1003 streamingBuffer->end ();
1031 streamingBuffer->render (wTransform, attrib);1004 streamingBuffer->render (wTransform, attrib);
@@ -1102,6 +1075,48 @@
11021075
1103}1076}
11041077
1078void SwitchScreen::setSizeMultiplier () {
1079 sizeMultiplier = optionGetSizeMultiplier ();
1080
1081 modifiedWidth = static_cast<int> (WIDTH * sizeMultiplier);
1082 modifiedHeight = static_cast<int> (HEIGHT * sizeMultiplier);
1083
1084 float width = (WIDTH >> 1) * sizeMultiplier;
1085 float height = HEIGHT * sizeMultiplier;
1086 float box_width = BOX_WIDTH * sizeMultiplier;
1087 float boxVertices[72] =
1088 {
1089 -width, box_width, 0.0f,
1090 width, box_width, 0.0f,
1091 -width, 0.0f, 0.0f,
1092 -width, 0.0f, 0.0f,
1093 width, box_width, 0.0f,
1094 width, 0.0f, 0.0f,
1095
1096 -width, height - box_width, 0.0f,
1097 -width + box_width, height - box_width, 0.0f,
1098 -width, box_width, 0.0f,
1099 -width, box_width, 0.0f,
1100 -width + box_width, height - box_width, 0.0f,
1101 -width + box_width, box_width, 0.0f,
1102
1103 width - box_width, height - box_width, 0.0f,
1104 width, height - box_width, 0.0f,
1105 width - box_width, box_width, 0.0f,
1106 width - box_width, box_width, 0.0f,
1107 width, height - box_width, 0.0f,
1108 width, box_width, 0.0f,
1109
1110 -width, height, 0.0f,
1111 width, height, 0.0f,
1112 -width, height - box_width, 0.0f,
1113 -width, height - box_width, 0.0f,
1114 width, height, 0.0f,
1115 width, height - box_width, 0.0f,
1116 };
1117 std::copy (boxVertices, boxVertices + 72, _boxVertices);
1118}
1119
1105SwitchScreen::SwitchScreen (CompScreen *screen) :1120SwitchScreen::SwitchScreen (CompScreen *screen) :
1106 BaseSwitchScreen (screen),1121 BaseSwitchScreen (screen),
1107 PluginClassHandler<SwitchScreen,CompScreen> (screen),1122 PluginClassHandler<SwitchScreen,CompScreen> (screen),
@@ -1115,7 +1130,10 @@
1115 pos (0),1130 pos (0),
1116 move (0),1131 move (0),
1117 translate (0.0),1132 translate (0.0),
1118 sTranslate (0.0)1133 sTranslate (0.0),
1134 sizeMultiplier (1),
1135 modifiedWidth (WIDTH),
1136 modifiedHeight (HEIGHT)
1119{1137{
1120 zoom = optionGetZoom () / 30.0f;1138 zoom = optionGetZoom () / 30.0f;
11211139
@@ -1123,6 +1141,9 @@
11231141
1124 optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));1142 optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));
11251143
1144 setSizeMultiplier ();
1145 optionSetSizeMultiplierNotify (boost::bind (&SwitchScreen::setSizeMultiplier, this));
1146
1126 auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};1147 auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};
1127 optionSetUseBackgroundColorNotify (bgUpdater);1148 optionSetUseBackgroundColorNotify (bgUpdater);
1128 optionSetBackgroundColorNotify (bgUpdater);1149 optionSetBackgroundColorNotify (bgUpdater);
11291150
=== modified file 'plugins/switcher/src/switcher.h'
--- plugins/switcher/src/switcher.h 2015-08-22 21:46:01 +0000
+++ plugins/switcher/src/switcher.h 2016-07-20 09:53:18 +0000
@@ -20,7 +20,9 @@
20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION20 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.21 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 *22 *
23 * Author: David Reveman <davidr@novell.com>23 * Author(s):
24 * - David Reveman <davidr@novell.com>
25 * - Auboyneau Vincent <ksamak@riseup.net> (size multiplier for A11Y)
24 */26 */
2527
26#include <stdio.h>28#include <stdio.h>
@@ -96,6 +98,13 @@
9698
97 float translate;99 float translate;
98 float sTranslate;100 float sTranslate;
101
102 void setSizeMultiplier ();
103 float sizeMultiplier;
104 int modifiedWidth;
105 int modifiedHeight;
106 float _boxVertices[72];
107
99};108};
100109
101class SwitchWindow :110class SwitchWindow :
@@ -160,8 +169,8 @@
160169
161extern const unsigned short BOX_WIDTH;170extern const unsigned short BOX_WIDTH;
162171
163#define WINDOW_WIDTH(count) (WIDTH * (count) + (SPACE << 1))172#define WINDOW_WIDTH(count) (static_cast<int>(WIDTH * sizeMultiplier) * (count) + (SPACE << 1))
164#define WINDOW_HEIGHT (HEIGHT + (SPACE << 1))173#define WINDOW_HEIGHT (static_cast<int>(HEIGHT * sizeMultiplier) + (SPACE << 1))
165174
166#define SWITCH_SCREEN(s) \175#define SWITCH_SCREEN(s) \
167 SwitchScreen *ss = SwitchScreen::get (s)176 SwitchScreen *ss = SwitchScreen::get (s)
168177
=== modified file 'plugins/switcher/switcher.xml.in'
--- plugins/switcher/switcher.xml.in 2015-08-22 21:46:01 +0000
+++ plugins/switcher/switcher.xml.in 2016-07-20 09:53:18 +0000
@@ -98,6 +98,14 @@
98 <max>50</max>98 <max>50</max>
99 <precision>0.1</precision>99 <precision>0.1</precision>
100 </option>100 </option>
101 <option name="size_multiplier" type="float">
102 <_short>Size multiplier</_short>
103 <_long>adjusts the size of the switch windows</_long>
104 <default>1</default>
105 <min>0.1</min>
106 <max>10</max>
107 <precision>0.1</precision>
108 </option>
101 <option name="window_match" type="match">109 <option name="window_match" type="match">
102 <_short>Switcher windows</_short>110 <_short>Switcher windows</_short>
103 <_long>Windows that should be shown in switcher</_long>111 <_long>Windows that should be shown in switcher</_long>

Subscribers

People subscribed via source and target branches

to all changes: