xserver: Branch 'xorg-server-1.4-apple' - 4 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Aug 19 02:18:39 PDT 2008


 dix/events.c                |    2 
 exa/exa.c                   |    2 
 hw/xquartz/X11Application.h |    1 
 hw/xquartz/X11Application.m |  265 ++++++++++++++++++++++----------------------
 hw/xquartz/darwin.c         |    3 
 hw/xquartz/darwin.h         |    1 
 6 files changed, 144 insertions(+), 130 deletions(-)

New commits:
commit 745bc8ab387d6794f47d8b9dca33b4c81f6dd39c
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Aug 19 02:18:16 2008 -0700

    XQuartz: Just cleaned up formatting of event processing code... no "meat" changed...

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 45a1190..c4209fa 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -77,7 +77,7 @@ struct message_struct {
 
 static mach_port_t _port;
 
-static void send_nsevent (NSEventType type, NSEvent *e);
+static void send_nsevent(NSEvent *e);
 
 /* Quartz mode initialization routine. This is often dynamically loaded
    but is statically linked into this X server. */
@@ -192,116 +192,117 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 }
 
 - (void) sendEvent:(NSEvent *)e {
- 	NSEventType type;
-	OSX_BOOL for_appkit, for_x;
-
-	type = [e type];
-
-	/* By default pass down the responder chain and to X. */
-	for_appkit = YES;
-	for_x = YES;
+    NSEventType type;
+    OSX_BOOL for_appkit, for_x;
     
-    if(darwinAppKitModMask & [e modifierFlags]) {
-        [super sendEvent:e];
-        return;
-    }
-  
-	switch (type) {
-		case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
-		case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
-		if ([e window] != nil) {
-			/* Pointer event has an (AppKit) window. Probably something for the kit. */
-			for_x = NO;
-			if (_x_active) [self activateX:NO];
-		} else if ([self modalWindow] == nil) {
-			/* Must be an X window. Tell appkit it doesn't have focus. */
-			for_appkit = NO;
-
-			if ([self isActive]) {
-				[self deactivate];
-				if (!_x_active && quartzProcs->IsX11Window([e window],
-					[e windowNumber]))
-					[self activateX:YES];
-			}
-		}
-		break;
-
-		case NSKeyDown: case NSKeyUp:
-		if (_x_active) {
-			static int swallow_up;
-
-			/* No kit window is focused, so send it to X. */
-			for_appkit = NO;
-			if (type == NSKeyDown) {
-				/* Before that though, see if there are any global
-				shortcuts bound to it. */
-
-					if (X11EnableKeyEquivalents
-						&& [[self mainMenu] performKeyEquivalent:e]) {
-							swallow_up = [e keyCode];
-							for_x = NO;
-					} else if (!quartzEnableRootless
-						&& ([e modifierFlags] & ALL_KEY_MASKS)
-						== (NSCommandKeyMask | NSAlternateKeyMask)
-						&& ([e keyCode] == 0 /*a*/
-							|| [e keyCode] == 53 /*Esc*/)) {
-						swallow_up = 0;
-						for_x = NO;
+    type = [e type];
+    
+    /* By default pass down the responder chain and to X. */
+    for_appkit = YES;
+    for_x = YES;
+    
+    switch ([e type]) {
+        case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
+        case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp:
+            if ([e window] != nil) {
+                /* Pointer event has an (AppKit) window. Probably something for the kit. */
+                for_x = NO;
+                if (_x_active) [self activateX:NO];
+            } else if ([self modalWindow] == nil) {
+                /* Must be an X window. Tell appkit it doesn't have focus. */
+                for_appkit = NO;
+                
+                if ([self isActive]) {
+                    [self deactivate];
+                    if (!_x_active && quartzProcs->IsX11Window([e window],
+                                                               [e windowNumber]))
+                        [self activateX:YES];
+                }
+            }
+            break;
+            
+        case NSKeyDown: case NSKeyUp:
+            if(darwinAppKitModMask & [e modifierFlags]) {
+                /* Override to force sending to Appkit */
+                for_x = NO;
+            } else if (_x_active) {
+                static int swallow_up;
+                
+                /* No kit window is focused, so send it to X. */
+                for_appkit = NO;
+                if ([e type] == NSKeyDown) {
+                    /* Before that though, see if there are any global
+                     shortcuts bound to it. */
+                    
+                    if (X11EnableKeyEquivalents
+                        && [[self mainMenu] performKeyEquivalent:e]) {
+                        swallow_up = [e keyCode];
+                        for_x = NO;
+                    } else if (!quartzEnableRootless
+                               && ([e modifierFlags] & ALL_KEY_MASKS)
+                               == (NSCommandKeyMask | NSAlternateKeyMask)
+                               && ([e keyCode] == 0 /*a*/
+                                   || [e keyCode] == 53 /*Esc*/)) {
+                        swallow_up = 0;
+                        for_x = NO;
 #ifdef DARWIN_DDX_MISSING
-						DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
+                        DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
 #endif
-					}
-			} else {
-			/* If we saw a key equivalent on the down, don't pass
-	   			the up through to X. */
-
-				if (swallow_up != 0 && [e keyCode] == swallow_up) {
-					swallow_up = 0;
-					for_x = NO;
-				}
-			}
-    		} else for_x = NO;
-    	break;
-
-		case NSFlagsChanged:
-			/* For the l33t X users who remap modifier keys to normal keysyms. */
-			if (!_x_active) for_x = NO;
-		break;
-
-		case NSAppKitDefined:
-		switch ([e subtype]) {
-			case NSApplicationActivatedEventType:
-      		for_x = NO;
-			if ([self modalWindow] == nil) {
-				for_appkit = NO;
-
-				/* FIXME: hack to avoid having to pass the event to appkit,
-	   			which would cause it to raise one of its windows. */
-				_appFlags._active = YES;
-
-				[self activateX:YES];
-				if ([e data2] & 0x10) 
-                    DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
-			}
-			break;
-
-			case 18: /* ApplicationDidReactivate */
-				if (quartzHasRoot) for_appkit = NO;
-			break;
-
-			case NSApplicationDeactivatedEventType:
-				for_x = NO;
-				[self activateX:NO];
-			break;
-		}
-	break;
- 
-	default: break; /* for gcc */
-	}
-
-	if (for_appkit) [super sendEvent:e];
-
-	if (for_x) send_nsevent (type, e);
+                    }
+                } else {
+                    /* If we saw a key equivalent on the down, don't pass
+                     the up through to X. */
+                    
+                    if (swallow_up != 0 && [e keyCode] == swallow_up) {
+                        swallow_up = 0;
+                        for_x = NO;
+                    }
+                }
+            } else {
+                for_x = NO;
+            }
+            break;
+            
+        case NSFlagsChanged:
+            /* Don't tell X11 about modifiers changing while it's not active */
+            if (!_x_active)
+                for_x = NO;
+            break;
+            
+        case NSAppKitDefined:
+            switch ([e subtype]) {
+                case NSApplicationActivatedEventType:
+                    for_x = NO;
+                    if ([self modalWindow] == nil) {
+                        for_appkit = NO;
+                        
+                        /* FIXME: hack to avoid having to pass the event to appkit,
+                         which would cause it to raise one of its windows. */
+                        _appFlags._active = YES;
+                        
+                        [self activateX:YES];
+                        if ([e data2] & 0x10) 
+                            DarwinSendDDXEvent(kXquartzBringAllToFront, 0);
+                    }
+                    break;
+                    
+                case 18: /* ApplicationDidReactivate */
+                    if (quartzHasRoot) for_appkit = NO;
+                    break;
+                    
+                case NSApplicationDeactivatedEventType:
+                    for_x = NO;
+                    [self activateX:NO];
+                    break;
+            }
+            break;
+            
+        default: break; /* for gcc */
+    }
+    
+    if (for_appkit) [super sendEvent:e];
+    
+    if (for_x) send_nsevent(e);
 }
 
 - (void) set_window_menu:(NSArray *)list {
@@ -846,7 +847,7 @@ convert_flags (unsigned int nsflags) {
 
 extern int darwin_modifier_flags; // darwinEvents.c
 
-static void send_nsevent (NSEventType type, NSEvent *e) {
+static void send_nsevent(NSEvent *e) {
 	NSRect screen;
 	NSPoint location;
 	NSWindow *window;
@@ -862,7 +863,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
 		NSRect frame = [window frame];
 		pointer_x = location.x + frame.origin.x;
 		pointer_y = (((screen.origin.y + screen.size.height)
-			- location.y) - frame.origin.y);
+                      - location.y) - frame.origin.y);
 	} else {
 		pointer_x = location.x;
 		pointer_y = (screen.origin.y + screen.size.height) - location.y;
@@ -878,8 +879,8 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
      */
     if(darwin_modifier_flags != [e modifierFlags])
         DarwinUpdateModKeys([e modifierFlags]);
-    
-	switch (type) {
+
+	switch ([e type]) {
 		case NSMouseMoved:        ev_button=0; ev_type=MotionNotify;  goto check_subtype;
 		case NSLeftMouseDown:     ev_button=1; ev_type=ButtonPress;   goto check_subtype;
 		case NSOtherMouseDown:    ev_button=2; ev_type=ButtonPress;   goto check_subtype;
@@ -890,8 +891,8 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
 		case NSLeftMouseDragged:  ev_button=1; ev_type=MotionNotify;  goto check_subtype;
 		case NSOtherMouseDragged: ev_button=2; ev_type=MotionNotify;  goto check_subtype;
 		case NSRightMouseDragged: ev_button=3; ev_type=MotionNotify;  goto check_subtype;
-		
-check_subtype:
+
+        check_subtype:
 			if ([e subtype] != NSTabletPointEventSubtype) 
                 goto handle_mouse;
 			// fall through to get tablet data
@@ -900,27 +901,25 @@ check_subtype:
             pressure = [e pressure];
 			tilt_x   = [e tilt].x;
 			tilt_y   = [e tilt].y; 
-            goto handle_mouse;
 			// fall through to normal mouse handling
-
-handle_mouse:
-		DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
-			pressure, tilt_x, tilt_y);
-		break;
+        handle_mouse:
+            DarwinSendPointerEvents(ev_type, ev_button, pointer_x, pointer_y,
+                                    pressure, tilt_x, tilt_y);
+            break;
 
 		case NSTabletProximity:
 			DarwinSendProximityEvents([e isEnteringProximity]?ProximityIn:ProximityOut,
-				pointer_x, pointer_y);
-		break;
+                                      pointer_x, pointer_y);
+            break;
 
 		case NSScrollWheel:
 			DarwinSendScrollEvents([e deltaX], [e deltaY], pointer_x, pointer_y,
-				pressure, tilt_x, tilt_y);
-		break;
+                                   pressure, tilt_x, tilt_y);
+            break;
 
 		case NSKeyDown: case NSKeyUp:
-            DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]);
-		break;
+            DarwinSendKeyboardEvents(([e type] == NSKeyDown) ? KeyPress : KeyRelease, [e keyCode]);
+            break;
 
         default: break; /* for gcc */
 	}	
