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/display.cc | |
| 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/display.cc')
| -rw-r--r-- | otk/display.cc | 23 |
1 files changed, 11 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]; |
