Commit a50e4af333979ec5f5b86a0ad2922dc2736a5d4b

Authored by ksamak
1 parent 59cdf3b4

merged modifs from stretch for gdocs

plugins/ezoom/ezoom.xml.in 100644 โ†’ 100755
... ... @@ -8,6 +8,7 @@
8 8 <plugin>decor</plugin>
9 9 <plugin>mousepoll</plugin>
10 10 <plugin>focuspoll</plugin>
  11 + <plugin>showmouse</plugin>
11 12 </relation>
12 13 <relation type="before">
13 14 <plugin>staticswitcher</plugin>
... ... @@ -90,49 +91,218 @@
90 91 <min>1</min>
91 92 <max>50</max>
92 93 </option>
  94 + <option type="bool" name="spec_target_focus">
  95 + <_short>Target Focused Window on Specific Zoom</_short>
  96 + <_long>Check this to target the focused window when jumping to a specific zoom level. Uncheck this to target the mouse.</_long>
  97 + <default>true</default>
  98 + </option>
  99 + <option type="float" name="zoom_specific_1">
  100 + <_short>Specific Zoom 1</_short>
  101 + <_long>Zoom level to go to when triggering hotkey 1</_long>
  102 + <default>1.0</default>
  103 + <min>0.1</min>
  104 + <max>1.0</max>
  105 + <precision>0.01</precision>
  106 + </option>
93 107 <option type="key" name="zoom_specific_1_key">
94   - <_short>Zoom Specific Level 1</_short>
  108 + <_short>Zoom to Specific Zoom 1</_short>
95 109 <_long>Zoom to the specific zoom level 1</_long>
96 110 <default></default>
97 111 </option>
98   - <option type="float" name="zoom_spec1">
99   - <_short>Specific zoom factor 1</_short>
100   - <_long>Zoom level to go to when triggering hotkey 1</_long>
  112 + <option type="float" name="zoom_specific_2">
  113 + <_short>Specific Zoom 2</_short>
  114 + <_long>Zoom level to go to when triggering hotkey 2</_long>
101 115 <default>1.0</default>
102 116 <min>0.1</min>
103 117 <max>1.0</max>
104 118 <precision>0.01</precision>
105 119 </option>
106 120 <option type="key" name="zoom_specific_2_key">
107   - <_short>Zoom Specific Level 2</_short>
  121 + <_short>Zoom to Specific Zoom 2</_short>
108 122 <_long>Zoom to the specific zoom level 2</_long>
109 123 <default></default>
110 124 </option>
111   - <option type="float" name="zoom_spec2">
112   - <_short>Specific zoom factor 2</_short>
113   - <_long>Zoom level to go to when triggering hotkey 2</_long>
114   - <default>0.5</default>
  125 + <option type="float" name="zoom_specific_3">
  126 + <_short>Specific Zoom 3</_short>
  127 + <_long>Zoom level to go to when triggering hotkey 3</_long>
  128 + <default>1.0</default>
115 129 <min>0.1</min>
116 130 <max>1.0</max>
117 131 <precision>0.01</precision>
118 132 </option>
119 133 <option type="key" name="zoom_specific_3_key">
120   - <_short>Zoom Specific Level 3</_short>
  134 + <_short>Zoom to Specific Zoom 3</_short>
121 135 <_long>Zoom to the specific zoom level 3</_long>
122 136 <default></default>
123 137 </option>
124   - <option type="float" name="zoom_spec3">
125   - <_short>Specific zoom factor 3</_short>
126   - <_long>Zoom level to go to when triggering hotkey 3</_long>
127   - <default>0.2</default>
  138 + <option type="float" name="zoom_specific_4">
  139 + <_short>Specific Zoom 4</_short>
  140 + <_long>Zoom level to go to when triggering hotkey 4</_long>
  141 + <default>1.0</default>
