diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-01-24 07:37:26 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-01-24 07:37:26 +0000 |
| commit | 91c7e5c378b1a639c6f5383915ed68b36b7735d4 (patch) | |
| tree | 896039b1f31ca8a3a41f9ac81e35467247f6001d /otk | |
| parent | 73a776ee90879ea2b42c6e959f781a6600fada80 (diff) | |
allow python to grab the keyboard. have release events go to the grabs callback. remove the modifier from teh state when a modifier key is the one being released
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/display.cc | 23 | ||||
| -rw-r--r-- | otk/display.hh | 4 |
2 files changed, 15 insertions, 12 deletions
diff --git a/otk/display.cc b/otk/display.cc index af03801e..be8696bf 100644 --- a/otk/display.cc +++ b/otk/display.cc @@ -128,16 +128,15 @@ DISPLAY environment variable approriately.\n\n")); #endif // XINERAMA // get lock masks that are defined by the display (not constant) - XModifierKeymap *modmap; - - modmap = XGetModifierMapping(_display); - if (modmap && modmap->max_keypermod > 0) { + _modmap = XGetModifierMapping(_display); + assert(_modmap); + if (_modmap && _modmap->max_keypermod > 0) { const int mask_table[] = { ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask }; const size_t size = (sizeof(mask_table) / sizeof(mask_table[0])) * - modmap->max_keypermod; + _modmap->max_keypermod; // get the values of the keyboard lock modifiers // Note: Caps lock is not retrieved the same way as Scroll and Num lock // since it doesn't need to be. @@ -145,17 +144,15 @@ DISPLAY environment variable approriately.\n\n")); const KeyCode scroll_lock = XKeysymToKeycode(_display, XK_Scroll_Lock); for (size_t cnt = 0; cnt < size; ++cnt) { - if (! modmap->modifiermap[cnt]) continue; + if (! _modmap->modifiermap[cnt]) continue; - if (num_lock == modmap->modifiermap[cnt]) - _num_lock_mask = mask_table[cnt / modmap->max_keypermod]; - if (scroll_lock == modmap->modifiermap[cnt]) - _scroll_lock_mask = mask_table[cnt / modmap->max_keypermod]; + if (num_lock == _modmap->modifiermap[cnt]) + _num_lock_mask = mask_table[cnt / _modmap->max_keypermod]; + if (scroll_lock == _modmap->modifiermap[cnt]) + _scroll_lock_mask = mask_table[cnt / _modmap->max_keypermod]; } } - if (modmap) XFreeModifiermap(modmap); - _mask_list[0] = 0; _mask_list[1] = LockMask; _mask_list[2] = _num_lock_mask; @@ -181,6 +178,8 @@ Display::~Display() while (_grab_count > 0) ungrab(); + XFreeModifiermap(_modmap); + for (int i = 0; i < ScreenCount(_display); ++i) { delete _rendercontrol_list[i]; delete _screeninfo_list[i]; diff --git a/otk/display.hh b/otk/display.hh index 0879ce32..e8613a04 100644 --- a/otk/display.hh +++ b/otk/display.hh @@ -47,6 +47,9 @@ private: //! The value of the mask for the ScrollLock modifier unsigned int _scroll_lock_mask; + //! The key codes for the modifier keys + XModifierKeymap *_modmap; + //! The number of requested grabs on the display int _grab_count; @@ -102,6 +105,7 @@ public: inline unsigned int numLockMask() const { return _num_lock_mask; } inline unsigned int scrollLockMask() const { return _scroll_lock_mask; } + const XModifierKeymap *modifierMap() const { return _modmap; } inline ::Display* operator*() const { return _display; } |
