diff options
author | Sam Spilsbury <smspillaz@gmail.com> | 2009-07-01 21:26:10 +0800 |
---|---|---|
committer | Joel Bosveld <Joel.Bosveld@gmail.com> | 2009-07-01 23:09:59 +0800 |
commit | 3b3f9ce97cf85f0bb4f973ce409c74b7b4fde871 (patch) | |
tree | 92bcdcb60f9debd2033b0560851b3f2b1cae0bb2 /include | |
parent | 8f734f64d025eeaecc9ca9ab5b250dc305a425ea (diff) | |
download | zcomp-3b3f9ce97cf85f0bb4f973ce409c74b7b4fde871.tar.gz zcomp-3b3f9ce97cf85f0bb4f973ce409c74b7b4fde871.tar.bz2 |
Move modifier handling into a separate top level class exposed to plugins
Diffstat (limited to 'include')
-rw-r--r-- | include/core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/core/modifierhandler.h | 89 | ||||
-rw-r--r-- | include/core/screen.h | 3 |
3 files changed, 93 insertions, 0 deletions
diff --git a/include/core/CMakeLists.txt b/include/core/CMakeLists.txt index 50788e9..3eee0f2 100644 --- a/include/core/CMakeLists.txt +++ b/include/core/CMakeLists.txt @@ -4,6 +4,7 @@ set (_headers core.h icon.h match.h + modifierhandler.h option.h output.h plugin.h diff --git a/include/core/modifierhandler.h b/include/core/modifierhandler.h new file mode 100644 index 0000000..5620ce8 --- /dev/null +++ b/include/core/modifierhandler.h @@ -0,0 +1,89 @@ +/* + * Copyright © 2008 Dennis Kasprzyk + * Copyright © 2007 Novell, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Dennis Kasprzyk not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * Dennis Kasprzyk makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * DENNIS KASPRZYK DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL DENNIS KASPRZYK BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Dennis Kasprzyk <onestone@compiz-fusion.org> + * David Reveman <davidr@novell.com> + * Sam Spilsbury <smspillaz@gmail.com> + */ + +#include <core/core.h> + +class ModifierHandler +{ + public: + + ModifierHandler (); + ~ModifierHandler (); + + typedef enum + { + Alt = 1, + Meta, + Super, + Hyper, + ModeSwitch, + NumLock, + ScrollLock, + ModNum + } Modifier; + + typedef enum + { + AltMask = (1 << 16), + MetaMask = (1 << 17), + SuperMask = (1 << 18), + HyperMask = (1 << 19), + ModeSwitchMask = (1 << 20), + NumLockMask = (1 << 21), + ScrollLockMask = (1 << 22), + NoMask = (1 << 25), + } ModMask; + + public: + + unsigned int keycodeToModifiers (int keycode); + + void updateModifierMappings (); + + unsigned int virtualToRealModMask (unsigned int modMask); + + unsigned int modMask (Modifier); + + unsigned int ignoredModMask (); + + const XModifierKeymap * modMap (); + + friend class CompScreen; + + private: + + static const unsigned int virtualModMask[7]; + + static const int maskTable[8]; + + static const int maskTableSize = 8; + + ModMask mModMask[ModNum]; + unsigned int mIgnoredModMask; + XModifierKeymap *mModMap; +}; diff --git a/include/core/screen.h b/include/core/screen.h index 41c9b6c..7d07537 100644 --- a/include/core/screen.h +++ b/include/core/screen.h @@ -35,6 +35,7 @@ #include <core/match.h> #include <core/pluginclasses.h> #include <core/region.h> +#include <core/modifierhandler.h> class CompScreen; class PrivateScreen; @@ -48,6 +49,7 @@ extern bool noDetection; extern bool debugOutput; extern CompScreen *screen; +extern ModifierHandler *modHandler; extern int lastPointerX; extern int lastPointerY; @@ -356,6 +358,7 @@ class CompScreen : friend class CompTimer; friend class CompWindow; friend class PrivateWindow; + friend class ModifierHandler; private: PrivateScreen *priv; |