128 142 <min>0.1</min>
129 143 <max>1.0</max>
130 144 <precision>0.01</precision>
131 145 </option>
132   - <option type="bool" name="spec_target_focus">
133   - <_short>Target Focused Window on Specific level</_short>
134   - <_long>Enable this to target the focused window when jumping to a specific zoom level. Disable to target mouse.</_long>
135   - <default>false</default>
  146 + <option type="key" name="zoom_specific_4_key">
  147 + <_short>Zoom to Specific Zoom 4</_short>
  148 + <_long>Zoom to the specific zoom level 4</_long>
  149 + <default></default>
  150 + </option>
  151 + <option type="float" name="zoom_specific_5">
  152 + <_short>Specific Zoom 5</_short>
  153 + <_long>Zoom level to go to when triggering hotkey 5</_long>
  154 + <default>1.0</default>
  155 + <min>0.1</min>
  156 + <max>1.0</max>
  157 + <precision>0.01</precision>
  158 + </option>
  159 + <option type="key" name="zoom_specific_5_key">
  160 + <_short>Zoom to Specific Zoom 5</_short>
  161 + <_long>Zoom to the specific zoom level 5</_long>
  162 + <default></default>
  163 + </option>
  164 + <option type="float" name="zoom_specific_6">
  165 + <_short>Specific Zoom 6</_short>
  166 + <_long>Zoom level to go to when triggering hotkey 6</_long>
  167 + <default>1.0</default>
  168 + <min>0.1</min>
  169 + <max>1.0</max>
  170 + <precision>0.01</precision>
  171 + </option>
  172 + <option type="key" name="zoom_specific_6_key">
  173 + <_short>Zoom to Specific Zoom 6</_short>
  174 + <_long>Zoom to the specific zoom level 6</_long>
  175 + <default></default>
  176 + </option>
  177 + <option type="float" name="zoom_specific_7">
  178 + <_short>Specific Zoom 7</_short>
  179 + <_long>Zoom level to go to when triggering hotkey 7</_long>
  180 + <default>1.0</default>
  181 + <min>0.1</min>
  182 + <max>1.0</max>
  183 + <precision>0.01</precision>
  184 + </option>
  185 + <option type="key" name="zoom_specific_7_key">
  186 + <_short>Zoom to Specific Zoom 7</_short>
  187 + <_long>Zoom to the specific zoom level 7</_long>
  188 + <default></default>
  189 + </option>
  190 + <option type="float" name="zoom_specific_8">
  191 + <_short>Specific Zoom 8</_short>
  192 + <_long>Zoom level to go to when triggering hotkey 8</_long>
  193 + <default>1.0</default>
  194 + <min>0.1</min>
  195 + <max>1.0</max>
  196 + <precision>0.01</precision>
  197 + </option>
  198 + <option type="key" name="zoom_specific_8_key">
  199 + <_short>Zoom to Specific Zoom 8</_short>
  200 + <_long>Zoom to the specific zoom level 8</_long>
  201 + <default></default>
  202 + </option>
  203 + <option type="float" name="zoom_specific_9">
  204 + <_short>Specific Zoom 9</_short>
  205 + <_long>Zoom level to go to when triggering hotkey 9</_long>
  206 + <default>1.0</default>
  207 + <min>0.1</min>
  208 + <max>1.0</max>
  209 + <precision>0.01</precision>
  210 + </option>
  211 + <option type="key" name="zoom_specific_9_key">
  212 + <_short>Zoom to Specific Zoom 9</_short>
  213 + <_long>Zoom to the specific zoom level 9</_long>
  214 + <default></default>
  215 + </option>
  216 + <option type="float" name="zoom_specific_10">
  217 + <_short>Specific Zoom 10</_short>
  218 + <_long>Zoom level to go to when triggering hotkey 10</_long>
  219 + <default>1.0</default>
  220 + <min>0.1</min>
  221 + <max>1.0</max>
  222 + <precision>0.01</precision>
  223 + </option>
  224 + <option type="key" name="zoom_specific_10_key">
  225 + <_short>Zoom to Specific Zoom 10</_short>
  226 + <_long>Zoom to the specific zoom level 10</_long>
  227 + <default></default>
  228 + </option>
  229 + <option type="float" name="zoom_specific_11">
  230 + <_short>Specific Zoom 11</_short>
  231 + <_long>Zoom level to go to when triggering hotkey 11</_long>
  232 + <default>1.0</default>
  233 + <min>0.1</min>
  234 + <max>1.0</max>
  235 + <precision>0.01</precision>
  236 + </option>
  237 + <option type="key" name="zoom_specific_11_key">
  238 + <_short>Zoom to Specific Zoom 11</_short>
  239 + <_long>Zoom to the specific zoom level 11</_long>
  240 + <default></default>
  241 + </option>
  242 + <option type="float" name="zoom_specific_12">
  243 + <_short>Specific Zoom 12</_short>
  244 + <_long>Zoom level to go to when triggering hotkey 12</_long>
  245 + <default>1.0</default>
  246 + <min>0.1</min>
  247 + <max>1.0</max>
  248 + <precision>0.01</precision>
  249 + </option>
  250 + <option type="key" name="zoom_specific_12_key">
  251 + <_short>Zoom to Specific Zoom 12</_short>
  252 + <_long>Zoom to the specific zoom level 12</_long>
  253 + <default></default>
  254 + </option>
  255 + <option type="float" name="zoom_specific_13">
  256 + <_short>Specific Zoom 13</_short>
  257 + <_long>Zoom level to go to when triggering hotkey 13</_long>
  258 + <default>1.0</default>
  259 + <min>0.1</min>
  260 + <max>1.0</max>
  261 + <precision>0.01</precision>
  262 + </option>
  263 + <option type="key" name="zoom_specific_13_key">
  264 + <_short>Zoom to Specific Zoom 13</_short>
  265 + <_long>Zoom to the specific zoom level 13</_long>
  266 + <default></default>
  267 + </option>
  268 + <option type="float" name="zoom_specific_14">
  269 + <_short>Specific Zoom 14</_short>
  270 + <_long>Zoom level to go to when triggering hotkey 14</_long>
  271 + <default>1.0</default>
  272 + <min>0.1</min>
  273 + <max>1.0</max>
  274 + <precision>0.01</precision>
  275 + </option>
  276 + <option type="key" name="zoom_specific_14_key">
  277 + <_short>Zoom to Specific Zoom 14</_short>
  278 + <_long>Zoom to the specific zoom level 14</_long>
  279 + <default></default>
  280 + </option>
  281 + <option type="float" name="zoom_specific_15">
  282 + <_short>Specific Zoom 15</_short>
  283 + <_long>Zoom level to go to when triggering hotkey 15</_long>
  284 + <default>1.0</default>
  285 + <min>0.1</min>
  286 + <max>1.0</max>
  287 + <precision>0.01</precision>
  288 + </option>
  289 + <option type="key" name="zoom_specific_15_key">
  290 + <_short>Zoom to Specific Zoom 15</_short>
  291 + <_long>Zoom to the specific zoom level 15</_long>
  292 + <default></default>
  293 + </option>
  294 + <option type="float" name="zoom_specific_16">
  295 + <_short>Specific Zoom 16</_short>
  296 + <_long>Zoom level to go to when triggering hotkey 16</_long>
  297 + <default>1.0</default>
  298 + <min>0.1</min>
  299 + <max>1.0</max>
  300 + <precision>0.01</precision>
  301 + </option>
  302 + <option type="key" name="zoom_specific_16_key">
  303 + <_short>Zoom to Specific Zoom 16</_short>
  304 + <_long>Zoom to the specific zoom level 16</_long>
  305 + <default></default>