commit 02af74d7a5a7225f408915254c40856159dc7f19
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Aug 19 02:02:11 2008 -0700

    XQuartz: Added appkit_modifiers defaults option which users can set to 'rcommand' to get access to the input menu with right command

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 8e7fed2..22a8728 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -91,6 +91,7 @@ extern int quartzHasRoot, quartzEnableRootless;
 #define PREFS_NO_QUIT_ALERT         "no_quit_alert"
 #define PREFS_FAKE_BUTTON2          "fake_button2"
 #define PREFS_FAKE_BUTTON3          "fake_button3"
+#define PREFS_APPKIT_MODIFIERS      "appkit_modifiers"
 #define PREFS_ROOTLESS              "rootless"
 #define PREFS_FULLSCREEN_HOTKEYS    "fullscreen_hotkeys"
 #define PREFS_SWAP_ALT_META         "swap_alt_meta"
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 9096f3d..45a1190 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -200,6 +200,11 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 	/* By default pass down the responder chain and to X. */
 	for_appkit = YES;
 	for_x = YES;
+    
+    if(darwinAppKitModMask & [e modifierFlags]) {
+        [super sendEvent:e];
+        return;
+    }
   
 	switch (type) {
 		case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown:
@@ -620,14 +625,17 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
     darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
                          default:darwinFakeButtons];
     if (darwinFakeButtons) {
-      const char *fake2, *fake3;
-      
-      fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL];
-      fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL];
-      
-      if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2);
-      if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3);
+        const char *fake2, *fake3;
+
+        fake2 = [self prefs_get_string:@PREFS_FAKE_BUTTON2 default:NULL];
+        fake3 = [self prefs_get_string:@PREFS_FAKE_BUTTON3 default:NULL];
+
+        if (fake2 != NULL) darwinFakeMouse2Mask = DarwinParseModifierList(fake2);
+        if (fake3 != NULL) darwinFakeMouse3Mask = DarwinParseModifierList(fake3);
     }
