XQuartz: Fixed follow-keyboard-layout
≈
(cherry picked from commit a9f9fbf512
)
This commit is contained in:
parent
f67cd31d2c
commit
ebb2e1449c
|
@ -68,8 +68,6 @@
|
||||||
#include "X11/keysym.h"
|
#include "X11/keysym.h"
|
||||||
#include "keysym2ucs.h"
|
#include "keysym2ucs.h"
|
||||||
|
|
||||||
void QuartzXkbUpdate(DeviceIntPtr pDev);
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MOD_COMMAND = 256,
|
MOD_COMMAND = 256,
|
||||||
MOD_SHIFT = 512,
|
MOD_SHIFT = 512,
|
||||||
|
@ -427,16 +425,6 @@ static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
|
||||||
pthread_mutex_unlock(&keyInfo_mutex);
|
pthread_mutex_unlock(&keyInfo_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuartzXkbUpdate(DeviceIntPtr pDev) {
|
|
||||||
#ifdef XQUARTZ_USE_XKB
|
|
||||||
SendDeviceMappingNotify(serverClient, MappingKeyboard,
|
|
||||||
pDev->key->curKeySyms.minKeyCode,
|
|
||||||
pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
|
|
||||||
SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
|
|
||||||
SwitchCoreKeyboard(pDev);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DarwinKeyboardInit
|
* DarwinKeyboardInit
|
||||||
* Get the Darwin keyboard map and compute an equivalent
|
* Get the Darwin keyboard map and compute an equivalent
|
||||||
|
@ -466,7 +454,11 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
|
||||||
memcpy(pDev->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
|
memcpy(pDev->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
|
||||||
pthread_mutex_unlock(&keyInfo_mutex);
|
pthread_mutex_unlock(&keyInfo_mutex);
|
||||||
|
|
||||||
QuartzXkbUpdate(pDev);
|
SendDeviceMappingNotify(serverClient, MappingKeyboard,
|
||||||
|
pDev->key->curKeySyms.minKeyCode,
|
||||||
|
pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
|
||||||
|
SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
|
||||||
|
SwitchCoreKeyboard(pDev);
|
||||||
#else
|
#else
|
||||||
pthread_mutex_lock(&keyInfo_mutex);
|
pthread_mutex_lock(&keyInfo_mutex);
|
||||||
assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
|
assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
|
||||||
|
@ -479,33 +471,33 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
|
||||||
|
|
||||||
|
|
||||||
void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
|
void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
|
||||||
if (pDev == NULL) pDev = darwinKeyboard;
|
// Note that pDev is the device that "initiated" the reload event here...
|
||||||
|
// So we change this later on.
|
||||||
|
|
||||||
DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev);
|
DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev);
|
||||||
|
|
||||||
#ifdef XQUARTZ_USE_XKB
|
|
||||||
QuartzXkbUpdate(pDev);
|
|
||||||
#else
|
|
||||||
KeySymsRec keySyms;
|
KeySymsRec keySyms;
|
||||||
DarwinLoadKeyboardMapping(&keySyms);
|
DarwinLoadKeyboardMapping(&keySyms);
|
||||||
|
|
||||||
if (pDev->key) {
|
/* From ProcSetModifierMapping */
|
||||||
if (pDev->key->curKeySyms.map) xfree(pDev->key->curKeySyms.map);
|
SendMappingNotify(MappingModifier, 0, 0, serverClient);
|
||||||
if (pDev->key->modifierKeyMap) xfree(pDev->key->modifierKeyMap);
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||||
xfree(pDev->key);
|
if (pDev->key && pDev->coreEvents)
|
||||||
}
|
SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
|
||||||
|
|
||||||
|
/* From ProcChangeKeyboardMapping */
|
||||||
|
SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, serverClient);
|
||||||
|
|
||||||
pthread_mutex_lock(&keyInfo_mutex);
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||||
if (!InitKeyClassDeviceStruct(pDev, &keySyms, keyInfo.modMap)) {
|
if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
|
||||||
DEBUG_LOG("InitKeyClassDeviceStruct failed\n");
|
if (!SetKeySymsMap(&pDev->key->curKeySyms, &keySyms))
|
||||||
pthread_mutex_unlock(&keyInfo_mutex);
|
ErrorF("Error changing keysyms. SetKeySymsMap failed.");
|
||||||
return;
|
|
||||||
}
|
SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, serverClient);
|
||||||
pthread_mutex_unlock(&keyInfo_mutex);
|
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
|
||||||
|
if (pDev->key && pDev->coreEvents)
|
||||||
SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
|
SendDeviceMappingNotify(serverClient, MappingKeyboard,
|
||||||
SendMappingNotify(MappingModifier, 0, 0, 0);
|
MIN_KEYCODE, NUM_KEYCODES, pDev);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user