XQuartz: Don't use TIS on Tiger...
(cherry picked from commit be8ac84c15e7e76c581b9e75cda74139394aa4c7)
This commit is contained in:
parent
e8112784e8
commit
03f7a66a1a
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <available.h>
|
||||||
|
|
||||||
#include <Xplugin.h>
|
#include <Xplugin.h>
|
||||||
|
|
||||||
|
@ -65,7 +66,11 @@ extern BOOL xpbproxy_init (void);
|
||||||
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
|
int X11EnableKeyEquivalents = TRUE, quartzFullscreenMenu = FALSE;
|
||||||
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
int quartzHasRoot = FALSE, quartzEnableRootless = TRUE;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
static TISInputSourceRef last_key_layout;
|
static TISInputSourceRef last_key_layout;
|
||||||
|
#else
|
||||||
|
static KeyboardLayoutRef last_key_layout;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int darwinFakeButtons;
|
extern int darwinFakeButtons;
|
||||||
|
|
||||||
|
@ -869,11 +874,16 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
|
||||||
NSMaxY([[NSScreen mainScreen] visibleFrame]);
|
NSMaxY([[NSScreen mainScreen] visibleFrame]);
|
||||||
|
|
||||||
/* Set the key layout seed before we start the server */
|
/* Set the key layout seed before we start the server */
|
||||||
last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
|
last_key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
if(!last_key_layout) {
|
|
||||||
|
if(!last_key_layout)
|
||||||
fprintf(stderr, "X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
|
fprintf(stderr, "X11ApplicationMain: Unable to determine TISCopyCurrentKeyboardLayoutInputSource() at startup.\n");
|
||||||
}
|
#else
|
||||||
|
KLGetCurrentKeyboardLayout(&last_key_layout);
|
||||||
|
if(!last_key_layout)
|
||||||
|
fprintf(stderr, "X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
|
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
|
||||||
if (!QuartzReadSystemKeymap(&keyInfo)) {
|
if (!QuartzReadSystemKeymap(&keyInfo)) {
|
||||||
|
@ -1034,6 +1044,7 @@ extern int darwin_modifier_flags; // darwinEvents.c
|
||||||
|
|
||||||
case NSKeyDown: case NSKeyUp:
|
case NSKeyDown: case NSKeyUp:
|
||||||
if(darwinSyncKeymap) {
|
if(darwinSyncKeymap) {
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
TISInputSourceRef key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
TISInputSourceRef clear;
|
TISInputSourceRef clear;
|
||||||
if (CFEqual(key_layout, last_key_layout)) {
|
if (CFEqual(key_layout, last_key_layout)) {
|
||||||
|
@ -1043,6 +1054,12 @@ extern int darwin_modifier_flags; // darwinEvents.c
|
||||||
clear = last_key_layout;
|
clear = last_key_layout;
|
||||||
last_key_layout = key_layout;
|
last_key_layout = key_layout;
|
||||||
CFRelease(clear);
|
CFRelease(clear);
|
||||||
|
#else
|
||||||
|
KeyboardLayoutRef key_layout;
|
||||||
|
KLGetCurrentKeyboardLayout(&key_layout);
|
||||||
|
if(key_layout != last_key_layout) {
|
||||||
|
last_key_layout = key_layout;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Update keyInfo */
|
/* Update keyInfo */
|
||||||
pthread_mutex_lock(&keyInfo_mutex);
|
pthread_mutex_lock(&keyInfo_mutex);
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <available.h>
|
||||||
|
|
||||||
#include "quartzCommon.h"
|
#include "quartzCommon.h"
|
||||||
#include "darwin.h"
|
#include "darwin.h"
|
||||||
|
@ -701,20 +702,19 @@ static KeySym make_dead_key(KeySym in) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
||||||
#if !defined(__LP64__)
|
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||||
KeyboardLayoutRef key_layout;
|
KeyboardLayoutRef key_layout;
|
||||||
|
int is_uchr = 1;
|
||||||
#endif
|
#endif
|
||||||
const void *chr_data = NULL;
|
const void *chr_data = NULL;
|
||||||
int num_keycodes = NUM_KEYCODES;
|
int num_keycodes = NUM_KEYCODES;
|
||||||
UInt32 keyboard_type = 0;
|
UInt32 keyboard_type = 0;
|
||||||
#if !defined(__LP64__)
|
|
||||||
int is_uchr = 1;
|
|
||||||
#endif
|
|
||||||
int i, j;
|
int i, j;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
KeySym *k;
|
KeySym *k;
|
||||||
CFDataRef currentKeyLayoutDataRef = NULL;
|
CFDataRef currentKeyLayoutDataRef = NULL;
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
|
TISInputSourceRef currentKeyLayoutRef = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
keyboard_type = LMGetKbdType();
|
keyboard_type = LMGetKbdType();
|
||||||
|
|
||||||
|
@ -723,13 +723,15 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
||||||
if (currentKeyLayoutDataRef)
|
if (currentKeyLayoutDataRef)
|
||||||
chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
|
chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(__LP64__)
|
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||||
if (chr_data == NULL) {
|
if (chr_data == NULL) {
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
ErrorF("X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
|
ErrorF("X11.app: Error detected in determining keyboard layout. If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
|
||||||
ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
|
ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
|
||||||
(unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
|
(unsigned)keyboard_type, currentKeyLayoutRef, currentKeyLayoutDataRef, chr_data);
|
||||||
|
#endif
|
||||||
KLGetCurrentKeyboardLayout (&key_layout);
|
KLGetCurrentKeyboardLayout (&key_layout);
|
||||||
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
|
KLGetKeyboardLayoutProperty (key_layout, kKLuchrData, &chr_data);
|
||||||
|
|
||||||
|
@ -771,7 +773,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
||||||
k = info->keyMap + i * GLYPHS_PER_KEY;
|
k = info->keyMap + i * GLYPHS_PER_KEY;
|
||||||
|
|
||||||
for (j = 0; j < 4; j++) {
|
for (j = 0; j < 4; j++) {
|
||||||
#if !defined(__LP64__)
|
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||||
if (is_uchr) {
|
if (is_uchr) {
|
||||||
#endif
|
#endif
|
||||||
UniChar s[8];
|
UniChar s[8];
|
||||||
|
@ -797,7 +799,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
|
||||||
k[j] = ucs2keysym (s[0]);
|
k[j] = ucs2keysym (s[0]);
|
||||||
if (dead_key_state != 0) k[j] = make_dead_key (k[j]);
|
if (dead_key_state != 0) k[j] = make_dead_key (k[j]);
|
||||||
}
|
}
|
||||||
#if !defined(__LP64__)
|
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||||
} else { // kchr
|
} else { // kchr
|
||||||
UInt32 c, state = 0, state2 = 0;
|
UInt32 c, state = 0, state2 = 0;
|
||||||
UInt16 code;
|
UInt16 code;
|
||||||
|
|
Loading…
Reference in New Issue