Input: Generate XKB mapping changes for all core-sending devices (bug #12523)
When we change the mapping on a core device, make sure we propagate this
through to XKB for all extended devices as well.
(cherry picked from commit 27ad5d74c2
)
This commit is contained in:
parent
84040b655e
commit
ad05d5d035
|
@ -73,6 +73,10 @@ SOFTWARE.
|
||||||
#include "dixgrabs.h" /* CreateGrab() */
|
#include "dixgrabs.h" /* CreateGrab() */
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
|
||||||
|
#ifdef XKB
|
||||||
|
#include "xkbsrv.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
#define WID(w) ((w) ? ((w)->drawable.id) : 0)
|
||||||
#define AllModifiersMask ( \
|
#define AllModifiersMask ( \
|
||||||
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
ShiftMask | LockMask | ControlMask | Mod1Mask | Mod2Mask | \
|
||||||
|
@ -942,7 +946,7 @@ SetModifierMapping(ClientPtr client, DeviceIntPtr dev, int len, int rlen,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SendDeviceMappingNotify(CARD8 request,
|
SendDeviceMappingNotify(ClientPtr client, CARD8 request,
|
||||||
KeyCode firstKeyCode, CARD8 count, DeviceIntPtr dev)
|
KeyCode firstKeyCode, CARD8 count, DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
xEvent event;
|
xEvent event;
|
||||||
|
@ -957,6 +961,11 @@ SendDeviceMappingNotify(CARD8 request,
|
||||||
ev->count = count;
|
ev->count = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XKB
|
||||||
|
if (request == MappingKeyboard || request == MappingModifier)
|
||||||
|
XkbApplyMappingChange(dev, request, firstKeyCode, count, client);
|
||||||
|
#endif
|
||||||
|
|
||||||
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1);
|
SendEventToAllWindows(dev, DeviceMappingNotifyMask, (xEvent *) ev, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -992,7 +1001,7 @@ ChangeKeyMapping(ClientPtr client,
|
||||||
keysyms.map = map;
|
keysyms.map = map;
|
||||||
if (!SetKeySymsMap(&k->curKeySyms, &keysyms))
|
if (!SetKeySymsMap(&k->curKeySyms, &keysyms))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
SendDeviceMappingNotify(MappingKeyboard, firstKeyCode, keyCodes, dev);
|
SendDeviceMappingNotify(client, MappingKeyboard, firstKeyCode, keyCodes, dev);
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ ProcXSetDeviceButtonMapping(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != MappingBusy)
|
if (ret != MappingBusy)
|
||||||
SendDeviceMappingNotify(MappingPointer, 0, 0, dev);
|
SendDeviceMappingNotify(client, MappingPointer, 0, 0, dev);
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ ProcXSetDeviceModifierMapping(ClientPtr client)
|
||||||
if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
|
if (ret == MappingSuccess || ret == MappingBusy || ret == MappingFailed) {
|
||||||
rep.success = ret;
|
rep.success = ret;
|
||||||
if (ret == MappingSuccess)
|
if (ret == MappingSuccess)
|
||||||
SendDeviceMappingNotify(MappingModifier, 0, 0, dev);
|
SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
|
||||||
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
|
WriteReplyToClient(client, sizeof(xSetDeviceModifierMappingReply),
|
||||||
&rep);
|
&rep);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1208,10 +1208,9 @@ SendMappingNotify(unsigned request, unsigned firstKeyCode, unsigned count,
|
||||||
}
|
}
|
||||||
#ifdef XKB
|
#ifdef XKB
|
||||||
if (!noXkbExtension &&
|
if (!noXkbExtension &&
|
||||||
((request == MappingKeyboard) || (request == MappingModifier))) {
|
((request == MappingKeyboard) || (request == MappingModifier)))
|
||||||
XkbApplyMappingChange(inputInfo.keyboard,request,firstKeyCode,count,
|
XkbApplyMappingChange(inputInfo.keyboard, request, firstKeyCode, count,
|
||||||
client);
|
client);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 0 is the server client */
|
/* 0 is the server client */
|
||||||
|
@ -1359,6 +1358,7 @@ int
|
||||||
ProcSetModifierMapping(ClientPtr client)
|
ProcSetModifierMapping(ClientPtr client)
|
||||||
{
|
{
|
||||||
xSetModifierMappingReply rep;
|
xSetModifierMappingReply rep;
|
||||||
|
DeviceIntPtr dev;
|
||||||
REQUEST(xSetModifierMappingReq);
|
REQUEST(xSetModifierMappingReq);
|
||||||
|
|
||||||
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
|
REQUEST_AT_LEAST_SIZE(xSetModifierMappingReq);
|
||||||
|
@ -1374,8 +1374,10 @@ ProcSetModifierMapping(ClientPtr client)
|
||||||
rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1],
|
rep.success = DoSetModifierMapping(client, (KeyCode *)&stuff[1],
|
||||||
stuff->numKeyPerModifier);
|
stuff->numKeyPerModifier);
|
||||||
|
|
||||||
/* FIXME: Send mapping notifies for all the extended devices as well. */
|
|
||||||
SendMappingNotify(MappingModifier, 0, 0, client);
|
SendMappingNotify(MappingModifier, 0, 0, client);
|
||||||
|
for (dev = inputInfo.devices; dev; dev = dev->next)
|
||||||
|
if (dev->key && dev->coreEvents)
|
||||||
|
SendDeviceMappingNotify(client, MappingModifier, 0, 0, dev);
|
||||||
WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
|
WriteReplyToClient(client, sizeof(xSetModifierMappingReply), &rep);
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
@ -1438,16 +1440,19 @@ ProcChangeKeyboardMapping(ClientPtr client)
|
||||||
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
|
keysyms.maxKeyCode = stuff->firstKeyCode + stuff->keyCodes - 1;
|
||||||
keysyms.mapWidth = stuff->keySymsPerKeyCode;
|
keysyms.mapWidth = stuff->keySymsPerKeyCode;
|
||||||
keysyms.map = (KeySym *)&stuff[1];
|
keysyms.map = (KeySym *)&stuff[1];
|
||||||
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||||
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key) {
|
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
|
||||||
if (!SetKeySymsMap(&pDev->key->curKeySyms, &keysyms))
|
if (!SetKeySymsMap(&pDev->key->curKeySyms, &keysyms))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: Send mapping notifies for all the extended devices as well. */
|
|
||||||
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
|
SendMappingNotify(MappingKeyboard, stuff->firstKeyCode, stuff->keyCodes,
|
||||||
client);
|
client);
|
||||||
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||||
|
if (pDev->key && pDev->coreEvents)
|
||||||
|
SendDeviceMappingNotify(client, MappingKeyboard,
|
||||||
|
stuff->firstKeyCode, stuff->keyCodes,
|
||||||
|
pDev);
|
||||||
|
|
||||||
return client->noClientException;
|
return client->noClientException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,7 @@ extern int SetModifierMapping(
|
||||||
KeyClassPtr * /* k */);
|
KeyClassPtr * /* k */);
|
||||||
|
|
||||||
extern void SendDeviceMappingNotify(
|
extern void SendDeviceMappingNotify(
|
||||||
|
ClientPtr /* client, */,
|
||||||
CARD8 /* request, */,
|
CARD8 /* request, */,
|
||||||
KeyCode /* firstKeyCode */,
|
KeyCode /* firstKeyCode */,
|
||||||
CARD8 /* count */,
|
CARD8 /* count */,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user