X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Factions.cc;h=65931fc6b7380fad54a3262f85d776faac07c764;hb=7c32ac2b3f0bfd02a1efea1d67e5ad1c3c5be93f;hp=3a7ff36982898fee3d18e8f1dc3013afc8fdb8e4;hpb=12108e16e166034cd1840627502280d9a1ab0b9e;p=chaz%2Fopenbox diff --git a/src/actions.cc b/src/actions.cc index 3a7ff369..65931fc6 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -230,6 +230,26 @@ void Actions::keyPressHandler(const XKeyEvent &e) // kill off the Button1Mask etc, only want the modifiers unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask); + + // add to the state the mask of the modifier being pressed, if it is + // a modifier key being pressed (this is a little ugly..) + const XModifierKeymap *map = otk::display->modifierMap(); + const int mask_table[] = { + ShiftMask, LockMask, ControlMask, Mod1Mask, + Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask + }; + KeyCode *kp = map->modifiermap; + for (int i = 0, n = sizeof(mask_table)/sizeof(mask_table[0]); i < n; ++i) { + for (int k = 0; k < map->max_keypermod; ++k) { + if (*kp == e.keycode) { // found the keycode + state |= mask_table[i]; // add the mask for it + i = n; // cause the first loop to break; + break; // get outta here! + } + ++kp; + } + } + openbox->bindings()-> fireKey(otk::display->findScreen(e.root)->screen(), state, e.keycode, e.time, KeyAction::Press);