Merge remote branch 'jeremyhu/master'

This commit is contained in:
Keith Packard 2010-04-12 21:40:41 -07:00
commit ab60975fe2
12 changed files with 874 additions and 1183 deletions

View File

@ -90,6 +90,7 @@ extern int quartzHasRoot, quartzEnableRootless, quartzFullscreenMenu;
#define PREFS_NO_TCP "nolisten_tcp"
#define PREFS_DONE_XINIT_CHECK "done_xinit_check"
#define PREFS_NO_QUIT_ALERT "no_quit_alert"
#define PREFS_OPTION_SENDS_ALT "option_sends_alt"
#define PREFS_FAKE_BUTTON2 "fake_button2"
#define PREFS_FAKE_BUTTON3 "fake_button3"
#define PREFS_APPKIT_MODIFIERS "appkit_modifiers"

View File

@ -712,10 +712,13 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
default:quartzEnableRootless];
quartzFullscreenMenu = [self prefs_get_boolean:@PREFS_FULLSCREEN_MENU
default:quartzFullscreenMenu];
quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
@PREFS_FULLSCREEN_HOTKEYS default:!quartzFullscreenDisableHotkeys];
quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:@PREFS_FULLSCREEN_HOTKEYS
default:!quartzFullscreenDisableHotkeys];
darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
default:darwinFakeButtons];
quartzOptionSendsAlt = [self prefs_get_boolean:@PREFS_OPTION_SENDS_ALT
default:quartzOptionSendsAlt];
if (darwinFakeButtons) {
const char *fake2, *fake3;
@ -969,8 +972,7 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
fprintf(stderr, "X11ApplicationMain: Unable to determine KLGetCurrentKeyboardLayout() at startup.\n");
#endif
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
if (!QuartzReadSystemKeymap(&keyInfo)) {
if (!QuartsResyncKeymap(FALSE)) {
fprintf(stderr, "X11ApplicationMain: Could not build a valid keymap.\n");
}
@ -1229,17 +1231,10 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
if(key_layout != last_key_layout) {
last_key_layout = key_layout;
#endif
/* Update keyInfo */
pthread_mutex_lock(&keyInfo_mutex);
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
if (!QuartzReadSystemKeymap(&keyInfo)) {
if (!QuartsResyncKeymap(TRUE)) {
fprintf(stderr, "sendX11NSEvent: Could not build a valid keymap.\n");
}
pthread_mutex_unlock(&keyInfo_mutex);
/* Tell server thread to deal with new keyInfo */
DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
}
}

View File

@ -55,10 +55,9 @@ typedef unsigned int NSUInteger;
#endif
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
@interface X11Controller : NSObject <NSTableViewDataSource>
#else
@interface X11Controller : NSObject
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
<NSTableViewDataSource>
#endif
{
IBOutlet NSPanel *prefs_panel;
@ -69,6 +68,7 @@ typedef unsigned int NSUInteger;
IBOutlet NSButton *use_sysbeep;
IBOutlet NSButton *enable_keyequivs;
IBOutlet NSButton *sync_keymap;
IBOutlet NSButton *option_sends_alt;
IBOutlet NSButton *click_through;
IBOutlet NSButton *focus_follows_mouse;
IBOutlet NSButton *focus_on_new_window;

View File

@ -43,6 +43,7 @@
#include "darwin.h"
#include "darwinEvents.h"
#include "quartz.h"
#include "quartzKeyboard.h"
#include <X11/extensions/applewmconst.h>
#include "applewmExt.h"
@ -630,49 +631,69 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
- (IBAction)prefs_changed:sender
{
BOOL pbproxy_active;
if(!sender)
return;
if(sender == fake_buttons) {
darwinFakeButtons = [fake_buttons intValue];
[NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
} else if(sender == use_sysbeep) {
quartzUseSysBeep = [use_sysbeep intValue];
[NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
} else if(sender == enable_keyequivs) {
X11EnableKeyEquivalents = [enable_keyequivs intValue];
[NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
} else if(sender == sync_keymap) {
darwinSyncKeymap = [sync_keymap intValue];
[NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
} else if(sender == enable_fullscreen_menu) {
quartzFullscreenMenu = [enable_fullscreen_menu intValue];
[NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:quartzFullscreenMenu];
} else if(sender == option_sends_alt) {
BOOL prev_opt_sends_alt = quartzOptionSendsAlt;
quartzOptionSendsAlt = [option_sends_alt intValue];
[NSApp prefs_set_boolean:@PREFS_OPTION_SENDS_ALT value:quartzOptionSendsAlt];
darwinFakeButtons = [fake_buttons intValue];
quartzUseSysBeep = [use_sysbeep intValue];
X11EnableKeyEquivalents = [enable_keyequivs intValue];
darwinSyncKeymap = [sync_keymap intValue];
quartzFullscreenMenu = [enable_fullscreen_menu intValue];
if(prev_opt_sends_alt != quartzOptionSendsAlt)
QuartsResyncKeymap(TRUE);
} else if(sender == click_through) {
[NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]];
} else if(sender == focus_follows_mouse) {
[NSApp prefs_set_boolean:@PREFS_FFM value:[focus_follows_mouse intValue]];
} else if(sender == focus_on_new_window) {
[NSApp prefs_set_boolean:@PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window intValue]];
} else if(sender == enable_auth) {
[NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
} else if(sender == enable_tcp) {
[NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
} else if(sender == depth) {
[NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
} else if(sender == sync_pasteboard) {
BOOL pbproxy_active = [sync_pasteboard intValue];
[NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active];
/* after adding prefs here, also add to [X11Application read_defaults]
and prefs_show */
[sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
[sync_pasteboard_to_primary setEnabled:pbproxy_active];
[sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
[sync_primary_immediately setEnabled:pbproxy_active];
[NSApp prefs_set_boolean:@PREFS_FAKEBUTTONS value:darwinFakeButtons];
[NSApp prefs_set_boolean:@PREFS_SYSBEEP value:quartzUseSysBeep];
[NSApp prefs_set_boolean:@PREFS_KEYEQUIVS value:X11EnableKeyEquivalents];
[NSApp prefs_set_boolean:@PREFS_SYNC_KEYMAP value:darwinSyncKeymap];
[NSApp prefs_set_boolean:@PREFS_FULLSCREEN_MENU value:quartzFullscreenMenu];
[NSApp prefs_set_boolean:@PREFS_CLICK_THROUGH value:[click_through intValue]];
[NSApp prefs_set_boolean:@PREFS_FFM value:[focus_follows_mouse intValue]];
[NSApp prefs_set_boolean:@PREFS_FOCUS_ON_NEW_WINDOW value:[focus_on_new_window intValue]];
[NSApp prefs_set_boolean:@PREFS_NO_AUTH value:![enable_auth intValue]];
[NSApp prefs_set_boolean:@PREFS_NO_TCP value:![enable_tcp intValue]];
[NSApp prefs_set_integer:@PREFS_DEPTH value:[depth selectedTag]];
pbproxy_active = [sync_pasteboard intValue];
[NSApp prefs_set_boolean:@PREFS_SYNC_PB value:pbproxy_active];
[NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]];
[NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_PRIMARY value:[sync_pasteboard_to_primary intValue]];
[NSApp prefs_set_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB value:[sync_clipboard_to_pasteboard intValue]];
[NSApp prefs_set_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT value:[sync_primary_immediately intValue]];
// setEnabled doesn't do this...
[sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
[sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
} else if(sender == sync_pasteboard_to_clipboard) {
[NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_CLIPBOARD value:[sync_pasteboard_to_clipboard intValue]];
} else if(sender == sync_pasteboard_to_primary) {
[NSApp prefs_set_boolean:@PREFS_SYNC_PB_TO_PRIMARY value:[sync_pasteboard_to_primary intValue]];
} else if(sender == sync_clipboard_to_pasteboard) {
[NSApp prefs_set_boolean:@PREFS_SYNC_CLIPBOARD_TO_PB value:[sync_clipboard_to_pasteboard intValue]];
} else if(sender == sync_primary_immediately) {
[NSApp prefs_set_boolean:@PREFS_SYNC_PRIMARY_ON_SELECT value:[sync_primary_immediately intValue]];
}
[NSApp prefs_synchronize];
[sync_pasteboard_to_clipboard setEnabled:pbproxy_active];
[sync_pasteboard_to_primary setEnabled:pbproxy_active];
[sync_clipboard_to_pasteboard setEnabled:pbproxy_active];
[sync_primary_immediately setEnabled:pbproxy_active];
// setEnabled doesn't do this...
[sync_text1 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
[sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
DarwinSendDDXEvent(kXquartzReloadPreferences, 0);
DarwinSendDDXEvent(kXquartzReloadPreferences, 0);
}
- (IBAction) prefs_show:sender
@ -683,6 +704,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
[use_sysbeep setIntValue:quartzUseSysBeep];
[enable_keyequivs setIntValue:X11EnableKeyEquivalents];
[sync_keymap setIntValue:darwinSyncKeymap];
[option_sends_alt setIntValue:quartzOptionSendsAlt];
[click_through setIntValue:[NSApp prefs_get_boolean:@PREFS_CLICK_THROUGH default:NO]];
[focus_follows_mouse setIntValue:[NSApp prefs_get_boolean:@PREFS_FFM default:NO]];
[focus_on_new_window setIntValue:[NSApp prefs_get_boolean:@PREFS_FOCUS_ON_NEW_WINDOW default:YES]];

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,8 @@ CLEANFILES = $(appman_PROCESSED) $(appman_DATA)
include $(top_srcdir)/cpprules.in
MANDEFS += -D__laucnd_id_prefix__=$(LAUNCHD_ID_PREFIX)
.man.$(APP_MAN_SUFFIX):
$(AM_V_at)cp $< $@

View File

@ -16,69 +16,72 @@ OS X handles the desktop background.
.SH CUSTOMIZATION
\fIXquartz\fP can be customized using the defaults(1) command. The available options are:
.TP 8
.B defaults write org.x.X11 enable_fake_buttons -boolean true
.B defaults write __laucnd_id_prefix__.X11 enable_fake_buttons -boolean true
Emulates a 3 button mouse using modifier keys. By default, the Command modifier
is used to emulate button 2 and Option is used for button 3. Thus, clicking the
first mouse button while holding down Command will act like clicking
button 2. Holding down Option will simulate button 3.
.TP 8
.B defaults write org.x.X11 fake_button2 \fImodifiers\fP
.B defaults write __laucnd_id_prefix__.X11 fake_button2 \fImodifiers\fP
Change the modifier keys used to emulate the second mouse button. By default,
Command is used to emulate the second button. Any combination of the following
modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
.TP 8
.B defaults write org.x.X11 fake_button3 \fImodifiers\fP
.B defaults write __laucnd_id_prefix__.X11 fake_button3 \fImodifiers\fP
Change the modifier keys used to emulate the second mouse button. By default,
Command is used to emulate the second button. Any combination of the following
modifier names may be used: {l,r,}shift, {l,r,}option, {l,r,}control, {l,r,}command, fn
.TP 8
.B defaults write org.x.X11 fullscreen_hotkeys -boolean true
.B defaults write __laucnd_id_prefix__.X11 fullscreen_hotkeys -boolean true
Enable OSX hotkeys while in fullscreen
.TP 8
.B defaults write org.x.X11 fullscreen_menu -boolean true
.B defaults write __laucnd_id_prefix__.X11 fullscreen_menu -boolean true
Show the OSX menu while in fullscreen
.TP 8
.B defaults write org.x.X11 no_quit_alert -boolean true
.B defaults write __laucnd_id_prefix__.X11 no_quit_alert -boolean true
Disables the alert dialog displayed when attempting to quit X11.
.TP 8
.B defaults write org.x.X11 no_auth -boolean true
.B defaults write __laucnd_id_prefix__.X11 no_auth -boolean true
Stops the X server requiring that clients authenticate themselves when
connecting. See Xsecurity(__miscmansuffix__).
.TP 8
.B defaults write org.x.X11 nolisten_tcp -boolean false
.B defaults write __laucnd_id_prefix__.X11 nolisten_tcp -boolean false
This will tell the server to listen and accept TCP connections. Doing this without enabling
xauth is a possible security concern. See Xsecurity(__miscmansuffix__).
.TP 8
.B defaults write org.x.X11 enable_system_beep -boolean false
.B defaults write __laucnd_id_prefix__.X11 enable_system_beep -boolean false
Don't use the standard system beep effect for X11 alerts.
.TP 8
.B defaults write org.x.X11 enable_key_equivalents -boolean false
.B defaults write __laucnd_id_prefix__.X11 enable_key_equivalents -boolean false
Disable menu keyboard equivalents while X11 windows are focused.
.TP 8
.B defaults write org.x.X11 depth \fIdepth\fP
.B defaults write __laucnd_id_prefix__.X11 depth \fIdepth\fP
Specifies the color bit depth to use. Currently only 15, and 24 color
bits per pixel are supported. If not specified, or a value of -1 is specified,
defaults to the depth of the main display.
.TP 8
.B defaults write org.x.X11 sync_keymap -boolean true
.B defaults write __laucnd_id_prefix__.X11 sync_keymap -boolean true
Keep the X11 keymap up to date with the OSX system keymap.
.TP 8
.B defaults write org.x.X11 sync_pasteboard -boolean true
.B defaults write __laucnd_id_prefix__.X11 option_sends_alt -boolean true
The Option key will send Alt_L and Alt_R instead of Mode_switch.
.TP 8
.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard -boolean true
Enable syncing between the OSX pasteboard and clipboard/primary selection buffers in X11. This option needs to be true for any of the other pasteboard sync options to have an effect.
.TP 8
.B defaults write org.x.X11 sync_pasteboard_to_clipboard -boolean true
.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_clipboard -boolean true
Update the X11 CLIPBOARD when the OSX NSPasteboard is updated.
.TP 8
.B defaults write org.x.X11 sync_pasteboard_to_primary -boolean true
.B defaults write __laucnd_id_prefix__.X11 sync_pasteboard_to_primary -boolean true
Update the the X11 PRIMARY buffer when the OSX NSPasteboard is updated.
.TP 8
.B defaults write org.x.X11 sync_clipboard_to_pasteboard -boolean true
.B defaults write __laucnd_id_prefix__.X11 sync_clipboard_to_pasteboard -boolean true
Update the the OSX NSPasteboard when the X11 CLIPBOARD is updated. Note that enabling this option causes the clipboard synchronization to act as a clipboard manager in X11. This makes it impossible to use xclipboard, klipper, or any other such clipboard managers. If you want to use any of these programs, you must disable this option.
.TP 8
.B defaults write org.x.X11 sync_primary_on_select -boolean true
.B defaults write __laucnd_id_prefix__.X11 sync_primary_on_select -boolean true
This option defaults to false and is provided only "for experts." It updates the NSPasteboard whenever a new X11 selection is made (rather than requiring you to hit cmd-c to copy the selection to the NSPasteboard). Since the X11 protocol does not require applications to send notification when they change selection, this might not work in all cases (if you run into this problem, try selecting text in another application first, then selecting the text you want).
.TP 8
.B defaults write org.x.X11 enable_test_extensions -boolean true
.B defaults write __laucnd_id_prefix__.X11 enable_test_extensions -boolean true
This option defaults to false and is only accessible through the command line. Enable this option to turn on the DEC-XTRAP, RECORD, and XTEST extensions in the server.
.SH OPTIONS
.PP

View File

@ -79,6 +79,7 @@ int aquaMenuBarHeight = 0;
QuartzModeProcsPtr quartzProcs = NULL;
const char *quartzOpenGLBundle = NULL;
int quartzFullscreenDisableHotkeys = TRUE;
int quartzOptionSendsAlt = FALSE;
#if defined(RANDR) && !defined(FAKE_RANDR)
Bool QuartzRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {

View File

@ -60,6 +60,7 @@ extern int focusOnNewWindow;
extern int quartzUseAGL;
extern int quartzEnableKeyEquivalents;
extern int quartzFullscreenDisableHotkeys;
extern int quartzOptionSendsAlt;
// Other shared data
extern int quartzServerVisible;

View File

@ -39,6 +39,7 @@
#define HACK_MISSING 1
#define HACK_KEYPAD 1
#define HACK_BLACKLIST 1
#include <unistd.h>
#include <stdio.h>
@ -49,6 +50,7 @@
#include "quartzCommon.h"
#include "darwin.h"
#include "darwinEvents.h"
#include "quartzKeyboard.h"
#include "quartzAudio.h"
@ -83,6 +85,7 @@ enum {
#define UKEYSYM(u) ((u) | 0x01000000)
#if HACK_MISSING
/* Table of keycode->keysym mappings we use to fallback on for important
keys that are often not in the Unicode mapping. */
@ -117,7 +120,9 @@ const static struct {
{107, XK_F14},
{113, XK_F15},
};
#endif
#if HACK_KEYPAD
/* Table of keycode->old,new-keysym mappings we use to fixup the numeric
keypad entries. */
@ -143,6 +148,17 @@ const static struct {
{91, XK_8, XK_KP_8},
{92, XK_9, XK_KP_9},
};
#endif
#if HACK_BLACKLIST
/* <rdar://problem/7824370> wine notepad produces wrong characters on shift+arrow
* http://xquartz.macosforge.org/trac/ticket/295
* http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-579.html
*
* legacy Mac keycodes for arrow keys that shift-modify to math symbols
*/
const static unsigned short keycode_blacklist[] = {66, 70, 72, 77};
#endif
/* Table mapping normal keysyms to their dead equivalents.
FIXME: all the unicode keysyms (apart from circumflex) were guessed. */
@ -176,6 +192,12 @@ const static struct {
{UKEYSYM (0x31b), XK_dead_horn}, /* COMBINING HORN */
};
typedef struct darwinKeyboardInfo_struct {
CARD8 modMap[MAP_LENGTH];
KeySym keyMap[MAP_LENGTH * GLYPHS_PER_KEY];
unsigned char modifierKeycodes[32][2];
} darwinKeyboardInfo;
darwinKeyboardInfo keyInfo;
pthread_mutex_t keyInfo_mutex = PTHREAD_MUTEX_INITIALIZER;
@ -240,7 +262,8 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
case XK_Alt_L:
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
if(!quartzOptionSendsAlt)
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
break;
case XK_Alt_R:
@ -249,7 +272,8 @@ static void DarwinBuildModifierMaps(darwinKeyboardInfo *info) {
#else
info->modifierKeycodes[NX_MODIFIERKEY_ALTERNATE][0] = i;
#endif
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
if(!quartzOptionSendsAlt)
*k = XK_Mode_switch; // Yes, this is ugly. This needs to be cleaned up when we integrate quartzKeyboard with this code and refactor.
info->modMap[MIN_KEYCODE + i] = Mod1Mask;
break;
@ -632,7 +656,7 @@ static KeySym make_dead_key(KeySym in) {
return in;
}
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
static Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
#if !defined(__LP64__) || MAC_OS_X_VERSION_MIN_REQUIRED < 1050
KeyboardLayoutRef key_layout;
int is_uchr = 1;
@ -772,34 +796,55 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
if (k[3] == k[2]) k[3] = NoSymbol;
if (k[1] == k[0]) k[1] = NoSymbol;
if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] = NoSymbol;
}
#if HACK_MISSING
/* Fix up some things that are normally missing.. */
if (HACK_MISSING) {
for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
if (k[0] == NoSymbol && k[1] == NoSymbol
&& k[2] == NoSymbol && k[3] == NoSymbol)
k[0] = known_keys[i].keysym;
}
for (i = 0; i < sizeof (known_keys) / sizeof (known_keys[0]); i++) {
k = info->keyMap + known_keys[i].keycode * GLYPHS_PER_KEY;
if ( k[0] == NoSymbol && k[1] == NoSymbol
&& k[2] == NoSymbol && k[3] == NoSymbol)
k[0] = known_keys[i].keysym;
}
#endif
#if HACK_KEYPAD
/* And some more things. We find the right symbols for the numeric
keypad, but not the KP_ keysyms. So try to convert known keycodes. */
if (HACK_KEYPAD) {
for (i = 0; i < sizeof (known_numeric_keys)
/ sizeof (known_numeric_keys[0]); i++) {
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
if (k[0] == known_numeric_keys[i].normal)
k[0] = known_numeric_keys[i].keypad;
}
keypad, but not the KP_ keysyms. So try to convert known keycodes. */
for (i = 0; i < sizeof (known_numeric_keys) / sizeof (known_numeric_keys[0]); i++) {
k = info->keyMap + known_numeric_keys[i].keycode * GLYPHS_PER_KEY;
if (k[0] == known_numeric_keys[i].normal)
k[0] = known_numeric_keys[i].keypad;
}
#endif
#if HACK_BLACKLIST
for (i = 0; i < sizeof (keycode_blacklist) / sizeof (keycode_blacklist[0]); i++) {
k = info->keyMap + keycode_blacklist[i] * GLYPHS_PER_KEY;
k[0] = k[1] = k[2] = k[3] = NoSymbol;
}
#endif
DarwinBuildModifierMaps(info);
return TRUE;
}
Bool QuartsResyncKeymap(Bool sendDDXEvent) {
Bool retval;
/* Update keyInfo */
pthread_mutex_lock(&keyInfo_mutex);
memset(keyInfo.keyMap, 0, sizeof(keyInfo.keyMap));
retval = QuartzReadSystemKeymap(&keyInfo);
pthread_mutex_unlock(&keyInfo_mutex);
/* Tell server thread to deal with new keyInfo */
if(sendDDXEvent)
DarwinSendDDXEvent(kXquartzReloadKeymap, 0);
return retval;
}

View File

@ -41,18 +41,10 @@
#define MIN_KEYCODE XkbMinLegalKeyCode // unfortunately, this isn't 0...
#define MAX_KEYCODE NUM_KEYCODES + MIN_KEYCODE - 1
typedef struct darwinKeyboardInfo_struct {
CARD8 modMap[MAP_LENGTH];
KeySym keyMap[MAP_LENGTH * GLYPHS_PER_KEY];
unsigned char modifierKeycodes[32][2];
} darwinKeyboardInfo;
/* These functions need to be implemented by Xquartz, XDarwin, etc. */
Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info);
Bool QuartsResyncKeymap(Bool sendDDXEvent);
/* Provided for darwinEvents.c */
extern darwinKeyboardInfo keyInfo;
extern pthread_mutex_t keyInfo_mutex;
void DarwinKeyboardReloadHandler(void);
int DarwinModifierNXKeycodeToNXKey(unsigned char keycode, int *outSide);
int DarwinModifierNXKeyToNXKeycode(int key, int side);