136 306 </option>
137 307 </group>
138 308 <group>
... ...
plugins/ezoom/src/ezoom.cpp 100644 โ†’ 100755
... ... @@ -1123,26 +1123,26 @@ EZoomScreen::cursorMoved ()
1123 1123 void
1124 1124 EZoomScreen::updateMousePosition(const CompPoint &p)
1125 1125 {
1126   - if (pollMouseHandle.mouseHasMoved()) {
1127   - mousePos = pollMouseHandle.getMousePosition();
1128   - int out = screen->outputDeviceForPoint(mousePos.x(), mousePos.y());
1129   - if (optionGetZoomMode() == EzoomOptions::ZoomModeSyncMouse && !isInMovement(out)) {
1130   - if (optionGetWarpMouseToFocus()) {
1131   - if (lastMouseChange <= lastFocusChange) { // mouse taking back control of focus
1132   - lastMouseChange = time(NULL);
1133   - _non_mouse_focus_tracking = false;
1134   - screen->warpPointer(mousePos.x(), mousePos.y());
1135   - restrainCursor(out);
1136   - } else {
1137   - setCenter(mousePos.x(), mousePos.y(), true, optionGetAlwaysCenterMouse());
1138   - lastMouseChange = time(NULL);
1139   - }
1140   - } else if (time(NULL) - lastFocusChange > optionGetFollowFocusDelay()) {
1141   - setCenter(mousePos.x(), mousePos.y(), true, optionGetAlwaysCenterMouse());
1142   - lastMouseChange = time(NULL);
1143   - }
1144   - }
1145   - }
  1126 + mousePos = pollMouseHandle.getPosition();
  1127 + int out = screen->outputDeviceForPoint(mousePos.x(), mousePos.y());
  1128 + if (optionGetZoomMode() == EzoomOptions::ZoomModeSyncMouse && !isInMovement(out)) {
  1129 + if (optionGetWarpMouseToFocus()) {
  1130 + if (lastMouseChange <= lastFocusChange) { // mouse taking back control of focus
  1131 + lastMouseChange = time(NULL);
  1132 + _non_mouse_focus_tracking = false;
  1133 + screen->warpPointer(mousePos.x(), mousePos.y());
  1134 + restrainCursor(out);
  1135 + } else {
  1136 + setCenter(mousePos.x(), mousePos.y(), true, optionGetAlwaysCenterMouse());
  1137 + lastMouseChange = time(NULL);
  1138 + }
  1139 + } else if (time(NULL) - lastFocusChange > optionGetFollowFocusDelay()) {
  1140 + setCenter(mousePos.x(), mousePos.y(), true, optionGetAlwaysCenterMouse());
  1141 + lastMouseChange = time(NULL);
  1142 + }
  1143 + }
  1144 + cursorMoved ();
  1145 + cScreen->damageScreen();
1146 1146 }
1147 1147  
1148 1148 void
... ... @@ -1164,7 +1164,6 @@ EZoomScreen::updateFocusPosition(const CompRect &amp;rect)
1164 1164 _non_mouse_focus_tracking = true;
1165 1165 lastFocusChange = time(NULL);
1166 1166 }
1167   - cursorMoved();
1168 1167 cScreen->damageScreen();
1169 1168 }
1170 1169  
... ... @@ -1658,16 +1657,68 @@ EZoomScreen::zoomSpecific (CompAction *action,
1658 1657  
1659 1658 switch (target)
1660 1659 {
1661   - case ZoomTargetFirst:
1662   - zoom_level = optionGetZoomSpec1 ();
  1660 + case ZoomTarget1:
  1661 + zoom_level = optionGetZoomSpecific1 ();
  1662 + break;
  1663 +
  1664 + case ZoomTarget2:
  1665 + zoom_level = optionGetZoomSpecific2 ();
  1666 + break;
  1667 +
  1668 + case ZoomTarget3:
  1669 + zoom_level = optionGetZoomSpecific3 ();
  1670 + break;
  1671 +
  1672 + case ZoomTarget4:
  1673 + zoom_level = optionGetZoomSpecific4 ();
  1674 + break;
  1675 +
  1676 + case ZoomTarget5:
  1677 + zoom_level = optionGetZoomSpecific5 ();
  1678 + break;
  1679 +
  1680 + case ZoomTarget6:
  1681 + zoom_level = optionGetZoomSpecific6 ();
  1682 + break;
  1683 +
  1684 + case ZoomTarget7:
  1685 + zoom_level = optionGetZoomSpecific7 ();
  1686 + break;
  1687 +
  1688 + case ZoomTarget8:
  1689 + zoom_level = optionGetZoomSpecific8 ();
  1690 + break;
  1691 +
  1692 + case ZoomTarget9:
  1693 + zoom_level = optionGetZoomSpecific9 ();
  1694 + break;
  1695 +
  1696 + case ZoomTarget10:
  1697 + zoom_level = optionGetZoomSpecific10 ();
  1698 + break;
  1699 +
  1700 + case ZoomTarget11:
  1701 + zoom_level = optionGetZoomSpecific11 ();
  1702 + break;
  1703 +
  1704 + case ZoomTarget12:
  1705 + zoom_level = optionGetZoomSpecific12 ();
  1706 + break;
  1707 +
  1708 + case ZoomTarget13:
  1709 + zoom_level = optionGetZoomSpecific13 ();
  1710 + break;
  1711 +
  1712 + case ZoomTarget14:
  1713 + zoom_level = optionGetZoomSpecific14 ();
1663 1714 break;
1664 1715  
1665   - case ZoomTargetSecond:
1666   - zoom_level = optionGetZoomSpec2 ();
  1716 + case ZoomTarget15:
  1717 + zoom_level = optionGetZoomSpecific15 ();
1667 1718 break;
1668 1719  
1669   - case ZoomTargetThird:
1670   - zoom_level = optionGetZoomSpec3 ();
  1720 + case ZoomTarget16:
  1721 + zoom_level = optionGetZoomSpecific16 ();
1671 1722 break;
1672 1723  
1673 1724 default:
... ... @@ -2035,16 +2086,54 @@ EZoomScreen::EZoomScreen (CompScreen *screen) :
2035 2086 optionSetZoomOutKeyInitiate (boost::bind (&EZoomScreen::zoomOut, this, _1,
2036 2087 _2, _3));
2037 2088  
2038   - optionSetZoomSpecific1KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
2039   - this, _1, _2, _3,
2040   - ZoomTargetFirst));
2041   - optionSetZoomSpecific2KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
2042   - this, _1, _2, _3,
2043   - ZoomTargetSecond));
2044   - optionSetZoomSpecific3KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
2045   - this, _1, _2, _3,
2046   - ZoomTargetThird));
2047   -
  2089 + optionSetZoomSpecific1KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2090 + this, _1, _2, _3,
  2091 + ZoomTarget1));
  2092 + optionSetZoomSpecific2KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2093 + this, _1, _2, _3,
  2094 + ZoomTarget2));
  2095 + optionSetZoomSpecific3KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2096 + this, _1, _2, _3,
  2097 + ZoomTarget3));
  2098 + optionSetZoomSpecific4KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2099 + this, _1, _2, _3,
  2100 + ZoomTarget4));
  2101 + optionSetZoomSpecific5KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2102 + this, _1, _2, _3,
  2103 + ZoomTarget5));
  2104 + optionSetZoomSpecific6KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2105 + this, _1, _2, _3,
  2106 + ZoomTarget6));
  2107 + optionSetZoomSpecific7KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2108 + this, _1, _2, _3,
  2109 + ZoomTarget7));
  2110 + optionSetZoomSpecific8KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2111 + this, _1, _2, _3,
  2112 + ZoomTarget8));
  2113 + optionSetZoomSpecific9KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2114 + this, _1, _2, _3,
  2115 + ZoomTarget9));
  2116 + optionSetZoomSpecific10KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2117 + this, _1, _2, _3,
  2118 + ZoomTarget10));
  2119 + optionSetZoomSpecific11KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2120 + this, _1, _2, _3,
  2121 + ZoomTarget11));
  2122 + optionSetZoomSpecific12KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2123 + this, _1, _2, _3,
  2124 + ZoomTarget12));
  2125 + optionSetZoomSpecific13KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2126 + this, _1, _2, _3,
  2127 + ZoomTarget13));
  2128 + optionSetZoomSpecific14KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2129 + this, _1, _2, _3,
  2130 + ZoomTarget14));
  2131 + optionSetZoomSpecific15KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2132 + this, _1, _2, _3,
  2133 + ZoomTarget15));
  2134 + optionSetZoomSpecific16KeyInitiate (boost::bind (&EZoomScreen::zoomSpecific,
  2135 + this, _1, _2, _3,
  2136 + ZoomTarget16));
