GKVE: send XkbMapNotify, not XkbNewKeyboardNotify

Sending MapNotify is more correct in this case than NKN, so do that.
This commit is contained in:
Daniel Stone 2006-08-08 14:54:10 +03:00 committed by Daniel Stone
parent 3108981631
commit fe351a711e

View File

@ -4675,6 +4675,10 @@ GetKeyboardEvents(xEvent **xE, DeviceIntPtr pDev, int type, int key_code) {
* the return value is the number of events in xE, which is not * the return value is the number of events in xE, which is not
* NULL-terminated. * NULL-terminated.
* *
* If pDev is set to send core events, then the keymap on the core
* keyboard will be pivoted to that of the new keyboard and the appropriate
* MapNotify events (both core and XKB) will be sent.
*
* Note that this function recurses! If called for non-XKB, a repeating * Note that this function recurses! If called for non-XKB, a repeating
* key press will trigger a matching KeyRelease, as well as the * key press will trigger a matching KeyRelease, as well as the
* KeyPresses. * KeyPresses.
@ -4688,7 +4692,7 @@ int GetKeyboardValuatorEvents(xEvent **xE, DeviceIntPtr pDev, int type,
xEvent *ev = NULL, *repeatEvents = NULL; xEvent *ev = NULL, *repeatEvents = NULL;
KeyClassPtr ckeyc; KeyClassPtr ckeyc;
#ifdef XKB #ifdef XKB
xkbNewKeyboardNotify nkn; xkbMapNotify mn;
#endif #endif
if (type != KeyPress && type != KeyRelease) if (type != KeyPress && type != KeyRelease)
@ -4798,27 +4802,36 @@ int GetKeyboardValuatorEvents(xEvent **xE, DeviceIntPtr pDev, int type,
ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode; ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms); SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
#ifdef XKB #ifdef XKB
if (!noXkbExtension) { if (!noXkbExtension && pDev->key->xkbInfo &&
nkn.oldMinKeyCode = ckeyc->xkbInfo->desc->min_key_code; pDev->key->xkbInfo->desc) {
nkn.oldMaxKeyCode = ckeyc->xkbInfo->desc->max_key_code; mn.deviceID = inputInfo.keyboard->id;
nkn.deviceID = nkn.oldDeviceID = inputInfo.keyboard->id; mn.minKeyCode = pDev->key->xkbInfo->desc->min_key_code;
nkn.minKeyCode = pDev->key->xkbInfo->desc->min_key_code; mn.maxKeyCode = pDev->key->xkbInfo->desc->max_key_code;
nkn.maxKeyCode = pDev->key->xkbInfo->desc->max_key_code; mn.firstType = 0;
nkn.requestMajor = XkbReqCode; mn.nTypes = pDev->key->xkbInfo->desc->map->num_types;
nkn.requestMinor = X_kbSetMap; /* XXX bare-faced lie */ mn.firstKeySym = pDev->key->xkbInfo->desc->min_key_code;
nkn.changed = XkbAllNewKeyboardEventsMask; mn.nKeySyms = XkbNumKeys(pDev->key->xkbInfo->desc);
/* Free the map we set up at DEVICE_INIT time, since it's mn.firstKeyAct = pDev->key->xkbInfo->desc->min_key_code;
* going to just quietly disappear. Shameful hack. */ mn.nKeyActs = XkbNumKeys(pDev->key->xkbInfo->desc);
if (!inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr /* Cargo-culted from ProcXkbGetMap. */
&& ckeyc->xkbInfo) mn.firstKeyBehavior = pDev->key->xkbInfo->desc->min_key_code;
mn.nKeyBehaviors = XkbNumKeys(pDev->key->xkbInfo->desc);
mn.firstKeyExplicit = pDev->key->xkbInfo->desc->min_key_code;
mn.nKeyExplicit = XkbNumKeys(pDev->key->xkbInfo->desc);
mn.firstModMapKey = pDev->key->xkbInfo->desc->min_key_code;
mn.nModMapKeys = XkbNumKeys(pDev->key->xkbInfo->desc);
mn.firstVModMapKey = pDev->key->xkbInfo->desc->min_key_code;
mn.nVModMapKeys = XkbNumKeys(pDev->key->xkbInfo->desc);
mn.virtualMods = ~0; /* ??? */
mn.changed = XkbAllMapComponentsMask;
/* If this is still the map we set at DEVICE_INIT, free it so
* it doesn't just get lost. (Shameful hack, sorry.) */
if (!inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr &&
ckeyc->xkbInfo)
XkbFreeInfo(ckeyc->xkbInfo); XkbFreeInfo(ckeyc->xkbInfo);
ckeyc->xkbInfo = pDev->key->xkbInfo; ckeyc->xkbInfo = pDev->key->xkbInfo;
/* FIXME OH MY GOD SO AWFUL let's hope nobody notices */ XkbSendMapNotify(inputInfo.keyboard, &mn);
if (nkn.oldMinKeyCode == nkn.minKeyCode)
nkn.oldMinKeyCode--;
if (nkn.oldMaxKeyCode == nkn.maxKeyCode)
nkn.oldMaxKeyCode++;
XkbSendNewKeyboardNotify(inputInfo.keyboard, &nkn);
} }
#endif #endif
SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode, SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,