xserver: Branch 'xorg-server-1.5-apple' - 9 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Tue Oct 21 09:35:02 PDT 2008


 configure.ac                                                        |    2 
 hw/xquartz/X11Application.m                                         |   39 ++-
 hw/xquartz/X11Controller.m                                          |    2 
 hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib   |    9 
 hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib |binary
 hw/xquartz/darwin.c                                                 |    3 
 hw/xquartz/pbproxy/x-selection.m                                    |  108 +++++++---
 hw/xquartz/quartz.c                                                 |    3 
 hw/xquartz/quartzCommon.h                                           |    1 
 hw/xquartz/quartzKeyboard.c                                         |  101 +++------
 hw/xquartz/xpr/xprAppleWM.c                                         |   22 +-
 11 files changed, 172 insertions(+), 118 deletions(-)

New commits:
commit b8a302242427edb3b3761cf837f08bccfb4e0542
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Oct 21 09:11:59 2008 -0700

    XQuartz: Only send mouse events while in the background if we're over a visible window.
    
    This "breaks" xeyes but gets rid of annoying tooltips.
    (cherry picked from commit 10090a132a0110fe24c8c886d9f53e6e947f8038)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 6e0b16e..c1a5194 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -959,6 +959,22 @@ static void send_nsevent(NSEvent *e) {
                 pDev = darwinTabletCurrent;
             }
 
+            if(!quartzServerVisible) {
+                xp_window_id wid;
+                
+                /* Sigh. Need to check that we're really over one of
+                 * our windows. (We need to receive pointer events while
+                 * not in the foreground, and the only way to do that
+                 * right now is to ask for _all_ pointer events..)
+                 */
+                
+                wid = 0;
+                xp_find_window(pointer_x, pointer_y, 0, &wid);
+                
+                if (wid == 0)
+                    return;        
+            }
+            
             DarwinSendPointerEvents(pDev, ev_type, ev_button, pointer_x, pointer_y,
                                     pressure, tilt_x, tilt_y);
             
commit de4fe10ac23ec52ea0971f8d9762d824136ae255
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Oct 21 09:07:08 2008 -0700

    XQuartz: More fullscreen fixes
      Start in rooted mode when enabled
      Make the hotkey cmd-alt-a behave
    (cherry picked from commit 22a54e46176c9cbdfaaa59ef33a6ae6a9c4969ef)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index ab617bd..6e0b16e 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -232,18 +232,12 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                 
                 if([e type] == NSKeyDown) {
                     /* Before that though, see if there are any global
-                     shortcuts bound to it. */
+                     * shortcuts bound to it. */
 
                     if(darwinAppKitModMask & [e modifierFlags]) {
                         /* Override to force sending to Appkit */
                         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 = [e keyCode];
-                        for_x = NO;
-                        DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
 #if XPLUGIN_VERSION >= 1
                     } else if(X11EnableKeyEquivalents &&
                               xp_is_symbolic_hotkey_event([e eventRef])) {
@@ -252,16 +246,25 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 #endif
                     } else if(X11EnableKeyEquivalents &&
                               [[self mainMenu] performKeyEquivalent:e]) {
+                        swallow_up = [e keyCode];
                         for_appkit = NO;
+                        for_x = NO;
+                    } else if(!quartzEnableRootless
+                              && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
+                              && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
+                        /* We have this here to force processing fullscreen 
+                         * toggle even if X11EnableKeyEquivalents is disabled */
                         swallow_up = [e keyCode];
                         for_x = NO;
+                        for_appkit = NO;
+                        DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
                     } else {
                         /* No kit window is focused, so send it to X. */
                         for_appkit = NO;
                     }
                 } else { /* KeyUp */
                     /* If we saw a key equivalent on the down, don't pass
-                     the up through to X. */
+                     * the up through to X. */
                     
                     if (swallow_up != 0 && [e keyCode] == swallow_up) {
                         swallow_up = 0;
diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c
index 2b318d3..3269f26 100644
--- a/hw/xquartz/darwin.c
+++ b/hw/xquartz/darwin.c
@@ -815,9 +815,6 @@ void ddxUseMsg( void )
 void ddxGiveUp( void )
 {
     ErrorF( "Quitting Xquartz...\n" );
-
-    //if (!quartzRootless)
-    //    quartzProcs->ReleaseScreens();
 }
 
 
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index a9c124a..e8ffb44 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -68,11 +68,10 @@
 
 // Shared global variables for Quartz modes
 int                     quartzEventWriteFD = -1;
-int                     quartzRootless = -1;
 int                     quartzUseSysBeep = 0;
 int                     quartzUseAGL = 1;
 int                     quartzEnableKeyEquivalents = 1;
-int                     quartzServerVisible = TRUE;
+int                     quartzServerVisible = FALSE;
 int                     quartzServerQuitting = FALSE;
 DevPrivateKey           quartzScreenKey = &quartzScreenKey;
 int                     aquaMenuBarHeight = 0;
diff --git a/hw/xquartz/quartzCommon.h b/hw/xquartz/quartzCommon.h
index a17ebb2..1c0eeba 100644
--- a/hw/xquartz/quartzCommon.h
+++ b/hw/xquartz/quartzCommon.h
@@ -55,7 +55,6 @@ typedef struct {
 extern int              quartzEventWriteFD;
 
 // User preferences used by Quartz modes
-extern int              quartzRootless;
 extern int              quartzUseSysBeep;
 extern int              focusOnNewWindow;
 extern int              quartzUseAGL;
commit 71ab6f5bd6b168642bd00205f9aa396e59e43754
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Oct 20 12:23:04 2008 -0700

    XQuartz: Cleaned up keyboard init and map reload.
    (cherry picked from commit f78c9fc06cac2cc6ddfd6e9ba435dd26a57d1f51)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 3a70522..eb57546 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -37,7 +37,6 @@
 #include <dix-config.h>
 #endif
 
-//#define XQUARTZ_USE_XKB 
 #define HACK_MISSING 1
 #define HACK_KEYPAD 1
 
@@ -307,9 +306,8 @@ const static struct {
 darwinKeyboardInfo keyInfo;
 pthread_mutex_t keyInfo_mutex = PTHREAD_MUTEX_INITIALIZER;
 
-static void DarwinChangeKeyboardControl( DeviceIntPtr device, KeybdCtrl *ctrl )
-{
-	// FIXME: to be implemented
+static void DarwinChangeKeyboardControl(DeviceIntPtr device, KeybdCtrl *ctrl) {
+    // FIXME: to be implemented
     // keyclick, bell volume / pitch, autorepead, LED's
 }
 
@@ -426,81 +424,72 @@ static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
 }
 
 /*
+ * DarwinKeyboardSetDeviceKeyMap
+ * Load a keymap into the keyboard device
+ */
+static void DarwinKeyboardSetDeviceKeyMap(KeySymsRec *keySyms) {
+    DeviceIntPtr pDev;
+
+    /* From ProcSetModifierMapping */
+    SendMappingNotify(MappingModifier, 0, 0, serverClient);
+    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+        if (pDev->key && pDev->coreEvents)
+            SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
+    
+    /* From ProcChangeKeyboardMapping */
+    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+        if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
+            assert(SetKeySymsMap(&pDev->key->curKeySyms, keySyms));
+
+    SendMappingNotify(MappingKeyboard, keySyms->minKeyCode,
+                      keySyms->maxKeyCode - keySyms->minKeyCode + 1, serverClient);
+    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+        if (pDev->key && pDev->coreEvents)
+            SendDeviceMappingNotify(serverClient, MappingKeyboard, keySyms->minKeyCode,
+                                    keySyms->maxKeyCode - keySyms->minKeyCode + 1, pDev);    
+}
+
+/*
  * DarwinKeyboardInit
  *      Get the Darwin keyboard map and compute an equivalent
  *      X keyboard map and modifier map. Set the new keyboard
  *      device structure.
  */
 void DarwinKeyboardInit(DeviceIntPtr pDev) {
-    KeySymsRec          keySyms;
+    KeySymsRec keySyms;
+	XkbComponentNamesRec names;
 
     // Open a shared connection to the HID System.
     // Note that the Event Status Driver is really just a wrapper
     // for a kIOHIDParamConnectType connection.
-    assert( darwinParamConnect = NXOpenEventStatus() );
+    assert(darwinParamConnect = NXOpenEventStatus());
 
     DarwinLoadKeyboardMapping(&keySyms);
-#ifdef XQUARTZ_USE_XKB
-	XkbComponentNamesRec names;
+
 	bzero(&names, sizeof(names));
+
     /* We need to really have rules... or something... */
-    XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
+    //XkbSetRulesDflts("base", "pc105", "us", NULL, NULL);
+    
     pthread_mutex_lock(&keyInfo_mutex);
     assert(XkbInitKeyboardDeviceStruct(pDev, &names, &keySyms, keyInfo.modMap,
-                                        QuartzBell, DarwinChangeKeyboardControl));
-	assert(SetKeySymsMap(&pDev->key->curKeySyms, &keySyms));
-	assert(keyInfo.modMap!=NULL);
-	assert(pDev->key->modifierMap!=NULL);
-	memcpy(pDev->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
+                                       QuartzBell, DarwinChangeKeyboardControl));
     pthread_mutex_unlock(&keyInfo_mutex);
-	
-	SendDeviceMappingNotify(serverClient, MappingKeyboard, 
-                            pDev->key->curKeySyms.minKeyCode, 
-                            pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
-	SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
+
 	SwitchCoreKeyboard(pDev);   
-#else
-    pthread_mutex_lock(&keyInfo_mutex);
-    assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
-                                      keyInfo.modMap, QuartzBell,
-                                      DarwinChangeKeyboardControl ));
-    pthread_mutex_unlock(&keyInfo_mutex);
-    SwitchCoreKeyboard(pDev);
-#endif
-}
 
+    DarwinKeyboardSetDeviceKeyMap(&keySyms);
+}
 
 void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
-    // Note that pDev is the device that "initiated" the reload event here...
-    // So we change this later on.
-    
-    DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev);
-
     KeySymsRec keySyms;
-    DarwinLoadKeyboardMapping(&keySyms);
 
-    /* From ProcSetModifierMapping */
-    SendMappingNotify(MappingModifier, 0, 0, serverClient);
-    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
-        if (pDev->key && pDev->coreEvents)
-            SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
-    
-    /* From ProcChangeKeyboardMapping */
-    SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, serverClient);
+    DEBUG_LOG("DarwinKeyboardReloadHandler\n");
 
-    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
-        if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
-            if (!SetKeySymsMap(&pDev->key->curKeySyms, &keySyms))
-                ErrorF("Error changing keysyms.  SetKeySymsMap failed.");
-    
-    SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, serverClient);
-    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
-        if (pDev->key && pDev->coreEvents)
-            SendDeviceMappingNotify(serverClient, MappingKeyboard,
-                                    MIN_KEYCODE, NUM_KEYCODES, pDev);
+    DarwinLoadKeyboardMapping(&keySyms);
+    DarwinKeyboardSetDeviceKeyMap(&keySyms);
 }
 
-
 //-----------------------------------------------------------------------------
 // Modifier translation functions
 //
commit f311a452c9eda8b23ec6bf0539118089a868eeff
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Mon Oct 20 09:46:34 2008 -0700

    XQuartz: Fixed follow-keyboard-layout
    ≈
    (cherry picked from commit a9f9fbf512c9fd5a773fce402182486edc71d5ab)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index cd46fb2..3a70522 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -68,8 +68,6 @@
 #include "X11/keysym.h"
 #include "keysym2ucs.h"
 
-void QuartzXkbUpdate(DeviceIntPtr pDev);
-
 enum {
     MOD_COMMAND = 256,
     MOD_SHIFT = 512,
@@ -427,16 +425,6 @@ static void DarwinLoadKeyboardMapping(KeySymsRec *keySyms) {
     pthread_mutex_unlock(&keyInfo_mutex);
 }
 
-void QuartzXkbUpdate(DeviceIntPtr pDev) {
-#ifdef XQUARTZ_USE_XKB
-	SendDeviceMappingNotify(serverClient, MappingKeyboard, 
-		pDev->key->curKeySyms.minKeyCode, 
-		pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
-	SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
-	SwitchCoreKeyboard(pDev);   
-#endif
-}
-
 /*
  * DarwinKeyboardInit
  *      Get the Darwin keyboard map and compute an equivalent
@@ -466,7 +454,11 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
 	memcpy(pDev->key->modifierMap, keyInfo.modMap, sizeof(keyInfo.modMap));
     pthread_mutex_unlock(&keyInfo_mutex);
 	
-	QuartzXkbUpdate(pDev);
+	SendDeviceMappingNotify(serverClient, MappingKeyboard, 
+                            pDev->key->curKeySyms.minKeyCode, 
+                            pDev->key->curKeySyms.maxKeyCode - pDev->key->curKeySyms.minKeyCode, pDev);
+	SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
+	SwitchCoreKeyboard(pDev);   
 #else
     pthread_mutex_lock(&keyInfo_mutex);
     assert( InitKeyboardDeviceStruct( (DevicePtr)pDev, &keySyms,
@@ -479,33 +471,33 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
 
 
 void DarwinKeyboardReloadHandler(int screenNum, xEventPtr xe, DeviceIntPtr pDev, int nevents) {
-    if (pDev == NULL) pDev = darwinKeyboard;
+    // Note that pDev is the device that "initiated" the reload event here...
+    // So we change this later on.
     
     DEBUG_LOG("DarwinKeyboardReloadHandler(%p)\n", pDev);
 
-#ifdef XQUARTZ_USE_XKB
-    QuartzXkbUpdate(pDev);
-#else
     KeySymsRec keySyms;
     DarwinLoadKeyboardMapping(&keySyms);
 
-    if (pDev->key) {
-        if (pDev->key->curKeySyms.map) xfree(pDev->key->curKeySyms.map);
-        if (pDev->key->modifierKeyMap) xfree(pDev->key->modifierKeyMap);
-        xfree(pDev->key);
-    }
-
-    pthread_mutex_lock(&keyInfo_mutex);
-    if (!InitKeyClassDeviceStruct(pDev, &keySyms, keyInfo.modMap)) {
-        DEBUG_LOG("InitKeyClassDeviceStruct failed\n");
-        pthread_mutex_unlock(&keyInfo_mutex);
-        return;
-    }
-    pthread_mutex_unlock(&keyInfo_mutex);
+    /* From ProcSetModifierMapping */
+    SendMappingNotify(MappingModifier, 0, 0, serverClient);
+    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+        if (pDev->key && pDev->coreEvents)
+            SendDeviceMappingNotify(serverClient, MappingModifier, 0, 0, pDev);
+    
+    /* From ProcChangeKeyboardMapping */
+    SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, serverClient);
 
-    SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, 0);
-    SendMappingNotify(MappingModifier, 0, 0, 0);
-#endif
+    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+        if ((pDev->coreEvents || pDev == inputInfo.keyboard) && pDev->key)
+            if (!SetKeySymsMap(&pDev->key->curKeySyms, &keySyms))
+                ErrorF("Error changing keysyms.  SetKeySymsMap failed.");
+    
+    SendMappingNotify(MappingKeyboard, MIN_KEYCODE, NUM_KEYCODES, serverClient);
+    for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+        if (pDev->key && pDev->coreEvents)
+            SendDeviceMappingNotify(serverClient, MappingKeyboard,
+                                    MIN_KEYCODE, NUM_KEYCODES, pDev);
 }
 
 
commit b47b7ab6d6d0a7f6cbf678a5755124d6b7516d3e
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Oct 21 09:29:37 2008 -0700

    XQuartz: More progress towards fullscreen...
    (cherry picked from commit 628cae86b4ad02c49d20df1e1afdcb7abcabb649)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2d3fa7c..ab617bd 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -238,14 +238,12 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
                         /* Override to force sending to Appkit */
                         swallow_up = [e keyCode];
                         for_x = NO;
-#if 0
                     } else if(!quartzEnableRootless
                               && ([e modifierFlags] & ALL_KEY_MASKS) == (NSCommandKeyMask | NSAlternateKeyMask)
                               && ([e keyCode] == 0 /*a*/ || [e keyCode] == 53 /*Esc*/)) {
                         swallow_up = [e keyCode];
                         for_x = NO;
                         DarwinSendDDXEvent(kXquartzToggleFullscreen, 0);
-#endif
 #if XPLUGIN_VERSION >= 1
                     } else if(X11EnableKeyEquivalents &&
                               xp_is_symbolic_hotkey_event([e eventRef])) {
@@ -625,13 +623,11 @@ static NSMutableArray * cfarray_to_nsarray (CFArrayRef in) {
 	
     quartzUseSysBeep = [self prefs_get_boolean:@PREFS_SYSBEEP
                         default:quartzUseSysBeep];
-#if 0
     quartzEnableRootless = [self prefs_get_boolean:@PREFS_ROOTLESS
                         default:quartzEnableRootless];
     quartzFullscreenDisableHotkeys = ![self prefs_get_boolean:
 					      @PREFS_FULLSCREEN_HOTKEYS default:
 					      !quartzFullscreenDisableHotkeys];
-#endif
     darwinFakeButtons = [self prefs_get_boolean:@PREFS_FAKEBUTTONS
                          default:darwinFakeButtons];
     if (darwinFakeButtons) {
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 8513386..d4958b5 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -688,8 +688,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
     [sync_text2 setTextColor:pbproxy_active ? [NSColor controlTextColor] : [NSColor disabledControlTextColor]];
 
     [enable_fullscreen setIntValue:!quartzEnableRootless];
-    // TODO: Add fullscreen support
-    [enable_fullscreen setEnabled:NO];
 	
     [prefs_panel makeKeyAndOrderFront:sender];
 }
commit 5ed1b6761948b44b603911020311c5c94dbaecf3
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Oct 17 09:25:26 2008 -0700

    XQuartz: Fixed missing key-equiv for Hide-Others.
    (cherry picked from commit 2c4b0f9615b646712609ebef3c0851c9a22e781b)

diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib
index 7490e0f..58a1336 100644
--- a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib
+++ b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib
@@ -8,8 +8,6 @@
 		<string key="IBDocument.HIToolboxVersion">352.00</string>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="57"/>
-			<integer value="348"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -151,8 +149,8 @@
 								<object class="NSMenuItem" id="206802571">
 									<reference key="NSMenu" ref="576521955"/>
 									<string key="NSTitle">Hide Others</string>
-									<string key="NSKeyEquiv"/>
-									<int key="NSKeyEquivModMask">1048576</int>
+									<string key="NSKeyEquiv">h</string>
+									<int key="NSKeyEquivModMask">1572864</int>
 									<int key="NSMnemonicLoc">2147483647</int>
 									<reference key="NSOnImage" ref="531645050"/>
 									<reference key="NSMixedImage" ref="351811234"/>
@@ -402,7 +400,7 @@
 				<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
 				<string key="NSWindowContentMinSize">{320, 240}</string>
 				<object class="NSView" key="NSWindowView" id="941366957">
-					<reference key="NSNextResponder"/>
+					<nil key="NSNextResponder"/>
 					<int key="NSvFlags">256</int>
 					<object class="NSMutableArray" key="NSSubviews">
 						<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1197,7 +1195,6 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string>
 						</object>
 					</object>
 					<string key="NSFrameSize">{484, 308}</string>
-					<reference key="NSSuperview"/>
 				</object>
 				<string key="NSScreenRect">{{0, 0}, {1280, 938}}</string>
 				<string key="NSMinSize">{320, 262}</string>
diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib
index c549568..1b5aa88 100644
Binary files a/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib and b/hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib differ
commit 059ffeb8c732c91f4bbea2791eba907f709f9e85
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Oct 16 22:36:00 2008 -0700

    XQuartz: Require applewmproto-1.1.1
    (cherry picked from commit ed235e3406e603a8a92c4b72f9f9018bae72ad65)

diff --git a/configure.ac b/configure.ac
index 5193397..afd8f0f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1759,7 +1759,7 @@ if test "x$XQUARTZ" = xyes; then
 
 	CFLAGS="${CFLAGS} -DROOTLESS_WORKAROUND -DNO_ALLOCA"
 
-	PKG_CHECK_MODULES(APPLEWM, [applewmproto >= 1.1.0])
+	PKG_CHECK_MODULES(APPLEWM, [applewmproto >= 1.1.1])
 
 	if test "x$INTEGRATED_XPBPROXY" = xyes ; then
 		AC_DEFINE(INTEGRATED_XPBPROXY,1,[Build xpbproxy into the server rather than as a standalone app])
commit 7863c44829e9445fad1f745b62f051d088e287a3
Author: George Peter Staplin <gps at Georges-Workstation.local>
Date:   Thu Oct 16 13:09:21 2008 -0600

    XQuartz: pbproxy: Fix 2 bugs with the preferences.
    
    Add dump_prefs() for instrospection.
    
    Make prefs_get_bool a little more clear.
    
    In get_property don't assume that the Mac realloc(NULL, 0); returns
    non-NULL.  We shouldn't depend on implementation-defined behavior too
    much.
    
    Add more commentary in various spots.
    
    Add TARGETS in the TARGETS response.  I don't know why some X11 apps
    do this, but it could be something that some weird toolkit/app tests
    for.
    
    In reload_preferences add preferences synchronization, so that xpbproxy
    reloads the preferences, and picks up any changes.
    
    Fix a typo/misspelling of the sync_clipboard_to_pasteboard preference.
    (cherry picked from commit 165cbbb90c793d9335ea76f0274b1f60ad295903)

diff --git a/hw/xquartz/pbproxy/x-selection.m b/hw/xquartz/pbproxy/x-selection.m
index 888c9e8..16c4d52 100644
--- a/hw/xquartz/pbproxy/x-selection.m
+++ b/hw/xquartz/pbproxy/x-selection.m
@@ -26,7 +26,8 @@
    Except as contained in this notice, the name(s) of the above
    copyright holders shall not be used in advertising or otherwise to
    promote the sale, use or other dealings in this Software without
-   prior written authorization. */
+   prior written authorization. 
+*/
 
 #import "x-selection.h"
 
@@ -53,6 +54,8 @@
  * changed.  If the NSPasteboard has changed, then we set pbproxy as owner
  * of the PRIMARY and CLIPBOARD and respond to requests for text and images.
  *
+ * The behavior is now dynamic since the information above was written.
+ * The behavior is now dependent on the pbproxy_prefs below.
  */
 
 /*
@@ -75,14 +78,31 @@ static struct {
 
 static struct propdata null_propdata = {NULL, 0};
 
-#define APP_PREFS "org.x.X11"
-static BOOL prefs_get_bool (CFStringRef key, BOOL def) {
-     int ret;
-     Boolean ok;
+static void
+dump_prefs (FILE *fp) {
+    fprintf(fp, 
+	    "pbproxy preferences:\n"
+	    "\tactive %u\n"
+	    "\tprimary_on_grab %u\n"
+	    "\tclipboard_to_pasteboard %u\n"
+	    "\tpasteboard_to_primary %u\n"
+	    "\tpasteboard_to_clipboard %u\n",
+	    pbproxy_prefs.active,
+	    pbproxy_prefs.primary_on_grab,
+	    pbproxy_prefs.clipboard_to_pasteboard,
+	    pbproxy_prefs.pasteboard_to_primary,
+	    pbproxy_prefs.pasteboard_to_clipboard);
+}
 
-     ret = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok);
 
-     return ok ? (BOOL) ret : def;
+#define APP_PREFS "org.x.X11"
+static BOOL
+prefs_get_bool (CFStringRef key, BOOL defaultValue) {
+    Boolean value, ok;
+    
+    value = CFPreferencesGetAppBooleanValue (key, CFSTR (APP_PREFS), &ok);
+   
+    return ok ? (BOOL) value : defaultValue;
 }
 
 static void
@@ -157,23 +177,31 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 #ifdef TEST
 	printf("chunkbytesize %zu\n", chunkbytesize);
 #endif
-	newbuflen = buflen + chunkbytesize;
-	newbuf = realloc (buf, newbuflen);
-
-	if (NULL == newbuf)
+ 	newbuflen = buflen + chunkbytesize;
+	if (newbuflen > 0) 
 	{
+	    newbuf = realloc (buf, newbuflen);
+	    
+	    if (NULL == newbuf)
+	    {
+		XFree (chunk);
+		free (buf);
+		return True;
+	    }
+	
+	    memcpy (newbuf + buflen, chunk, chunkbytesize);
 	    XFree (chunk);
-	    free (buf);
-	    return True;
+	    buf = newbuf;
+	    buflen = newbuflen;
+	    /* offset is a multiple of 32 bits*/
+	    offset += chunkbytesize / 4;
+	} 
+	else 
+	{
+	    if (chunk) 
+		XFree (chunk);
 	}
 	
-	memcpy (newbuf + buflen, chunk, chunkbytesize);
-	XFree (chunk);
-	buf = newbuf;
-	buflen = newbuflen;
-	/* offset is a multiple of 32 bits*/
-	offset += chunkbytesize / 4;
-
 #ifdef TEST
 	printf("bytesleft %lu\n", bytesleft);
 #endif
@@ -326,9 +354,7 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
     pb = [NSPasteboard generalPasteboard];
 
     if (nil == pb)
-    {
 	return;
-    }
 
     countNow = [pb changeCount];
 
@@ -395,7 +421,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 	if (1 == pending_copy) {
 	    /*
 	     * There are no other copy operations in progress, so we
-	     * can proceed safely.
+	     * can proceed safely.  Otherwise the copy_completed method
+	     * will see that the pending_copy is > 1, and do another copy.
 	     */	    
 	    [self x_copy_request_targets];
 	}
@@ -421,7 +448,9 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
             return TRUE;
 
         if(owner != None) {
-            fprintf (stderr, "A clipboard manager is already running on window 0x%x.  pbproxy will not sync clipboard to pasteboard.\n", (int)owner);
+            fprintf (stderr, "A clipboard manager using window 0x%lx "
+		     "already owns the clipboard selection.  "
+		     "pbproxy will not sync clipboard to pasteboard.\n", owner);
             return FALSE;
         }
         
@@ -463,7 +492,8 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
             /* Another CLIPBOARD_MANAGER has set itself as owner.  Disable syncing
              * to avoid a race.
              */
-            fprintf(stderr, "Another clipboard manager was started!  xpbproxy is disabling syncing with clipboard.\n"); 
+            fprintf(stderr, "Another clipboard manager was started!  "
+		    "xpbproxy is disabling syncing with clipboard.\n"); 
             pbproxy_prefs.clipboard_to_pasteboard = NO;
         }
     }
@@ -559,9 +589,16 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
     pbtypes = [pb types];
     if (pbtypes)
     {
-	long list[6]; /* Don't forget to increase this if we handle more types! */
+	long list[7]; /* Don't forget to increase this if we handle more types! */
         long count = 0;
  	
+	/*
+	 * I'm not sure if this is needed, but some toolkits/clients list 
+	 * TARGETS in response to targets. 
+	 */
+	list[count] = atoms->targets;
+	++count;
+
 	if ([pbtypes containsObject:NSStringPboardType])
 	{
 	    /* We have a string type that we can convert to UTF8, or Latin-1... */
@@ -785,7 +822,6 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
   	NSBitmapImageRep *bmimage = [[NSBitmapImageRep alloc] initWithData:data];
 	NSDictionary *dict;
 	NSData *encdata;
-	
 
 	if (nil == bmimage)
 	{
@@ -992,7 +1028,10 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 
 	if (0 == pdata.length) 
 	{
-	    /* We completed the transfer. */
+	    /*
+	     * We completed the transfer.
+	     * handle_selection will call copy_completed: for us.
+	     */
 	    [self handle_selection:pending.selection type:type propdata:&pending.propdata];
 	    free_propdata(&pdata);
 	    pending.propdata = null_propdata;
@@ -1272,12 +1311,21 @@ get_property(Window win, Atom property, struct propdata *pdata, Bool delete, Ato
 
 - (void) reload_preferences
 {
+    /*
+     * It's uncertain how we could handle the synchronization failing, so cast to void.
+     * The prefs_get_bool should fall back to defaults if the org.x.X11 plist doesn't exist or is invalid.
+     */
+    (void)CFPreferencesAppSynchronize(CFSTR(APP_PREFS));
+
     pbproxy_prefs.active = prefs_get_bool(CFSTR("sync_pasteboard"), pbproxy_prefs.active);
     pbproxy_prefs.primary_on_grab = prefs_get_bool(CFSTR("sync_primary_on_select"), pbproxy_prefs.primary_on_grab);
-    pbproxy_prefs.clipboard_to_pasteboard = prefs_get_bool(CFSTR("sync_clibpoard_to_pasteboard"), pbproxy_prefs.clipboard_to_pasteboard);
+    pbproxy_prefs.clipboard_to_pasteboard = prefs_get_bool(CFSTR("sync_clipboard_to_pasteboard"), pbproxy_prefs.clipboard_to_pasteboard);
     pbproxy_prefs.pasteboard_to_primary = prefs_get_bool(CFSTR("sync_pasteboard_to_primary"), pbproxy_prefs.pasteboard_to_primary);
     pbproxy_prefs.pasteboard_to_clipboard =  prefs_get_bool(CFSTR("sync_pasteboard_to_clipboard"), pbproxy_prefs.pasteboard_to_clipboard);
-    
+
+    /* This is used for debugging. */
+    //dump_prefs(stdout);
+
     if(pbproxy_prefs.active && pbproxy_prefs.primary_on_grab && !have_xfixes) {
         fprintf(stderr, "Disabling sync_primary_on_select functionality due to missing XFixes extension.\n");
         pbproxy_prefs.primary_on_grab = NO;
commit d43d82a4222c3bcb084708a7e1bc74e5ee1027c1
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Oct 15 21:26:58 2008 -0700

    XQuartz: Fixed window levels.
    (cherry picked from commit ef4d37c73f31048dd74efee2c63fa08b92608f87)

diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index aa5f291..6480262 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -32,10 +32,25 @@
 #endif
 
 #include "xpr.h"
+
+#define _APPLEWM_SERVER_
+#include <X11/extensions/applewmstr.h>
+
 #include "applewmExt.h"
 #include "rootless.h"
 #include <Xplugin.h>
 #include <X11/X.h>
+#include "quartz.h"
+
+/* This lookup table came straight from the Tiger X11 source.  I tried to figure
+ * it out based on CGWindowLevel.h, but I dunno... -JH
+ */
+static const int normal_window_levels[AppleWMNumWindowLevels+1] = {
+0, 3, 4, 5, LONG_MIN + 30, LONG_MIN + 29,
+};
+static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
+202, 203, 204, 205, 201, 200
+};
 
 static int xprSetWindowLevel(
     WindowPtr pWin,
@@ -50,7 +65,12 @@ static int xprSetWindowLevel(
 
     RootlessStopDrawing (pWin, FALSE);
 
-    wc.window_level = level;
+    //if (WINREC(WindowTable[pWin->drawable.pScreen->myNum]) == NULL)
+    if (quartzHasRoot)
+        wc.window_level = normal_window_levels[level];
+    else
+        wc.window_level = rooted_window_levels[level];
+    
     if (xp_configure_window (wid, XP_WINDOW_LEVEL, &wc) != Success) {
         return BadValue;
     }


More information about the xorg-commit mailing list