- if (!e.same_screen) return; // this just gets stupid
-
- int x_root = e.x_root, y_root = e.y_root;
-
- // compress changes to a window into a single change
- XEvent ce;
- while (XCheckTypedEvent(otk::OBDisplay::display, e.type, &ce)) {
- if (ce.xmotion.window != e.window) {
- XPutBackEvent(otk::OBDisplay::display, &ce);
- break;
- } else {
- x_root = e.x_root;
- y_root = e.y_root;
+ otk::EventHandler::keyReleaseHandler(e);
+
+ // kill off the Button1Mask etc, only want the modifiers
+ unsigned int state = e.state & (ControlMask | ShiftMask | Mod1Mask |
+ Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask);
+
+ // remove from the state the mask of the modifier being released, if it is
+ // a modifier key being released (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]; // remove the mask for it
+ i = n; // cause the first loop to break;
+ break; // get outta here!
+ }
+ ++kp;