+
+    tem = [self prefs_get_string:@PREFS_APPKIT_MODIFIERS default:NULL];
+    if (tem != NULL) darwinAppKitModMask = DarwinParseModifierList(tem);
 	
     X11EnableKeyEquivalents = [self prefs_get_boolean:@PREFS_KEYEQUIVS
                                default:X11EnableKeyEquivalents];
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index a1f3df2..722276f 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -114,6 +114,9 @@ int                     darwinFakeMouse2Mask = NX_ALTERNATEMASK;
 int                     darwinFakeMouse3Mask = NX_COMMANDMASK;
 #endif
 
+// Modifier mask for overriding event delivery to appkit (might be useful to set this to rcommand for input menu
+int                     darwinAppKitModMask = 0;
+
 // devices
 DeviceIntPtr            darwinPointer = NULL;
 DeviceIntPtr            darwinTablet = NULL;
diff --git a/hw/xquartz/darwin.h b/hw/xquartz/darwin.h
index 51a0369..cbd6d67 100644
--- a/hw/xquartz/darwin.h
+++ b/hw/xquartz/darwin.h
@@ -79,6 +79,7 @@ extern int              darwinMouseAccelChange;
 extern int              darwinFakeButtons;
 extern int              darwinFakeMouse2Mask;
 extern int              darwinFakeMouse3Mask;
+extern int              darwinAppKitModMask;
 extern char            *darwinKeymapFile;
 extern int              darwinSyncKeymap;
 extern unsigned int     darwinDesiredWidth, darwinDesiredHeight;
commit cdadce8816ff0057412234a625b2a47135336a44
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Aug 19 02:00:35 2008 -0700

    XQuartz: Added debugging for NewCurrentScreen crash.

diff --git a/dix/events.c b/dix/events.c
index 5930ead..c0142ca 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2378,6 +2378,8 @@ NewCurrentScreen(ScreenPtr newScreen, int x, int y)
 {
     sprite.hotPhys.x = x;
     sprite.hotPhys.y = y;
+    ErrorF("noPanoramiXExtension=%d newScreen=%p\n", noPanoramiXExtension, newScreen);
+    ErrorF("newScreen->myNum=%d\n", newScreen->myNum);
 #ifdef PANORAMIX
     if(!noPanoramiXExtension) {
 	sprite.hotPhys.x += panoramiXdataPtr[newScreen->myNum].x - 
commit 6f7ab5a6ac20b8a9092c0644ff4bb69cb807a8d7
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Sun Aug 17 19:57:02 2008 +0200

    exa: fix assert logic thinko from 361a9eb953aaa38f8ebc057185de29e50f9eef26
    
    - I guess failing PrepareAccess is rare, since this a 3 year old bug.
    (cherry picked from commit c662381a14d2c69cc8b4aa1c66763cbaf6addc5d)

diff --git a/exa/exa.c b/exa/exa.c
index b2faf2f..34eccc9 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -365,7 +365,7 @@ exaPrepareAccess(DrawablePtr pDrawable, int index)
 
     if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
 	ExaPixmapPriv (pPixmap);
-	if (pExaPixmap->score != EXA_PIXMAP_SCORE_PINNED)
+	if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
 	    FatalError("Driver failed PrepareAccess on a pinned pixmap\n");
 	exaMoveOutPixmap (pPixmap);
     }


More information about the xorg-commit mailing list