Merge lp:~smspillaz/compiz-core/compiz-core.cleanup-modifierhandler into lp:compiz-core/0.9.5
- compiz-core.cleanup-modifierhandler
- Merge into 0.9.5
Proposed by
Sam Spilsbury
Status: | Superseded |
---|---|
Proposed branch: | lp:~smspillaz/compiz-core/compiz-core.cleanup-modifierhandler |
Merge into: | lp:compiz-core/0.9.5 |
Diff against target: |
1205 lines (+334/-236) 18 files modified
include/core/abiversion.h (+18/-0) include/core/action.h (+1/-19) include/core/core.h (+0/-24) include/core/modifierhandler.h (+83/-62) include/core/propertywriter.h (+3/-1) include/core/screen.h (+9/-1) plugins/inotify/src/inotify.cpp (+2/-0) plugins/regex/src/regexplugin.h (+2/-0) plugins/resize/src/resize.cpp (+5/-2) src/action.cpp (+28/-38) src/event.cpp (+24/-14) src/main.cpp (+0/-6) src/modifierhandler.cpp (+96/-45) src/privatescreen.h (+2/-0) src/propertywriter.cpp (+27/-7) src/screen.cpp (+26/-13) src/session.cpp (+1/-0) src/window.cpp (+7/-4) |
To merge this branch: | bzr merge lp:~smspillaz/compiz-core/compiz-core.cleanup-modifierhandler |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Compiz Maintainers | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2012-01-24.
Commit message
Description of the change
Clean up the ModifierHandler class , remove #define, remove duplication etc etc
To post a comment you must log in.
Unmerged revisions
- 2953. By Sam Spilsbury
-
Clean up ModifierHandler
- 2952. By Sam Spilsbury
-
Break the dependency of CompAction and CompScreen - use ModifierHandler instead
- 2951. By Sam Spilsbury
-
Assorted cleanups - remove header dependencies from ModifierHandler and PropertyWriter
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'include/core/abiversion.h' |
2 | --- include/core/abiversion.h 2012-01-24 04:59:15 +0000 |
3 | +++ include/core/abiversion.h 2012-01-24 08:23:10 +0000 |
4 | @@ -7,4 +7,22 @@ |
5 | |
6 | #define CORE_ABIVERSION 20120124 |
7 | |
8 | +/* |
9 | + * WORDS_BIGENDIAN should be defined before including this file for |
10 | + * IMAGE_BYTE_ORDER and BITMAP_BIT_ORDER to be set correctly. |
11 | + */ |
12 | +#define LSBFirst 0 |
13 | +#define MSBFirst 1 |
14 | + |
15 | +#ifdef WORDS_BIGENDIAN |
16 | +# define IMAGE_BYTE_ORDER MSBFirst |
17 | +# define BITMAP_BIT_ORDER MSBFirst |
18 | +#else |
19 | +# define IMAGE_BYTE_ORDER LSBFirst |
20 | +# define BITMAP_BIT_ORDER LSBFirst |
21 | +#endif |
22 | + |
23 | +#define STRINGIFY(x) #x |
24 | +#define TOSTRING(x) STRINGIFY (x) |
25 | + |
26 | #endif // COMPIZ_ABIVERSION_H |
27 | |
28 | === modified file 'include/core/action.h' |
29 | --- include/core/action.h 2012-01-24 05:22:38 +0000 |
30 | +++ include/core/action.h 2012-01-24 08:23:10 +0000 |
31 | @@ -29,31 +29,13 @@ |
32 | #define _COMPACTION_H |
33 | |
34 | #include <core/option.h> |
35 | +#include <core/modifierhandler.h> |
36 | |
37 | #include <boost/function.hpp> |
38 | |
39 | |
40 | class PrivateAction; |
41 | |
42 | -#define CompModAlt 0 |
43 | -#define CompModMeta 1 |
44 | -#define CompModSuper 2 |
45 | -#define CompModHyper 3 |
46 | -#define CompModModeSwitch 4 |
47 | -#define CompModNumLock 5 |
48 | -#define CompModScrollLock 6 |
49 | -#define CompModNum 7 |
50 | - |
51 | -#define CompAltMask (1 << 16) |
52 | -#define CompMetaMask (1 << 17) |
53 | -#define CompSuperMask (1 << 18) |
54 | -#define CompHyperMask (1 << 19) |
55 | -#define CompModeSwitchMask (1 << 20) |
56 | -#define CompNumLockMask (1 << 21) |
57 | -#define CompScrollLockMask (1 << 22) |
58 | - |
59 | -#define CompNoMask (1 << 25) |
60 | - |
61 | /** |
62 | * Context of an event occuring. |
63 | */ |
64 | |
65 | === modified file 'include/core/core.h' |
66 | --- include/core/core.h 2012-01-24 04:58:35 +0000 |
67 | +++ include/core/core.h 2012-01-24 08:23:10 +0000 |
68 | @@ -51,30 +51,6 @@ |
69 | typedef XBool Bool; |
70 | #endif |
71 | |
72 | -#include <boost/function.hpp> |
73 | -#include <boost/bind.hpp> |
74 | -#include <boost/foreach.hpp> |
75 | -#define foreach BOOST_FOREACH |
76 | - |
77 | - |
78 | -/* |
79 | - * WORDS_BIGENDIAN should be defined before including this file for |
80 | - * IMAGE_BYTE_ORDER and BITMAP_BIT_ORDER to be set correctly. |
81 | - */ |
82 | -#define LSBFirst 0 |
83 | -#define MSBFirst 1 |
84 | - |
85 | -#ifdef WORDS_BIGENDIAN |
86 | -# define IMAGE_BYTE_ORDER MSBFirst |
87 | -# define BITMAP_BIT_ORDER MSBFirst |
88 | -#else |
89 | -# define IMAGE_BYTE_ORDER LSBFirst |
90 | -# define BITMAP_BIT_ORDER LSBFirst |
91 | -#endif |
92 | - |
93 | -#define STRINGIFY(x) #x |
94 | -#define TOSTRING(x) STRINGIFY (x) |
95 | - |
96 | #include <core/global.h> |
97 | |
98 | #include <core/pluginclasses.h> |
99 | |
100 | === modified file 'include/core/modifierhandler.h' |
101 | --- include/core/modifierhandler.h 2010-03-24 09:37:19 +0000 |
102 | +++ include/core/modifierhandler.h 2012-01-24 08:23:10 +0000 |
103 | @@ -26,22 +26,19 @@ |
104 | * Sam Spilsbury <smspillaz@gmail.com> |
105 | */ |
106 | |
107 | -#include <core/core.h> |
108 | - |
109 | -/** |
110 | - * Toplevel class which provides access to display |
111 | - * level modifier information |
112 | - */ |
113 | -class ModifierHandler |
114 | +#ifndef _COMPIZ_MODIFIERHANDLER_H |
115 | +#define _COMPIZ_MODIFIERHANDLER_H |
116 | + |
117 | +#include <X11/Xlib-xcb.h> |
118 | +#include <string> |
119 | + |
120 | +namespace compiz |
121 | { |
122 | - public: |
123 | - |
124 | - ModifierHandler (); |
125 | - ~ModifierHandler (); |
126 | - |
127 | + namespace modifiers |
128 | + { |
129 | typedef enum |
130 | { |
131 | - Alt = 1, |
132 | + Alt = 0, |
133 | Meta, |
134 | Super, |
135 | Hyper, |
136 | @@ -63,52 +60,76 @@ |
137 | NoMask = (1 << 25), |
138 | } ModMask; |
139 | |
140 | - public: |
141 | - |
142 | - |
143 | - /** |
144 | - * Takes an X11 Keycode and returns a bitmask |
145 | - * with modifiers that have been pressed |
146 | - */ |
147 | - unsigned int keycodeToModifiers (int keycode); |
148 | - |
149 | - /** |
150 | - * Updates X11 Modifier mappings |
151 | - */ |
152 | - void updateModifierMappings (); |
153 | - |
154 | - /** |
155 | - * Takes a virtual modMask and returns a real modifier mask |
156 | - * by removing unused bits |
157 | - */ |
158 | - unsigned int virtualToRealModMask (unsigned int modMask); |
159 | - |
160 | - /** |
161 | - * Returns a bit modifier mask for a Motifier enum |
162 | - */ |
163 | - unsigned int modMask (Modifier); |
164 | - |
165 | - /** |
166 | - * Returns a const bit modifier mask for what should be ignored |
167 | - */ |
168 | - unsigned int ignoredModMask (); |
169 | - |
170 | - /** |
171 | - * Returns a const XModifierKeymap for compiz |
172 | - */ |
173 | - const XModifierKeymap * modMap (); |
174 | - |
175 | - friend class CompScreen; |
176 | - |
177 | - private: |
178 | - |
179 | - static const unsigned int virtualModMask[7]; |
180 | - |
181 | - static const int maskTable[8]; |
182 | - |
183 | - static const int maskTableSize = 8; |
184 | - |
185 | - ModMask mModMask[ModNum]; |
186 | - unsigned int mIgnoredModMask; |
187 | - XModifierKeymap *mModMap; |
188 | -}; |
189 | + /** |
190 | + * Toplevel class which provides access to display |
191 | + * level modifier information |
192 | + */ |
193 | + class ModifierHandler |
194 | + { |
195 | + public: |
196 | + |
197 | + ModifierHandler (Display *); |
198 | + ~ModifierHandler (); |
199 | + |
200 | + public: |
201 | + |
202 | + |
203 | + /** |
204 | + * Takes an X11 Keycode and returns a bitmask |
205 | + * with modifiers that have been pressed |
206 | + */ |
207 | + unsigned int keycodeToModifiers (int keycode); |
208 | + |
209 | + /** |
210 | + * Updates X11 Modifier mappings |
211 | + */ |
212 | + bool updateModifierMappings (); |
213 | + |
214 | + /** |
215 | + * Takes a virtual modMask and returns a real modifier mask |
216 | + * by removing unused bits |
217 | + */ |
218 | + unsigned int virtualToRealModMask (unsigned int modMask); |
219 | + |
220 | + /** |
221 | + * Takes a key string and returns a keycode |
222 | + */ |
223 | + int stringToKeycode (const std::string &) const; |
224 | + |
225 | + /** |
226 | + * Takes a keycode and returns a key string |
227 | + */ |
228 | + std::string keycodeToString (int keycode) const; |
229 | + |
230 | + /** |
231 | + * Returns a bit modifier mask for a Motifier enum |
232 | + */ |
233 | + unsigned int modMask (Modifier); |
234 | + |
235 | + /** |
236 | + * Returns a const bit modifier mask for what should be ignored |
237 | + */ |
238 | + unsigned int ignoredModMask (); |
239 | + |
240 | + /** |
241 | + * Returns a const XModifierKeymap for compiz |
242 | + */ |
243 | + const XModifierKeymap * modMap (); |
244 | + |
245 | + static ModifierHandler * |
246 | + Default (); |
247 | + |
248 | + static void |
249 | + SetDefault (ModifierHandler *); |
250 | + private: |
251 | + |
252 | + ModMask mModMask[ModNum]; |
253 | + unsigned int mIgnoredModMask; |
254 | + XModifierKeymap *mModMap; |
255 | + |
256 | + Display *mDisplay; |
257 | + }; |
258 | + } |
259 | +} |
260 | + |
261 | +#endif |
262 | |
263 | === modified file 'include/core/propertywriter.h' |
264 | --- include/core/propertywriter.h 2012-01-18 16:26:45 +0000 |
265 | +++ include/core/propertywriter.h 2012-01-24 08:23:10 +0000 |
266 | @@ -30,7 +30,7 @@ |
267 | #include "core/string.h" |
268 | |
269 | #include <X11/Xatom.h> |
270 | -#include <X11/X.h> |
271 | +#include <X11/Xlib-xcb.h> |
272 | |
273 | static const CompOption::Vector nilValues; |
274 | |
275 | @@ -48,6 +48,8 @@ |
276 | void setReadTemplate (const CompOption::Vector &); |
277 | const CompOption::Vector & getReadTemplate (); |
278 | |
279 | + static void connect (Display *); |
280 | + |
281 | private: |
282 | |
283 | CompOption::Vector mPropertyValues; |
284 | |
285 | === modified file 'include/core/screen.h' |
286 | --- include/core/screen.h 2012-01-24 04:58:35 +0000 |
287 | +++ include/core/screen.h 2012-01-24 08:23:10 +0000 |
288 | @@ -28,6 +28,12 @@ |
289 | #ifndef _COMPSCREEN_H |
290 | #define _COMPSCREEN_H |
291 | |
292 | +#include <boost/function.hpp> |
293 | +#include <boost/bind.hpp> |
294 | +#include <boost/foreach.hpp> |
295 | +#define foreach BOOST_FOREACH |
296 | + |
297 | +#include <core/abiversion.h> |
298 | #include <core/window.h> |
299 | #include <core/output.h> |
300 | #include <core/session.h> |
301 | @@ -38,6 +44,9 @@ |
302 | #include <core/modifierhandler.h> |
303 | #include <core/valueholder.h> |
304 | #include <core/actionbindings.h> |
305 | +#include <core/plugin.h> |
306 | + |
307 | +#include <X11/extensions/Xinerama.h> |
308 | |
309 | class CompScreen; |
310 | class PrivateScreen; |
311 | @@ -53,7 +62,6 @@ |
312 | extern bool debugOutput; |
313 | |
314 | extern CompScreen *screen; |
315 | -extern ModifierHandler *modHandler; |
316 | |
317 | extern int lastPointerX; |
318 | extern int lastPointerY; |
319 | |
320 | === modified file 'plugins/inotify/src/inotify.cpp' |
321 | --- plugins/inotify/src/inotify.cpp 2012-01-18 16:26:45 +0000 |
322 | +++ plugins/inotify/src/inotify.cpp 2012-01-24 08:23:10 +0000 |
323 | @@ -30,6 +30,8 @@ |
324 | #include <poll.h> |
325 | #include <sys/inotify.h> |
326 | |
327 | +#include <cstdio> |
328 | +#include <boost/bind.hpp> |
329 | |
330 | COMPIZ_PLUGIN_20090315 (inotify, InotifyPluginVTable) |
331 | |
332 | |
333 | === modified file 'plugins/regex/src/regexplugin.h' |
334 | --- plugins/regex/src/regexplugin.h 2012-01-18 16:26:45 +0000 |
335 | +++ plugins/regex/src/regexplugin.h 2012-01-24 08:23:10 +0000 |
336 | @@ -26,8 +26,10 @@ |
337 | #ifndef COMPIZ_REGEXPLUGIN_H |
338 | #define COMPIZ_REGEXPLUGIN_H |
339 | |
340 | +#include <core/core.h> |
341 | #include <core/screen.h> |
342 | #include <core/pluginclasshandler.h> |
343 | +#include <core/timer.h> |
344 | |
345 | #include <X11/Xatom.h> |
346 | |
347 | |
348 | === modified file 'plugins/resize/src/resize.cpp' |
349 | --- plugins/resize/src/resize.cpp 2012-01-18 16:26:45 +0000 |
350 | +++ plugins/resize/src/resize.cpp 2012-01-24 08:23:10 +0000 |
351 | @@ -32,8 +32,11 @@ |
352 | #include <X11/cursorfont.h> |
353 | |
354 | #include <core/atoms.h> |
355 | +#include <core/modifierhandler.h> |
356 | #include "resize.h" |
357 | |
358 | +using namespace compiz::modifiers; |
359 | + |
360 | COMPIZ_PLUGIN_20090315 (resize, ResizePluginVTable) |
361 | |
362 | void |
363 | @@ -1713,11 +1716,11 @@ |
364 | if (valueMask & ResizeModeShiftMask) |
365 | *mask |= ShiftMask; |
366 | if (valueMask & ResizeModeAltMask) |
367 | - *mask |= CompAltMask; |
368 | + *mask |= AltMask; |
369 | if (valueMask & ResizeModeControlMask) |
370 | *mask |= ControlMask; |
371 | if (valueMask & ResizeModeMetaMask) |
372 | - *mask |= CompMetaMask; |
373 | + *mask |= MetaMask; |
374 | } |
375 | |
376 | void |
377 | |
378 | === modified file 'src/action.cpp' |
379 | --- src/action.cpp 2012-01-24 05:22:38 +0000 |
380 | +++ src/action.cpp 2012-01-24 08:23:10 +0000 |
381 | @@ -33,12 +33,12 @@ |
382 | #include "privateaction.h" |
383 | #include "privatescreen.h" |
384 | |
385 | -#include <X11/Xlib-xcb.h> |
386 | +using namespace compiz; |
387 | |
388 | struct _Modifier { |
389 | const char *name; |
390 | int modifier; |
391 | -} modifiers[] = { |
392 | +} allModifiers[] = { |
393 | { "<Shift>", ShiftMask }, |
394 | { "<Control>", ControlMask }, |
395 | { "<Mod1>", Mod1Mask }, |
396 | @@ -46,14 +46,14 @@ |
397 | { "<Mod3>", Mod3Mask }, |
398 | { "<Mod4>", Mod4Mask }, |
399 | { "<Mod5>", Mod5Mask }, |
400 | - { "<Alt>", CompAltMask }, |
401 | - { "<Meta>", CompMetaMask }, |
402 | - { "<Super>", CompSuperMask }, |
403 | - { "<Hyper>", CompHyperMask }, |
404 | - { "<ModeSwitch>", CompModeSwitchMask } |
405 | + { "<Alt>", modifiers::AltMask }, |
406 | + { "<Meta>", modifiers::MetaMask }, |
407 | + { "<Super>", modifiers::SuperMask }, |
408 | + { "<Hyper>", modifiers::HyperMask }, |
409 | + { "<ModeSwitch>", modifiers::ModeSwitchMask } |
410 | }; |
411 | |
412 | -#define N_MODIFIERS (sizeof (modifiers) / sizeof (struct _Modifier)) |
413 | +#define N_MODIFIERS (sizeof (allModifiers) / sizeof (struct _Modifier)) |
414 | |
415 | struct _Edge { |
416 | const char *name; |
417 | @@ -76,8 +76,8 @@ |
418 | |
419 | for (unsigned int i = 0; i < N_MODIFIERS; i++) |
420 | { |
421 | - if (modMask & modifiers[i].modifier) |
422 | - binding += modifiers[i].name; |
423 | + if (modMask & allModifiers[i].modifier) |
424 | + binding += allModifiers[i].name; |
425 | } |
426 | |
427 | return binding; |
428 | @@ -90,8 +90,8 @@ |
429 | |
430 | for (unsigned int i = 0; i < N_MODIFIERS; i++) |
431 | { |
432 | - if (str.find (modifiers[i].name) != std::string::npos) |
433 | - mods |= modifiers[i].modifier; |
434 | + if (str.find (allModifiers[i].name) != std::string::npos) |
435 | + mods |= allModifiers[i].modifier; |
436 | } |
437 | |
438 | return mods; |
439 | @@ -158,7 +158,7 @@ |
440 | CompString sStr; |
441 | unsigned int mods; |
442 | size_t pos, start = 0; |
443 | - KeySym keysym; |
444 | + int keycode; |
445 | |
446 | if (!screen) |
447 | return false; |
448 | @@ -186,31 +186,25 @@ |
449 | } |
450 | |
451 | sStr = str.substr (start); |
452 | - keysym = XStringToKeysym (sStr.c_str ()); |
453 | + keycode = modifiers::ModifierHandler::Default ()->stringToKeycode (sStr); |
454 | |
455 | - if (keysym != NoSymbol) |
456 | + if (!keycode) |
457 | { |
458 | - KeyCode keycode; |
459 | - |
460 | - keycode = XKeysymToKeycode (screen->dpy (), keysym); |
461 | - if (keycode) |
462 | + if (sStr.compare (0, 2, "0x") == 0) |
463 | { |
464 | - mKeycode = keycode; |
465 | + mKeycode = strtol (sStr.c_str (), NULL, 0); |
466 | mModifiers = mods; |
467 | |
468 | return true; |
469 | } |
470 | - } |
471 | - |
472 | - if (sStr.compare (0, 2, "0x") == 0) |
473 | - { |
474 | - mKeycode = strtol (sStr.c_str (), NULL, 0); |
475 | - mModifiers = mods; |
476 | - |
477 | - return true; |
478 | - } |
479 | - |
480 | - return false; |
481 | + else |
482 | + return false; |
483 | + } |
484 | + |
485 | + mModifiers = mods; |
486 | + mKeycode = keycode; |
487 | + |
488 | + return true; |
489 | } |
490 | |
491 | CompString |
492 | @@ -225,13 +219,9 @@ |
493 | |
494 | if (mKeycode != 0) |
495 | { |
496 | - KeySym keysym; |
497 | - char *keyname; |
498 | - |
499 | - keysym = XKeycodeToKeysym (screen->dpy (), mKeycode, 0); |
500 | - keyname = XKeysymToString (keysym); |
501 | - |
502 | - if (keyname) |
503 | + std::string keyname (modifiers::ModifierHandler::Default ()->keycodeToString (mKeycode)); |
504 | + |
505 | + if (!keyname.empty ()) |
506 | binding += keyname; |
507 | else |
508 | binding += compPrintf ("0x%x", mKeycode); |
509 | |
510 | === modified file 'src/event.cpp' |
511 | --- src/event.cpp 2012-01-19 18:12:31 +0000 |
512 | +++ src/event.cpp 2012-01-24 08:23:10 +0000 |
513 | @@ -37,10 +37,13 @@ |
514 | #include <X11/extensions/Xfixes.h> |
515 | |
516 | #include <core/atoms.h> |
517 | +#include <core/modifierhandler.h> |
518 | #include "privatescreen.h" |
519 | #include "privatewindow.h" |
520 | #include "privatestackdebugger.h" |
521 | |
522 | +using namespace compiz::modifiers; |
523 | + |
524 | bool |
525 | PrivateWindow::handleSyncAlarm () |
526 | { |
527 | @@ -80,8 +83,10 @@ |
528 | return false; |
529 | } |
530 | |
531 | -#define REAL_MOD_MASK (ShiftMask | ControlMask | Mod1Mask | Mod2Mask | \ |
532 | - Mod3Mask | Mod4Mask | Mod5Mask | CompNoMask) |
533 | +const unsigned int REAL_MOD_MASK = (ShiftMask | ControlMask | |
534 | + Mod1Mask | Mod2Mask | |
535 | + Mod3Mask | Mod4Mask | |
536 | + Mod5Mask | compiz::modifiers::NoMask); |
537 | |
538 | static bool |
539 | isCallBackBinding (CompOption &option, |
540 | @@ -141,7 +146,7 @@ |
541 | { |
542 | CompAction::State state = CompAction::StateInitButton; |
543 | CompAction *action; |
544 | - unsigned int ignored = modHandler->ignoredModMask (); |
545 | + unsigned int ignored = ModifierHandler::Default ()->ignoredModMask (); |
546 | unsigned int modMask = REAL_MOD_MASK & ~ignored; |
547 | unsigned int bindMods; |
548 | unsigned int edge = 0; |
549 | @@ -177,7 +182,7 @@ |
550 | { |
551 | if (action->button ().button () == (int) event->button) |
552 | { |
553 | - bindMods = modHandler->virtualToRealModMask ( |
554 | + bindMods = ModifierHandler::Default ()->virtualToRealModMask ( |
555 | action->button ().modifiers ()); |
556 | |
557 | if ((bindMods & modMask) == (event->state & modMask)) |
558 | @@ -196,7 +201,7 @@ |
559 | if ((action->button ().button () == (int) event->button) && |
560 | (action->edgeMask () & edge)) |
561 | { |
562 | - bindMods = modHandler->virtualToRealModMask ( |
563 | + bindMods = ModifierHandler::Default ()->virtualToRealModMask ( |
564 | action->button ().modifiers ()); |
565 | |
566 | if ((bindMods & modMask) == (event->state & modMask)) |
567 | @@ -244,7 +249,7 @@ |
568 | { |
569 | CompAction::State state = 0; |
570 | CompAction *action; |
571 | - unsigned int modMask = REAL_MOD_MASK & ~modHandler->ignoredModMask (); |
572 | + unsigned int modMask = REAL_MOD_MASK & ~ModifierHandler::Default ()->ignoredModMask (); |
573 | unsigned int bindMods; |
574 | |
575 | if (event->keycode == escapeKeyCode) |
576 | @@ -274,7 +279,7 @@ |
577 | if (isInitiateBinding (option, CompAction::BindingTypeKey, |
578 | state, &action)) |
579 | { |
580 | - bindMods = modHandler->virtualToRealModMask ( |
581 | + bindMods = ModifierHandler::Default ()->virtualToRealModMask ( |
582 | action->key ().modifiers ()); |
583 | |
584 | if (action->key ().keycode () == (int) event->keycode) |
585 | @@ -302,12 +307,12 @@ |
586 | { |
587 | CompAction::State state = CompAction::StateTermKey; |
588 | CompAction *action; |
589 | - unsigned int ignored = modHandler->ignoredModMask (); |
590 | + unsigned int ignored = ModifierHandler::Default ()->ignoredModMask (); |
591 | unsigned int modMask = REAL_MOD_MASK & ~ignored; |
592 | unsigned int bindMods; |
593 | unsigned int mods; |
594 | |
595 | - mods = modHandler->keycodeToModifiers (event->keycode); |
596 | + mods = ModifierHandler::Default ()->keycodeToModifiers (event->keycode); |
597 | if (!xkbEvent && !mods) |
598 | return false; |
599 | |
600 | @@ -316,7 +321,7 @@ |
601 | if (isTerminateBinding (option, CompAction::BindingTypeKey, |
602 | state, &action)) |
603 | { |
604 | - bindMods = modHandler->virtualToRealModMask (action->key ().modifiers ()); |
605 | + bindMods = ModifierHandler::Default ()->virtualToRealModMask (action->key ().modifiers ()); |
606 | |
607 | if ((bindMods & modMask) == 0) |
608 | { |
609 | @@ -345,7 +350,7 @@ |
610 | { |
611 | CompAction::State state; |
612 | CompAction *action; |
613 | - unsigned int ignored = modHandler->ignoredModMask (); |
614 | + unsigned int ignored = ModifierHandler::Default ()->ignoredModMask (); |
615 | unsigned int modMask = REAL_MOD_MASK & ~ignored; |
616 | unsigned int bindMods; |
617 | |
618 | @@ -361,7 +366,7 @@ |
619 | if (action->key ().keycode () == 0) |
620 | { |
621 | bindMods = |
622 | - modHandler->virtualToRealModMask (action->key ().modifiers ()); |
623 | + ModifierHandler::Default ()->virtualToRealModMask (action->key ().modifiers ()); |
624 | |
625 | if ((event->mods & modMask & bindMods) == bindMods) |
626 | { |
627 | @@ -381,7 +386,7 @@ |
628 | if (isTerminateBinding (option, CompAction::BindingTypeKey, |
629 | state, &action)) |
630 | { |
631 | - bindMods = modHandler->virtualToRealModMask (action->key ().modifiers ()); |
632 | + bindMods = ModifierHandler::Default ()->virtualToRealModMask (action->key ().modifiers ()); |
633 | |
634 | if ((event->mods & modMask & bindMods) != bindMods) |
635 | { |
636 | @@ -1709,7 +1714,12 @@ |
637 | } |
638 | break; |
639 | case MappingNotify: |
640 | - modHandler->updateModifierMappings (); |
641 | + if (ModifierHandler::Default ()->updateModifierMappings ()) |
642 | + { |
643 | + priv->updatePassiveKeyGrabs (); |
644 | + foreach (CompWindow *w, screen->windows ()) |
645 | + w->priv->updatePassiveButtonGrabs (); |
646 | + } |
647 | break; |
648 | case MapRequest: |
649 | w = screen->findWindow (event->xmaprequest.window); |
650 | |
651 | === modified file 'src/main.cpp' |
652 | --- src/main.cpp 2012-01-23 17:45:39 +0000 |
653 | +++ src/main.cpp 2012-01-24 08:23:10 +0000 |
654 | @@ -172,11 +172,6 @@ |
655 | return false; |
656 | } |
657 | |
658 | - modHandler = new ModifierHandler (); |
659 | - |
660 | - if (!modHandler) |
661 | - return false; |
662 | - |
663 | if (!plugins.empty ()) |
664 | { |
665 | CompOption::Value::Vector list; |
666 | @@ -239,7 +234,6 @@ |
667 | StackDebugger::SetDefault (NULL); |
668 | |
669 | delete screen; |
670 | - delete modHandler; |
671 | } |
672 | |
673 | |
674 | |
675 | === modified file 'src/modifierhandler.cpp' |
676 | --- src/modifierhandler.cpp 2011-01-07 20:06:40 +0000 |
677 | +++ src/modifierhandler.cpp 2012-01-24 08:23:10 +0000 |
678 | @@ -26,19 +26,35 @@ |
679 | * Sam Spilsbury <smspillaz@gmail.com> |
680 | */ |
681 | |
682 | -#include <core/screen.h> |
683 | -#include "privatescreen.h" |
684 | -#include "privatewindow.h" |
685 | - |
686 | -const unsigned int ModifierHandler::virtualModMask[7] = { |
687 | - CompAltMask, CompMetaMask, CompSuperMask, CompHyperMask, |
688 | - CompModeSwitchMask, CompNumLockMask, CompScrollLockMask |
689 | -}; |
690 | - |
691 | -const int ModifierHandler::maskTable[8] = { |
692 | - ShiftMask, LockMask, ControlMask, Mod1Mask, |
693 | - Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask |
694 | -}; |
695 | +#include <core/modifierhandler.h> |
696 | +#include <assert.h> |
697 | +#include <X11/keysym.h> |
698 | +#include <cstring> |
699 | + |
700 | +using namespace compiz; |
701 | + |
702 | +typedef modifiers::ModifierHandler ModifierHandler; |
703 | + |
704 | +namespace |
705 | +{ |
706 | + |
707 | +const unsigned int virtualModMask[7] = { |
708 | + modifiers::AltMask, |
709 | + modifiers::MetaMask, |
710 | + modifiers::SuperMask, |
711 | + modifiers::HyperMask, |
712 | + modifiers::ModeSwitchMask, |
713 | + modifiers::NumLockMask, |
714 | + modifiers::ScrollLockMask |
715 | +}; |
716 | +const int maskTable[8] = { |
717 | + ShiftMask, LockMask, ControlMask, Mod1Mask, |
718 | + Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask |
719 | +}; |
720 | +const int maskTableSize = 8; |
721 | + |
722 | +ModifierHandler *gDefault = NULL; |
723 | +} |
724 | |
725 | unsigned int |
726 | ModifierHandler::ignoredModMask () |
727 | @@ -52,25 +68,25 @@ |
728 | return mModMap; |
729 | } |
730 | |
731 | -void |
732 | +bool |
733 | ModifierHandler::updateModifierMappings () |
734 | { |
735 | - unsigned int modMask[CompModNum]; |
736 | - int i, minKeycode, maxKeycode, keysymsPerKeycode = 0; |
737 | + unsigned int modMask[modifiers::ModNum]; |
738 | + int minKeycode, maxKeycode, keysymsPerKeycode = 0; |
739 | KeySym* key; |
740 | |
741 | - for (i = 0; i < CompModNum; i++) |
742 | + for (unsigned int i = 0; i < modifiers::ModNum; i++) |
743 | modMask[i] = 0; |
744 | |
745 | - XDisplayKeycodes (screen->dpy (), &minKeycode, &maxKeycode); |
746 | - key = XGetKeyboardMapping (screen->dpy (), |
747 | + XDisplayKeycodes (mDisplay, &minKeycode, &maxKeycode); |
748 | + key = XGetKeyboardMapping (mDisplay, |
749 | minKeycode, (maxKeycode - minKeycode + 1), |
750 | &keysymsPerKeycode); |
751 | |
752 | if (mModMap) |
753 | XFreeModifiermap (mModMap); |
754 | |
755 | - mModMap = XGetModifierMapping (screen->dpy ()); |
756 | + mModMap = XGetModifierMapping (mDisplay); |
757 | if (mModMap && mModMap->max_keypermod > 0) |
758 | { |
759 | KeySym keysym; |
760 | @@ -78,7 +94,7 @@ |
761 | |
762 | size = maskTableSize * mModMap->max_keypermod; |
763 | |
764 | - for (i = 0; i < size; i++) |
765 | + for (int i = 0; i < size; i++) |
766 | { |
767 | if (!mModMap->modifiermap[i]) |
768 | continue; |
769 | @@ -86,7 +102,7 @@ |
770 | index = 0; |
771 | do |
772 | { |
773 | - keysym = XKeycodeToKeysym (screen->dpy (), |
774 | + keysym = XKeycodeToKeysym (mDisplay, |
775 | mModMap->modifiermap[i], |
776 | index++); |
777 | } while (!keysym && index < keysymsPerKeycode); |
778 | @@ -98,42 +114,42 @@ |
779 | if (keysym == XK_Alt_L || |
780 | keysym == XK_Alt_R) |
781 | { |
782 | - modMask[CompModAlt] |= mask; |
783 | + modMask[modifiers::Alt] |= mask; |
784 | } |
785 | else if (keysym == XK_Meta_L || |
786 | keysym == XK_Meta_R) |
787 | { |
788 | - modMask[CompModMeta] |= mask; |
789 | + modMask[modifiers::Meta] |= mask; |
790 | } |
791 | else if (keysym == XK_Super_L || |
792 | keysym == XK_Super_R) |
793 | { |
794 | - modMask[CompModSuper] |= mask; |
795 | + modMask[modifiers::Super] |= mask; |
796 | } |
797 | else if (keysym == XK_Hyper_L || |
798 | keysym == XK_Hyper_R) |
799 | { |
800 | - modMask[CompModHyper] |= mask; |
801 | + modMask[modifiers::Hyper] |= mask; |
802 | } |
803 | else if (keysym == XK_Mode_switch) |
804 | { |
805 | - modMask[CompModModeSwitch] |= mask; |
806 | + modMask[modifiers::ModeSwitch] |= mask; |
807 | } |
808 | else if (keysym == XK_Scroll_Lock) |
809 | { |
810 | - modMask[CompModScrollLock] |= mask; |
811 | + modMask[modifiers::ScrollLock] |= mask; |
812 | } |
813 | else if (keysym == XK_Num_Lock) |
814 | { |
815 | - modMask[CompModNumLock] |= mask; |
816 | + modMask[modifiers::NumLock] |= mask; |
817 | } |
818 | } |
819 | } |
820 | |
821 | - for (i = 0; i < CompModNum; i++) |
822 | + for (unsigned int i = 0; i < modifiers::ModNum; i++) |
823 | { |
824 | if (!modMask[i]) |
825 | - modMask[i] = CompNoMask; |
826 | + modMask[i] = modifiers::NoMask; |
827 | } |
828 | |
829 | if (memcmp (modMask, mModMask, sizeof (modMask))) |
830 | @@ -141,25 +157,23 @@ |
831 | memcpy (mModMask, modMask, sizeof (modMask)); |
832 | |
833 | mIgnoredModMask = LockMask | |
834 | - (modMask[CompModNumLock] & ~CompNoMask) | |
835 | - (modMask[CompModScrollLock] & ~CompNoMask); |
836 | - |
837 | - screen->priv->updatePassiveKeyGrabs (); |
838 | - foreach (CompWindow *w, screen->windows ()) |
839 | - w->priv->updatePassiveButtonGrabs (); |
840 | + (modMask[modifiers::NumLock] & ~modifiers::NoMask) | |
841 | + (modMask[modifiers::ScrollLock] & ~modifiers::NoMask); |
842 | + |
843 | + if (key) |
844 | + XFree (key); |
845 | + |
846 | + return true; |
847 | } |
848 | } |
849 | |
850 | - if (key) |
851 | - XFree (key); |
852 | + return false; |
853 | } |
854 | |
855 | unsigned int |
856 | ModifierHandler::virtualToRealModMask (unsigned int modMask) |
857 | { |
858 | - int i; |
859 | - |
860 | - for (i = 0; i < CompModNum; i++) |
861 | + for (unsigned int i = 0; i < modifiers::ModNum; i++) |
862 | { |
863 | if (modMask & virtualModMask[i]) |
864 | { |
865 | @@ -190,11 +204,48 @@ |
866 | return mods; |
867 | } |
868 | |
869 | -ModifierHandler::ModifierHandler () : |
870 | +int |
871 | +ModifierHandler::stringToKeycode (const std::string &str) const |
872 | +{ |
873 | + KeySym keysym = XStringToKeysym (str.c_str ()); |
874 | + |
875 | + if (keysym != NoSymbol) |
876 | + return static_cast <int> (XKeysymToKeycode (mDisplay, keysym)); |
877 | + |
878 | + return 0; |
879 | +} |
880 | + |
881 | +std::string |
882 | +ModifierHandler::keycodeToString (int keycode) const |
883 | +{ |
884 | + KeySym keysym; |
885 | + std::string keyname; |
886 | + |
887 | + keysym = XKeycodeToKeysym (mDisplay, keycode, 0); |
888 | + keyname = std::string (XKeysymToString (keysym)); |
889 | + |
890 | + return keyname; |
891 | +} |
892 | + |
893 | +ModifierHandler * |
894 | +ModifierHandler::Default () |
895 | +{ |
896 | + return gDefault; |
897 | +} |
898 | + |
899 | +void |
900 | +ModifierHandler::SetDefault (ModifierHandler *m) |
901 | +{ |
902 | + assert (!gDefault); |
903 | + gDefault = m; |
904 | +} |
905 | + |
906 | +ModifierHandler::ModifierHandler (Display *display) : |
907 | mIgnoredModMask (LockMask), |
908 | - mModMap (0) |
909 | + mModMap (0), |
910 | + mDisplay (display) |
911 | { |
912 | - for (int i = 0; i < ModNum; i++) |
913 | + for (int i = 0; i < modifiers::ModNum; i++) |
914 | mModMask[i] = NoMask; |
915 | } |
916 | |
917 | |
918 | === modified file 'src/privatescreen.h' |
919 | --- src/privatescreen.h 2012-01-21 13:34:31 +0000 |
920 | +++ src/privatescreen.h 2012-01-24 08:23:10 +0000 |
921 | @@ -407,6 +407,8 @@ |
922 | std::list< CompWatchFd * > watchFds; |
923 | CompWatchFdHandle lastWatchFdHandle; |
924 | |
925 | + compiz::modifiers::ModifierHandler *modHandler; |
926 | + |
927 | std::map<CompString, CompPrivate> valueMap; |
928 | |
929 | xcb_connection_t *connection; |
930 | |
931 | === modified file 'src/propertywriter.cpp' |
932 | --- src/propertywriter.cpp 2012-01-18 16:26:45 +0000 |
933 | +++ src/propertywriter.cpp 2012-01-24 08:23:10 +0000 |
934 | @@ -23,8 +23,28 @@ |
935 | * Authors: Sam Spilsbury <smspillaz@gmail.com> |
936 | */ |
937 | |
938 | +#include <core/match.h> |
939 | +#include <core/action.h> |
940 | #include <core/propertywriter.h> |
941 | -#include <core/screen.h> |
942 | +#include <boost/foreach.hpp> |
943 | +#include <X11/Xlib-xcb.h> |
944 | +#include <X11/Xutil.h> |
945 | + |
946 | +#ifndef foreach |
947 | +#define foreach BOOST_FOREACH |
948 | +#endif |
949 | + |
950 | +namespace |
951 | +{ |
952 | + Display *connection = NULL; |
953 | +} |
954 | + |
955 | +void |
956 | +PropertyWriter::connect (Display *display) |
957 | +{ |
958 | + assert (!connection); |
959 | + connection = display; |
960 | +} |
961 | |
962 | PropertyWriter::PropertyWriter () |
963 | { |
964 | @@ -34,7 +54,7 @@ |
965 | CompOption::Vector &readTemplate) |
966 | { |
967 | mPropertyValues = readTemplate; |
968 | - mAtom = XInternAtom (screen->dpy (), propName.c_str (), 0); |
969 | + mAtom = XInternAtom (connection, propName.c_str (), 0); |
970 | } |
971 | |
972 | void |
973 | @@ -79,7 +99,7 @@ |
974 | count++; |
975 | } |
976 | |
977 | - XChangeProperty (screen->dpy (), id, |
978 | + XChangeProperty (connection, id, |
979 | mAtom, type, 32, |
980 | PropModeReplace, (unsigned char *)data, |
981 | propertyData.size ()); |
982 | @@ -117,7 +137,7 @@ |
983 | { |
984 | if (XStringListToTextProperty (data, count, &prop)) |
985 | { |
986 | - XSetTextProperty (screen->dpy (), id, &prop, mAtom); |
987 | + XSetTextProperty (connection, id, &prop, mAtom); |
988 | XFree (prop.value); |
989 | } |
990 | } |
991 | @@ -129,7 +149,7 @@ |
992 | void |
993 | PropertyWriter::deleteProperty (Window id) |
994 | { |
995 | - XDeleteProperty (screen->dpy (), id, mAtom); |
996 | + XDeleteProperty (connection, id, mAtom); |
997 | } |
998 | |
999 | const CompOption::Vector & |
1000 | @@ -143,7 +163,7 @@ |
1001 | if (mPropertyValues.empty ()) |
1002 | return mPropertyValues; |
1003 | |
1004 | - retval = XGetWindowProperty (screen->dpy (), id, mAtom, 0, |
1005 | + retval = XGetWindowProperty (connection, id, mAtom, 0, |
1006 | mPropertyValues.size (), False, XA_CARDINAL, |
1007 | &type, &fmt, &nitems, &exbyte, |
1008 | (unsigned char **)&data); |
1009 | @@ -184,7 +204,7 @@ |
1010 | else if (type == XA_STRING && fmt == 8) |
1011 | { |
1012 | XTextProperty tProp; |
1013 | - retval = XGetTextProperty (screen->dpy (), id, &tProp, mAtom); |
1014 | + retval = XGetTextProperty (connection, id, &tProp, mAtom); |
1015 | |
1016 | if (tProp.value) |
1017 | { |
1018 | |
1019 | === modified file 'src/screen.cpp' |
1020 | --- src/screen.cpp 2012-01-24 04:58:35 +0000 |
1021 | +++ src/screen.cpp 2012-01-24 08:23:10 +0000 |
1022 | @@ -55,11 +55,14 @@ |
1023 | #include <core/screen.h> |
1024 | #include <core/icon.h> |
1025 | #include <core/atoms.h> |
1026 | +#include <core/propertywriter.h> |
1027 | #include "privatescreen.h" |
1028 | #include "privatewindow.h" |
1029 | #include "privateaction.h" |
1030 | #include "privatestackdebugger.h" |
1031 | |
1032 | +using namespace compiz::modifiers; |
1033 | + |
1034 | bool inHandleEvent = false; |
1035 | |
1036 | bool screenInitalized = false; |
1037 | @@ -87,7 +90,6 @@ |
1038 | |
1039 | |
1040 | CompScreen *screen; |
1041 | -ModifierHandler *modHandler; |
1042 | |
1043 | PluginClassStorage::Indices screenPluginClassIndices (0); |
1044 | |
1045 | @@ -3010,9 +3012,9 @@ |
1046 | |
1047 | CompScreen::checkForError (dpy); |
1048 | |
1049 | - for (ignore = 0; ignore <= modHandler->ignoredModMask (); ignore++) |
1050 | + for (ignore = 0; ignore <= ModifierHandler::Default ()->ignoredModMask (); ignore++) |
1051 | { |
1052 | - if (ignore & ~modHandler->ignoredModMask ()) |
1053 | + if (ignore & ~ModifierHandler::Default ()->ignoredModMask ()) |
1054 | continue; |
1055 | |
1056 | if (keycode != 0) |
1057 | @@ -3025,15 +3027,15 @@ |
1058 | { |
1059 | if (modifiers & (1 << mod)) |
1060 | { |
1061 | - for (k = mod * modHandler->modMap ()->max_keypermod; |
1062 | - k < (mod + 1) * modHandler->modMap ()->max_keypermod; |
1063 | + for (k = mod * ModifierHandler::Default ()->modMap ()->max_keypermod; |
1064 | + k < (mod + 1) * ModifierHandler::Default ()->modMap ()->max_keypermod; |
1065 | k++) |
1066 | { |
1067 | - if (modHandler->modMap ()->modifiermap[k]) |
1068 | + if (ModifierHandler::Default ()->modMap ()->modifiermap[k]) |
1069 | { |
1070 | grabUngrabOneKey ((modifiers & ~(1 << mod)) | |
1071 | ignore, |
1072 | - modHandler->modMap ()->modifiermap[k], |
1073 | + ModifierHandler::Default ()->modMap ()->modifiermap[k], |
1074 | grab); |
1075 | } |
1076 | } |
1077 | @@ -3055,7 +3057,7 @@ |
1078 | unsigned int mask; |
1079 | std::list<KeyGrab>::iterator it; |
1080 | |
1081 | - mask = modHandler->virtualToRealModMask (key.modifiers ()); |
1082 | + mask = ModifierHandler::Default ()->virtualToRealModMask (key.modifiers ()); |
1083 | |
1084 | for (it = keyGrabs.begin (); it != keyGrabs.end (); it++) |
1085 | { |
1086 | @@ -3069,7 +3071,7 @@ |
1087 | |
1088 | |
1089 | |
1090 | - if (!(mask & CompNoMask)) |
1091 | + if (!(mask & compiz::modifiers::NoMask)) |
1092 | { |
1093 | if (!grabUngrabKeys (mask, key.keycode (), true)) |
1094 | return false; |
1095 | @@ -3090,7 +3092,7 @@ |
1096 | unsigned int mask; |
1097 | std::list<KeyGrab>::iterator it; |
1098 | |
1099 | - mask = modHandler->virtualToRealModMask (key.modifiers ()); |
1100 | + mask = ModifierHandler::Default ()->virtualToRealModMask (key.modifiers ()); |
1101 | |
1102 | for (it = keyGrabs.begin (); it != keyGrabs.end (); it++) |
1103 | { |
1104 | @@ -3103,7 +3105,7 @@ |
1105 | |
1106 | it = keyGrabs.erase (it); |
1107 | |
1108 | - if (!(mask & CompNoMask)) |
1109 | + if (!(mask & compiz::modifiers::NoMask)) |
1110 | grabUngrabKeys (mask, key.keycode (), false); |
1111 | } |
1112 | } |
1113 | @@ -3118,7 +3120,7 @@ |
1114 | |
1115 | for (it = keyGrabs.begin (); it != keyGrabs.end (); it++) |
1116 | { |
1117 | - if (!((*it).modifiers & CompNoMask)) |
1118 | + if (!((*it).modifiers & compiz::modifiers::NoMask)) |
1119 | { |
1120 | grabUngrabKeys ((*it).modifiers, |
1121 | (*it).keycode, true); |
1122 | @@ -4401,6 +4403,11 @@ |
1123 | return false; |
1124 | } |
1125 | |
1126 | + priv->modHandler = new ModifierHandler (priv->dpy); |
1127 | + |
1128 | + PropertyWriter::connect (priv->dpy); |
1129 | + ModifierHandler::SetDefault (priv->modHandler); |
1130 | + |
1131 | XSynchronize (dpy, TRUE); |
1132 | |
1133 | // priv->connection = XGetXCBConnection (priv->dpy); |
1134 | @@ -4538,7 +4545,12 @@ |
1135 | } while (event.type != DestroyNotify); |
1136 | } |
1137 | |
1138 | - modHandler->updateModifierMappings (); |
1139 | + if (ModifierHandler::Default ()->updateModifierMappings ()) |
1140 | + { |
1141 | + priv->updatePassiveKeyGrabs (); |
1142 | + foreach (CompWindow *w, screen->windows ()) |
1143 | + w->priv->updatePassiveButtonGrabs (); |
1144 | + } |
1145 | |
1146 | CompScreen::checkForError (dpy); |
1147 | |
1148 | @@ -4966,6 +4978,7 @@ |
1149 | { |
1150 | delete timeout; |
1151 | delete source; |
1152 | + delete modHandler; |
1153 | |
1154 | foreach (CompWatchFd *fd, watchFds) |
1155 | delete fd; |
1156 | |
1157 | === modified file 'src/session.cpp' |
1158 | --- src/session.cpp 2012-01-19 18:12:31 +0000 |
1159 | +++ src/session.cpp 2012-01-24 08:23:10 +0000 |
1160 | @@ -26,6 +26,7 @@ |
1161 | |
1162 | #include "core/session.h" |
1163 | #include "core/screen.h" |
1164 | +#include "core/global.h" |
1165 | |
1166 | #ifdef HAVE_CONFIG_H |
1167 | # include <config.h> |
1168 | |
1169 | === modified file 'src/window.cpp' |
1170 | --- src/window.cpp 2012-01-21 18:31:07 +0000 |
1171 | +++ src/window.cpp 2012-01-24 08:23:10 +0000 |
1172 | @@ -41,10 +41,13 @@ |
1173 | #include <core/icon.h> |
1174 | #include <core/atoms.h> |
1175 | #include "core/windowconstrainment.h" |
1176 | +#include "core/modifierhandler.h" |
1177 | #include "privatewindow.h" |
1178 | #include "privatescreen.h" |
1179 | #include "privatestackdebugger.h" |
1180 | |
1181 | +using namespace compiz::modifiers; |
1182 | + |
1183 | PluginClassStorage::Indices windowPluginClassIndices (0); |
1184 | |
1185 | unsigned int |
1186 | @@ -5869,15 +5872,15 @@ |
1187 | /* Grab only we have bindings on */ |
1188 | foreach (PrivateScreen::ButtonGrab &bind, screen->priv->buttonGrabs) |
1189 | { |
1190 | - unsigned int mods = modHandler->virtualToRealModMask (bind.modifiers); |
1191 | + unsigned int mods = ModifierHandler::Default ()->virtualToRealModMask (bind.modifiers); |
1192 | |
1193 | - if (mods & CompNoMask) |
1194 | + if (mods & compiz::modifiers::NoMask) |
1195 | continue; |
1196 | |
1197 | for (unsigned int ignore = 0; |
1198 | - ignore <= modHandler->ignoredModMask (); ignore++) |
1199 | + ignore <= ModifierHandler::Default ()->ignoredModMask (); ignore++) |
1200 | { |
1201 | - if (ignore & ~modHandler->ignoredModMask ()) |
1202 | + if (ignore & ~ModifierHandler::Default ()->ignoredModMask ()) |
1203 | continue; |
1204 | |
1205 | XGrabButton (screen->priv->dpy, |