XQuartz: Enable a defaults option to toggle off the vnc bug workaround

This commit is contained in:
Jeremy Huddleston 2008-12-29 00:29:12 -08:00
parent cbb0a8a3fb
commit 4af2acc5fd

View file

@ -67,6 +67,7 @@ extern BOOL xpbproxy_init (void);
#define VNCMODIFIERBUGWORKAROUND 1
#ifdef VNCMODIFIERBUGWORKAROUND
static BOOL vncModifierBugWorkaround = YES;
static NSEventType keyState[NUM_KEYCODES];
#endif
@ -207,10 +208,12 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
}
} else {
#ifdef VNCMODIFIERBUGWORKAROUND
DarwinUpdateModKeys(0);
for(i=0; i < NUM_KEYCODES; i++) {
if(keyState[i] == NSKeyDown)
DarwinSendKeyboardEvents(KeyRelease, i);
if(vncModifierBugWorkaround) {
DarwinUpdateModKeys(0);
for(i=0; i < NUM_KEYCODES; i++) {
if(keyState[i] == NSKeyDown)
DarwinSendKeyboardEvents(KeyRelease, i);
}
}
#endif
DarwinSendDDXEvent(kXquartzDeactivate, 0);
@ -694,7 +697,11 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
{
NSString *nsstr;
const char *tem;
#ifdef VNCMODIFIERBUGWORKAROUND
vncModifierBugWorkaround = [self prefs_get_boolean:@"vncModifierBugWorkaround" default:vncModifierBugWorkaround];
#endif
quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
default:quartzUseSysBeep];
quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
@ -898,8 +905,10 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
name:NSWindowDidBecomeKeyNotification object:nil];
#ifdef VNCMODIFIERBUGWORKAROUND
for(i=0; i < NUM_KEYCODES; i++) {
keyState[i] = NSKeyUp;
if(vncModifierBugWorkaround) {
for(i=0; i < NUM_KEYCODES; i++) {
keyState[i] = NSKeyUp;
}
}
#endif
@ -976,14 +985,15 @@ extern int darwin_modifier_flags; // darwinEvents.c
tilt_x = 0;
tilt_y = 0;
#ifndef VNCMODIFIERBUGWORKAROUND
/* We don't receive modifier key events while out of focus, and 3button
* emulation mucks this up, so we need to check our modifier flag state
* on every event... ugg
*/
#ifdef VNCMODIFIERBUGWORKAROUND
if(!vncModifierBugWorkaround)
#endif
if(darwin_modifier_flags != [e modifierFlags])
DarwinUpdateModKeys([e modifierFlags]);
#endif
switch ([e type]) {
case NSLeftMouseDown: ev_button=1; ev_type=ButtonPress; goto handle_mouse;
@ -1124,7 +1134,8 @@ extern int darwin_modifier_flags; // darwinEvents.c
}
#ifdef VNCMODIFIERBUGWORKAROUND
keyState[[e keyCode]] == [e type];
if(vncModifierBugWorkaround)
keyState[[e keyCode]] == [e type];
#endif
DarwinSendKeyboardEvents(([e type] == NSKeyDown) ? KeyPress : KeyRelease, [e keyCode]);
@ -1132,7 +1143,8 @@ extern int darwin_modifier_flags; // darwinEvents.c
#ifdef VNCMODIFIERBUGWORKAROUND
case NSFlagsChanged:
DarwinUpdateModKeys([e modifierFlags]);
if(vncModifierBugWorkaround)
DarwinUpdateModKeys([e modifierFlags]);
break;
#endif