2048 2137 optionSetPanLeftKeyInitiate (boost::bind (&EZoomScreen::zoomPan, this, _1,
2049 2138 _2, _3, -1, 0));
2050 2139 optionSetPanRightKeyInitiate (boost::bind (&EZoomScreen::zoomPan, this, _1,
... ...
plugins/ezoom/src/ezoom.h 100644 โ†’ 100755
... ... @@ -51,9 +51,22 @@
51 51  
52 52 enum SpecificZoomTarget
53 53 {
54   - ZoomTargetFirst = 0,
55   - ZoomTargetSecond,
56   - ZoomTargetThird
  54 + ZoomTarget1 = 0,
  55 + ZoomTarget2,
  56 + ZoomTarget3,
  57 + ZoomTarget4,
  58 + ZoomTarget5,
  59 + ZoomTarget6,
  60 + ZoomTarget7,
  61 + ZoomTarget8,
  62 + ZoomTarget9,
  63 + ZoomTarget10,
  64 + ZoomTarget11,
  65 + ZoomTarget12,
  66 + ZoomTarget13,
  67 + ZoomTarget14,
  68 + ZoomTarget15,
  69 + ZoomTarget16
57 70 };
58 71  
59 72 class EZoomScreen :
... ...
plugins/focuspoll/focuspoll.xml.in
... ... @@ -21,13 +21,13 @@
21 21 <_long>if enabled, focuspoll will not track the focus events of link items</_long>
22 22 <default>true</default>
23 23 </option>
24   - <option type="int" name="focus_poll_interval">
25   - <_short>Focus Poll Interval</_short>
26   - <_long>How often to poll DBus for focus changes, in miliseconds. Reduce this to reduce choppy behavior.</_long>
27   - <default>10</default>
28   - <min>1</min>
29   - <max>500</max>
30   - </option>
  24 + <option type="int" name="focus_poll_interval">
  25 + <_short>Focus Poll Interval</_short>
  26 + <_long>How often to poll DBus for focus changes, in milliseconds. Reduce this to reduce choppy behavior.</_long>
  27 + <default>10</default>
  28 + <min>1</min>
  29 + <max>500</max>
  30 + </option>
31 31 </options>
32 32 </plugin>
33 33 </compiz>
... ...
plugins/focuspoll/include/accessibilitywatcher/accessibilitywatcher.h
1 1 /*
2   - * Coyright (C) 2016 Auboyneau Vincent <ksamak@riseup.net>
  2 + * Copyright (C) 2016 Auboyneau Vincent <ksamak@riseup.net>
  3 + *
  4 + * This file is part of compiz.
3 5 *
4 6 * this program is free software: you can redistribute it and/or modify
5 7 * it under the terms of the GNU General Public License as published by the Free
6 8 * Software Foundation, either version 3 of the License, or (at your option) any
7 9 * later version.
8 10 *
9   - * mate-accessibility is distributed in the hope that it will be useful, but
  11 + * This program is distributed in the hope that it will be useful, but
10 12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 14 * details.
13 15 *
14 16 * You should have received a copy of the GNU General Public License along
15   - * with mate-accessibility. If not, see <http://www.gnu.org/licenses/>.
  17 + * with this program. If not, see <http://www.gnu.org/licenses/>.
16 18 */
17 19  
18 20 #ifndef ACCESSIBILITY_WATCHER_H
19 21 #define ACCESSIBILITY_WATCHER_H
20 22  
21   -#include <iostream>
22   -#include <exception>
23 23 #include <deque>
24 24 #include <vector>
25   -#include <X11/Xlib.h>
26 25  
27 26 #include "focusinfo.h"
28 27  
... ... @@ -30,56 +29,61 @@
30 29  
31 30 class AccessibilityWatcher {
32 31 public:
33   - static AccessibilityWatcher* get_instance();
34   - ~AccessibilityWatcher() {quit();};
35   -
36   - void init();
37   - void quit();
  32 + ~AccessibilityWatcher();
  33 + static AccessibilityWatcher* getInstance();
38 34  
39   - void setIgnoreLinks(bool);
40   - void setScreenLimits(int, int);
  35 + void init();
  36 + void quit();
  37 + void setActive (bool);
41 38  
42   - std::deque<FocusInfo> get_focus_queue();
43   - void reset_focus_queue();
44   - bool return_to_prev_menu();
  39 + void setIgnoreLinks(bool);
  40 + void setScreenLimits(int, int);
  41 + int getScreenWidth();
  42 + int getScreenHeight();
45 43  
46   - int screenWidth;
47   - int screenHeight;
  44 + std::deque<FocusInfo> getFocusQueue();
  45 + void resetFocusQueue();
  46 + bool returnToPrevMenu();
48 47  
49 48 private:
50   - AccessibilityWatcher();
51   - static AccessibilityWatcher* _instance;
52   -
53   - // screen vars
54   - static Display* dpy;
55   -
56   - bool _initialized;
57   - static bool _ignore_links;
58   - static const int _timeout_ms = 20;
59   - std::deque<FocusInfo> _focus_list;
60   - std::vector<FocusInfo> _previously_active_menus;
61   -
62   - void addWatches();
63   - void removeWatches();
64   -
65   - static std::string get_label(AtspiAccessible *accessible);
66   - static AtspiAccessible* find_child_slider(AtspiAccessible *accessible);
67   - const static gchar* atspi_state_get_name (gint state);
68   - static std::string get_state_set (AtspiAccessible *accessible);
69   -
70   - static void print_event(const AtspiEvent *event);
71   - static void print_event(AtspiAccessible *access);
72   - static void register_event(const AtspiEvent *event, std::string type);
73   - static bool app_specific_filter(FocusInfo& focus_info, const AtspiEvent* event);
74   - static bool filter_bad_events(const FocusInfo& event);
75   - static void get_alternative_caret(FocusInfo& focus, const AtspiEvent* event);
76   -
77   - static void on_focus(const AtspiEvent *event, void *data);
78   - static void on_selected_change(const AtspiEvent *event, void *data);
79   - static void on_caret_move(const AtspiEvent *event, void *data);
80   - static void on_descendant_changed(const AtspiEvent *event, void *data);
81   -
82   - AtspiEventListener *listener, *listener2, *listener3, *listener4;
  49 + AccessibilityWatcher();
  50 + static AccessibilityWatcher* instance;
  51 +
  52 + bool initialized;
  53 + bool mActive;
  54 + int screenWidth;
  55 + int screenHeight;
  56 + static bool ignoreLinks;
  57 + std::deque<FocusInfo> focusList;
  58 + std::vector<FocusInfo> previouslyActiveMenus;
  59 +
  60 + AtspiEventListener *focusListener;
  61 + AtspiEventListener *caretMoveListener;
  62 + AtspiEventListener *selectedListener;
  63 + AtspiEventListener *descendantChangedListener;
  64 +
  65 + void addWatches();
  66 + void removeWatches();
  67 +
  68 + static std::string getLabel(AtspiAccessible *accessible);
  69 + const static gchar* atspiStateGetName (gint state);
  70 + static std::string getStateSet (AtspiAccessible *accessible);
  71 +
  72 + static void printEvent(const AtspiEvent *event);
  73 + static void printEvent(AtspiAccessible *access);
  74 + static void registerEvent(const AtspiEvent *event, const std::string& type);
  75 + static bool appSpecificFilter(FocusInfo& focusInfo, const AtspiEvent* event);
  76 + static bool filterBadEvents(const FocusInfo& event);
  77 + static std::string getBrowserURL(AtspiAccessible*);
  78 + static bool getKixCaret (FocusInfo&, const AtspiEvent*);
  79 + static AtspiAccessible* recurseFindCursor(AtspiAccessible*);
  80 + static AtspiAccessible* getChildFromVector(std::vector<int> path, AtspiAccessible* startPoint);
  81 + static void getAlternativeCaret(FocusInfo& focus, const AtspiEvent* event);
  82 +
  83 + static void onFocus(const AtspiEvent *event, void *data);
  84 + static void onSelectedChange(const AtspiEvent *event, void *data);
  85 + static void onCaretMove(const AtspiEvent *event, void *data);
  86 + static void onDescendantChanged(const AtspiEvent *event, void *data);
83 87  
84 88 };
85 89  
... ...
plugins/focuspoll/include/accessibilitywatcher/focusinfo.h
  1 +/*
  2 + * Copyright (C) 2016 Auboyneau Vincent <ksamak@riseup.net>
  3 + *
  4 + * This file is part of compiz.
  5 + *
  6 + * this program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by the Free
  8 + * Software Foundation, either version 3 of the License, or (at your option) any
  9 + * later version.
  10 + *
  11 + * This program is distributed in the hope that it will be useful, but
  12 + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  14 + * details.
  15 + *
  16 + * You should have received a copy of the GNU General Public License along
  17 + * with this program. If not, see <http://www.gnu.org/licenses/>.
  18 + */
  19 +
1 20 #ifndef FOCUS_INFO_H
2 21 #define FOCUS_INFO_H
3 22  
4   -#include <deque>
5 23 #include <tuple>
6 24 #include <string>
7 25 #include <sstream>
... ... @@ -9,126 +27,50 @@
9 27  
10 28 class FocusInfo {
11 29 public:
12   - FocusInfo() {
13   - x=0; y=0;
14   - w=0; h=0;
15   - x_alt=0; y_alt=0;
16   - w_alt=0; h_alt=0;
17   - type="";
18   - name = "";
19   - label="";
20   - role = "";
21   - application = "";
22   - enabled = false;
23   - active = false;
24   - focusable = false;
25   - focused = false;
26   - selected = false;
27   - showing = false;
28   - visible = false;
29   - };
30   -
31   - FocusInfo(const std::string& type, const std::string& name, const std::string& label, const std::string& role, const std::string& application, int x, int y, int width, int height) :
32   - x(x), y(y),
33   - w(width), h(height),
34   - type(type),
35   - name(name),
36   - label(label),
37   - role(role),
38   - application(application),
39   - enabled(false),
40   - active(false),
41   - focusable(false),
42   - focused(false),
43   - selected(false),
44   - showing(false),
45   - visible(false)
46   - {};
47 30  
48   - FocusInfo(std::string& type, std::string& name, std::string& label, std::string& role, std::string& application, int x, int y, int width, int height) :
49   - x(x), y(y),
50   - w(width), h(height),
51   - type(type),
52   - name(name),
53   - label(label),
54   - role(role),
55   - application(application),
56   - enabled(false),
57   - active(false),
58   - focusable(false),
59   - focused(false),
60   - selected(false),
61   - showing(false),
62   - visible(false)
63   - {};
  31 + FocusInfo(const std::string& type,
  32 + const std::string& name,
  33 + const std::string& label,
  34 + const std::string& role,
  35 + const std::string& application,
  36 + int x,
  37 + int y,
  38 + int width,
  39 + int height);
64 40  
65   - std::string getType() const {return type;}; // return caret or widget for now // TODO make const
66   - std::tuple<int, int> getPosition() const {return std::make_tuple(x, y);};
67   - std::tuple<int, int> getSize() const {return std::make_tuple(w, h);};
68   - std::tuple<int, int, int, int> getBBox() const {return std::make_tuple(x, y, w, h);};
  41 + FocusInfo(const std::string& type,
  42 + const std::string& name,
  43 + const std::string& label,
  44 + const std::string& role,
  45 + const std::string& application);
69 46  
70   - bool operator==(const FocusInfo& other) const {
71   - return (other.x == x &&
72   - other.y == y &&
73   - other.w == w &&
74   - other.h == h &&
75   - other.type == type &&
76   - other.name == name &&
77   - other.label == label &&
78   - other.application == application &&
79   - other.role == role);
80   - };
  47 + FocusInfo();
81 48  
82   - bool operator!=(const FocusInfo& other) const {
83   - return (other.x == x ||
84   - other.y == y ||
85   - other.w == w ||
86   - other.h == h ||
87   - other.type == type ||
88   - other.name == name ||
89   - other.label == label ||
90   - other.application == application ||
91   - other.role == role);
92   - };
  49 + int x, y, w, h;
  50 + int xAlt, yAlt, wAlt, hAlt;
  51 + std::string type;
  52 + std::string name;
  53 + std::string label;
  54 + std::string role;
  55 + std::string application;
93 56  
94   - std::string summary() const {
95   - std::ostringstream res;
96   - res << "name:" << name;
97   - res << " application:" << application;
98   - res << " type:" << type;
99   - if (label != "") {res << " label:" << label;}
100   - res << " role:" << role;
101   - res << " pos " << x << "," << y;
102   - res << "(" << w << ":" << h << ")";
103   - //res << std::endl;
104   - res << "[";
105   - //if (enabled) {res << "enabled ";}
106   - if (active) {res << "active ";}
107   - //if (focusable) {res << "focusable ";}
108   - if (focused) {res << "focused ";}
109   - if (selected) {res << "selected ";}
110   - //if (showing) {res << "showing ";}
111   - //if (visible) {res << "visible ";}
112   - res << "]";
113   - return res.str();
114   - }
  57 + // AT-SPI events that are interesting to know about the event
  58 + bool enabled;
  59 + bool active;
  60 + bool focusable;
  61 + bool focused;
  62 + bool selected;
  63 + bool showing;
  64 + bool visible;
115 65  
116   - int x, y, w, h;
117   - int x_alt, y_alt, w_alt, h_alt;
118   - std::string type;
119   - std::string name;
120   - std::string label;
121   - std::string role;
122   - std::string application;
  66 + std::string getType();
  67 + std::string summary();
  68 + std::tuple<int, int> getPosition();
  69 + std::tuple<int, int> getSize();
  70 + std::tuple<int, int, int, int> getBBox();
123 71  
124   - // AT-SPI events that are interesting to know about the event
125   - bool enabled;
126   - bool active;
127   - bool focusable;
128   - bool focused;
129   - bool selected;
130   - bool showing;
131   - bool visible;
  72 + bool operator== (const FocusInfo& other) const;
  73 + bool operator!= (const FocusInfo& other) const;
132 74 };
133 75  
134 76 #endif
... ...
plugins/focuspoll/include/focuspoll/focuspoll.h
1 1 /*
  2 + * Copyright (C) 2016 Auboyneau Vincent <ksamak@riseup.net>
2 3 *
3   - * Compiz focus position polling plugin
  4 + * This file is part of compiz.
4 5 *
5   - * Copyright : (C) 2016 Auboyneau Vincent
6   - * E-mail : ksamak@riseup.net
  6 + * this program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by the Free
  8 + * Software Foundation, either version 3 of the License, or (at your option) any
  9 + * later version.
7 10 *
  11 + * This program is distributed in the hope that it will be useful, but
  12 + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  14 + * details.
8 15 *
9   - * This program is free software; you can redistribute it and/or
10   - * modify it under the terms of the GNU General Public License
11   - * as published by the Free Software Foundation; either version 2
12   - * of the License, or (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
  16 + * You should have received a copy of the GNU General Public License along
  17 + * with this program. If not, see <http://www.gnu.org/licenses/>.
19 18 */
20 19  
21 20 #ifndef _COMPIZ_FOCUSPOLL_H
... ... @@ -23,28 +22,28 @@
23 22  
24 23 #define COMPIZ_FOCUSPOLL_ABI 1
25 24  
  25 +#include <core/rect.h>
26 26 #include <accessibilitywatcher/focusinfo.h>
27 27  
28 28 class FocusPoller
29 29 {
30 30 public:
31   - typedef boost::function<void(const CompRect &)> CallBack;
  31 + typedef boost::function<void(const CompRect &)> CallBack;
32 32  
33   - FocusPoller ();
34   - ~FocusPoller ();
  33 + FocusPoller ();
  34 + ~FocusPoller ();
35 35  
36   - void setCallback (CallBack callback);
37   - void start ();
38   - void stop ();
39   - bool active ();
40   - //static CompPoint getCurrentPosition ();
  36 + void setCallback (CallBack callback);
  37 + void start ();
  38 + void stop ();
  39 + bool active ();
41 40  
42 41 private:
43   - bool mActive;
44   - CallBack mCallback;
45   - CompRect focusRect;
  42 + bool mActive;
  43 + CallBack mCallback;
  44 + CompRect focusRect;
46 45  
47   - friend class FocuspollScreen;
  46 + friend class FocuspollScreen;
48 47 };
49 48  
50 49 #endif
... ...
plugins/focuspoll/src/accessibilitywatcher.cpp
1 1 /*
  2 + * Copyright (C) 2016 Auboyneau Vincent <ksamak@riseup.net>
2 3 *
3   - * Compiz focus tracking plugin
  4 + * This file is part of compiz.
4 5 *
5   - * Copyright : (C) 2016 Auboyneau Vincent
6   - * E-mail : ksamak@riseup.net
  6 + * this program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU General Public License as published by the Free
  8 + * Software Foundation, either version 3 of the License, or (at your option) any
  9 + * later version.
7 10 *
  11 + * This program is distributed in the hope that it will be useful, but
  12 + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  14 + * details.
8 15 *
9   - * This program is free software; you can redistribute it and/or
10   - * modify it under the terms of the GNU General Public License
11   - * as published by the Free Software Foundation; either version 2
12   - * of the License, or (at your option) any later version.
13   - *
14   - * This program is distributed in the hope that it will be useful,
15   - * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17   - * GNU General Public License for more details.
18   - *
  16 + * You should have received a copy of the GNU General Public License along
  17 + * with this program. If not, see <http://www.gnu.org/licenses/>.
19 18 */
20 19  
21 20 #include <iostream>
... ... @@ -26,427 +25,652 @@
26 25  
27 26 #include "accessibilitywatcher.h"
28 27  
29   -AccessibilityWatcher* AccessibilityWatcher::_instance = NULL;
30   -bool AccessibilityWatcher::_ignore_links = false;
  28 +namespace {
  29 + const int A11YWATCHER_MAX_CARET_WIDTH = 50;
  30 + const int A11YWATCHER_MAX_CARET_HEIGHT = 70;
  31 +}
31 32  
32   -AccessibilityWatcher::AccessibilityWatcher() :
33   - screenWidth(0),
34   - screenHeight(0),
35   - _initialized(false)
  33 +AccessibilityWatcher* AccessibilityWatcher::instance = NULL;
  34 +bool AccessibilityWatcher::ignoreLinks = false;
  35 +
  36 +AccessibilityWatcher::AccessibilityWatcher () :
  37 + initialized (false),
  38 + screenWidth (0),
  39 + screenHeight (0),
  40 + focusListener (NULL),
  41 + caretMoveListener (NULL),
  42 + selectedListener (NULL),
  43 + descendantChangedListener (NULL)
36 44 {
37 45 }
38 46  
39   -AccessibilityWatcher* AccessibilityWatcher::get_instance() {
40   - if(_instance == NULL) {
41   - _instance = new AccessibilityWatcher();
  47 +AccessibilityWatcher::~AccessibilityWatcher () {
  48 + quit ();
  49 +};
  50 +
  51 +AccessibilityWatcher *AccessibilityWatcher::getInstance () {
  52 + if (instance == NULL)
  53 + {
  54 + instance = new AccessibilityWatcher ();
42 55 }
43   - return _instance;
  56 + return instance;
44 57 }
45 58  
46   -std::string AccessibilityWatcher::get_label(AtspiAccessible *accessible) {
47   - GArray *relations;
48   - AtspiRelation *relation;
49   -
50   - relations = atspi_accessible_get_relation_set (accessible, NULL);
51   - if (relations == NULL) {
52   - return "";
  59 +std::string AccessibilityWatcher::getLabel (AtspiAccessible *accessible) {
  60 + GArray *relations = atspi_accessible_get_relation_set (accessible, NULL);
  61 + if (relations == NULL)
  62 + {
  63 + return "";
53 64 }
54 65  
55   - for (unsigned i = 0; i < relations->len; i++) {
56   - relation = g_array_index (relations, AtspiRelation*, i);
57   - if (atspi_relation_get_relation_type (relation) == ATSPI_RELATION_LABELLED_BY) {
58   - return atspi_accessible_get_name(atspi_relation_get_target(relation, 0), NULL);
59   - }
  66 + AtspiRelation *relation;
  67 + for (unsigned i = 0; i < relations->len; ++i) {
  68 + relation = g_array_index (relations, AtspiRelation*, i);
  69 + if (relation == NULL)
  70 + continue;
  71 + if (atspi_relation_get_relation_type (relation) == ATSPI_RELATION_LABELLED_BY)
  72 + {
  73 + auto res_label = atspi_accessible_get_name (atspi_relation_get_target (relation, 0), NULL);
  74 + g_object_unref (relation);
  75 + g_array_free (relations, true);
  76 + return (res_label == NULL) ? "" : res_label;
  77 + }
  78 + g_object_unref (relation);
60