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

Proposed by ksamak
Status: Superseded
Proposed branch: lp:~ksamak/compiz/switcher_add_size_multiplier
Merge into: lp:compiz/0.9.13
Diff against target: 372 lines (+121/-71)
3 files modified
plugins/switcher/src/switcher.cpp (+99/-68)
plugins/switcher/src/switcher.h (+14/-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) Pending
Review via email: mp+299071@code.launchpad.net

This proposal has been superseded by a proposal from 2016-07-09.

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 :

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

Revision history for this message
ksamak (ksamak) wrote :

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 :

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

Just comment here once you've done.

4065. By ksamak <ksamak@ksalaptop>

indentation modifs

4066. By ksamak <ksamak@ksalaptop>

indentation modifs

Revision history for this message
ksamak (ksamak) wrote :

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.

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

4070. By ksamak <ksamak@ksalaptop>

switcher: fixed typo

Unmerged revisions

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-05 14:10:56 +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 ()) * static_cast<int>(WIDTH * sm);
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 -= static_cast<int>(WIDTH * sm);
188 else160 else
189 move += WIDTH;161 move += static_cast<int>(WIDTH * sm);
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 () * static_cast<int>(WIDTH * sm);
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 -= static_cast<int>(WIDTH * sm);
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 () * static_cast<int>(WIDTH * sm);
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 static_cast<int>(WIDTH * sm) - (SPACE << 1),
882 HEIGHT - (SPACE << 1),854 static_cast<int>(HEIGHT * sm) - (SPACE << 1),
883 WIDTH - (WIDTH >> 2),855 static_cast<int>(WIDTH * sm) - (static_cast<int>(WIDTH * sm) >> 2),
884 HEIGHT - (HEIGHT >> 2));856 static_cast<int>(HEIGHT * sm) - (static_cast<int>(HEIGHT * sm) >> 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 + static_cast<int>(WIDTH * sm) - icon->width () * sAttrib.xScale - SPACE;
905 wy = y + HEIGHT - icon->height () * sAttrib.yScale - SPACE;877 wy = y + static_cast<int>(HEIGHT * sm) - 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 + ((static_cast<int>(WIDTH * sm) - (SPACE << 1)) - width) / 2;
935 wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;907 wy = y + SPACE + ((static_cast<int>(HEIGHT * sm) - (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 + ((static_cast<int>(WIDTH * sm) - (SPACE << 1)) - width) / 2;
947 wy = y + SPACE + ((HEIGHT - (SPACE << 1)) - height) / 2;919 wy = y + SPACE + ((static_cast<int>(HEIGHT * sm) - (SPACE << 1)) - height) / 2;
948}920}
949921
950922
@@ -971,6 +943,7 @@
971 int x, y, x1, x2, cx;943 int x, y, x1, x2, cx;
972 unsigned short color[4];944 unsigned short color[4];
973945
946 sm = sScreen->sm;
974 const CompWindow::Geometry &g = window->geometry ();947 const CompWindow::Geometry &g = window->geometry ();
975948
976 if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK ||949 if (mask & PAINT_WINDOW_OCCLUSION_DETECTION_MASK ||
@@ -991,23 +964,25 @@
991 glEnable (GL_SCISSOR_TEST);964 glEnable (GL_SCISSOR_TEST);
992 glScissor (x1, 0, x2 - x1, screen->height ());965 glScissor (x1, 0, x2 - x1, screen->height ());
993966
994 foreach (CompWindow *w, sScreen->windows)967 foreach (CompWindow *w, sScreen->windows)
995 {968 {
996 if (x + WIDTH > x1)969 if (x + static_cast<int>(WIDTH * sm) > x1) {
997 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),970 auto switchWin = SwitchWindow::get(w);
998 transform, mask, x, y);971 switchWin->sm = sm;
999 x += WIDTH;972 switchWin->paintThumb (gWindow->lastPaintAttrib (), transform, mask, x, y);
1000 }973 }
1001974 x += static_cast<int>(WIDTH * sm);
1002 foreach (CompWindow *w, sScreen->windows)975 }
1003 {976
1004 if (x > x2)977 foreach (CompWindow *w, sScreen->windows)
1005 break;978 {
1006979 if (x > x2) { break; }
1007 SwitchWindow::get (w)->paintThumb (gWindow->lastPaintAttrib (),980
1008 transform, mask, x, y);981 auto switchWin = SwitchWindow::get(w);
1009 x += WIDTH;982 switchWin->sm = sm;
1010 }983 switchWin->paintThumb (gWindow->lastPaintAttrib (), transform, mask, x, y);
984 x += static_cast<int>(WIDTH * sm);
985 }
1011986
1012 glDisable (GL_SCISSOR_TEST);987 glDisable (GL_SCISSOR_TEST);
1013988
@@ -1025,7 +1000,7 @@
1025 streamingBuffer->begin (GL_TRIANGLES);1000 streamingBuffer->begin (GL_TRIANGLES);
10261001
1027 streamingBuffer->addColors (1, color);1002 streamingBuffer->addColors (1, color);
1028 streamingBuffer->addVertices (24, _boxVertices);1003 streamingBuffer->addVertices (24, sScreen->_boxVertices);
10291004
1030 streamingBuffer->end ();1005 streamingBuffer->end ();
1031 streamingBuffer->render (wTransform, attrib);1006 streamingBuffer->render (wTransform, attrib);
@@ -1102,6 +1077,58 @@
11021077
1103}1078}
11041079
1080void SwitchScreen::setSizeMultiplier() {
1081 sm = optionGetSizeMultiplier();
1082 float width = (WIDTH >> 1) * sm;
1083 float height = HEIGHT * sm;
1084 float box_width = BOX_WIDTH * sm;
1085 float boxVertices[72] =
1086 {
1087 -width, box_width, 0.0f,
1088 width, box_width, 0.0f,
1089 -width, 0.0f, 0.0f,
1090 -width, 0.0f, 0.0f,
1091 width, box_width, 0.0f,
1092 width, 0.0f, 0.0f,
1093
1094 -width, height - box_width, 0.0f,
1095 -width + box_width, height - box_width, 0.0f,
1096 -width, box_width, 0.0f,
1097 -width, box_width, 0.0f,
1098 -width + box_width, height - box_width, 0.0f,
1099 -width + box_width, box_width, 0.0f,
1100
1101 width - box_width, height - box_width, 0.0f,
1102 width, height - box_width, 0.0f,
1103 width - box_width, box_width, 0.0f,
1104 width - box_width, box_width, 0.0f,
1105 width, height - box_width, 0.0f,
1106 width, box_width, 0.0f,
1107
1108 -width, height, 0.0f,
1109 width, height, 0.0f,
1110 -width, height - box_width, 0.0f,
1111 -width, height - box_width, 0.0f,
1112 width, height, 0.0f,
1113 width, height - box_width, 0.0f,
1114 };
1115 std::copy(boxVertices, boxVertices + 72, _boxVertices);
1116
1117 foreach (CompWindow *w, windows)
1118 {
1119 auto switchWin = SwitchWindow::get(w);
1120 switchWin->resetGraphics();
1121 }
1122}
1123
1124void SwitchWindow::resetGraphics() {
1125 sm = sScreen->optionGetSizeMultiplier();
1126 if (sScreen->popupWindow && sScreen->popupWindow == window->id ()) {
1127 gWindow->glPaintSetEnabled (this, false);
1128 gWindow->glPaintSetEnabled (this, true);
1129 }
1130}
1131
1105SwitchScreen::SwitchScreen (CompScreen *screen) :1132SwitchScreen::SwitchScreen (CompScreen *screen) :
1106 BaseSwitchScreen (screen),1133 BaseSwitchScreen (screen),
1107 PluginClassHandler<SwitchScreen,CompScreen> (screen),1134 PluginClassHandler<SwitchScreen,CompScreen> (screen),
@@ -1115,14 +1142,16 @@
1115 pos (0),1142 pos (0),
1116 move (0),1143 move (0),
1117 translate (0.0),1144 translate (0.0),
1118 sTranslate (0.0)1145 sTranslate (0.0),
1146 sm(1)
1119{1147{
1120 zoom = optionGetZoom () / 30.0f;1148 zoom = optionGetZoom () / 30.0f;
1121
1122 zooming = (optionGetZoom () > 0.05f);1149 zooming = (optionGetZoom () > 0.05f);
1123
1124 optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));1150 optionSetZoomNotify (boost::bind (&SwitchScreen::setZoom, this));
11251151
1152 setSizeMultiplier();
1153 optionSetSizeMultiplierNotify(boost::bind(&SwitchScreen::setSizeMultiplier, this));
1154
1126 auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};1155 auto bgUpdater = [=] (...){ this->updateBackground (this->optionGetUseBackgroundColor (), this->optionGetBackgroundColor ());};
1127 optionSetUseBackgroundColorNotify (bgUpdater);1156 optionSetUseBackgroundColorNotify (bgUpdater);
1128 optionSetBackgroundColorNotify (bgUpdater);1157 optionSetBackgroundColorNotify (bgUpdater);
@@ -1182,8 +1211,10 @@
1182 BaseSwitchWindow (dynamic_cast<BaseSwitchScreen *>1211 BaseSwitchWindow (dynamic_cast<BaseSwitchScreen *>
1183 (SwitchScreen::get (screen)), window),1212 (SwitchScreen::get (screen)), window),
1184 PluginClassHandler<SwitchWindow,CompWindow> (window),1213 PluginClassHandler<SwitchWindow,CompWindow> (window),
1214 sm(1),
1185 sScreen (SwitchScreen::get (screen))1215 sScreen (SwitchScreen::get (screen))
1186{1216{
1217 sm = sScreen->optionGetSizeMultiplier();
1187 GLWindowInterface::setHandler (gWindow, false);1218 GLWindowInterface::setHandler (gWindow, false);
1188 CompositeWindowInterface::setHandler (cWindow, false);1219 CompositeWindowInterface::setHandler (cWindow, false);
11891220
11901221
=== 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-05 14:10:56 +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,11 @@
9698
97 float translate;99 float translate;
98 float sTranslate;100 float sTranslate;
101
102 void setSizeMultiplier();
103 float sm;
104 float _boxVertices[72];
105
99};106};
100107
101class SwitchWindow :108class SwitchWindow :
@@ -115,6 +122,8 @@
115 bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,122 bool glPaint (const GLWindowPaintAttrib &, const GLMatrix &,
116 const CompRegion &, unsigned int);123 const CompRegion &, unsigned int);
117124
125 void resetGraphics();
126
118 void paintThumb (const GLWindowPaintAttrib &attrib,127 void paintThumb (const GLWindowPaintAttrib &attrib,
119 const GLMatrix &transform,128 const GLMatrix &transform,
120 unsigned int mask,129 unsigned int mask,
@@ -143,6 +152,8 @@
143152
144 IconMode getIconMode ();153 IconMode getIconMode ();
145154
155 float sm; // sizeMultiplier
156
146 SwitchScreen *sScreen;157 SwitchScreen *sScreen;
147};158};
148159
@@ -160,8 +171,8 @@
160171
161extern const unsigned short BOX_WIDTH;172extern const unsigned short BOX_WIDTH;
162173
163#define WINDOW_WIDTH(count) (WIDTH * (count) + (SPACE << 1))174#define WINDOW_WIDTH(count) (static_cast<int>(WIDTH * optionGetSizeMultiplier()) * (count) + (SPACE << 1))
164#define WINDOW_HEIGHT (HEIGHT + (SPACE << 1))175#define WINDOW_HEIGHT (static_cast<int>(HEIGHT * optionGetSizeMultiplier()) + (SPACE << 1))
165176
166#define SWITCH_SCREEN(s) \177#define SWITCH_SCREEN(s) \
167 SwitchScreen *ss = SwitchScreen::get (s)178 SwitchScreen *ss = SwitchScreen::get (s)
168179
=== 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-05 14:10:56 +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: