XQuartz: Use CFEqual to compare keyboards
(cherry picked from commit 5538e43b9a
)
This commit is contained in:
parent
90dd2de845
commit
c3267106fb
|
@ -1087,16 +1087,26 @@ Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO: Not thread safe */
|
||||||
unsigned int QuartzSystemKeymapSeed(void) {
|
unsigned int QuartzSystemKeymapSeed(void) {
|
||||||
static unsigned int seed;
|
static unsigned int seed = 0;
|
||||||
static TISInputSourceRef last_key_layout;
|
static TISInputSourceRef last_key_layout = NULL;
|
||||||
TISInputSourceRef key_layout;
|
TISInputSourceRef key_layout;
|
||||||
|
|
||||||
key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
|
|
||||||
if (key_layout != last_key_layout) seed++;
|
if(last_key_layout) {
|
||||||
last_key_layout = key_layout;
|
if (CFEqual(key_layout, last_key_layout)) {
|
||||||
|
CFRelease(key_layout);
|
||||||
|
} else {
|
||||||
|
seed++;
|
||||||
|
CFRelease(last_key_layout);
|
||||||
|
last_key_layout = key_layout;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
last_key_layout = key_layout;
|
||||||
|
}
|
||||||
|
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user