[Xquartz-changes] xserver: Branch 'server-1.7-apple' - 18 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Thu Nov 5 11:10:10 PST 2009


 dix/events.c                     |    8 ++----
 exa/exa_mixed.c                  |    4 ---
 glx/glapi.c                      |    7 ++++-
 glx/unpack.h                     |    2 -
 hw/dmx/dmx.c                     |    3 +-
 hw/kdrive/linux/evdev.c          |   15 ++++++++++-
 hw/xfree86/common/xf86Mode.c     |   29 +++++++++-------------
 hw/xfree86/common/xf86Xinput.c   |    4 +--
 hw/xfree86/i2c/fi1236.c          |   10 +++----
 hw/xfree86/loader/sdksyms.sh     |    1 
 hw/xfree86/modes/xf86Crtc.c      |   31 -----------------------
 hw/xfree86/modes/xf86EdidModes.c |   51 +++++++++++++++++++++++++++++++++++----
 hw/xfree86/modes/xf86Modes.c     |   34 ++++++++++++++++++++++++++
 hw/xfree86/modes/xf86Modes.h     |    3 ++
 hw/xfree86/parser/Flags.c        |    2 -
 hw/xquartz/X11Application.h      |    1 
 hw/xquartz/X11Application.m      |   13 +++++++++
 hw/xquartz/X11Controller.h       |    3 +-
 hw/xquartz/X11Controller.m       |   16 ++++++------
 hw/xquartz/applewm.c             |   20 ++++++++-------
 hw/xquartz/quartzKeyboard.c      |   37 ++++++++++++++++++++++++----
 21 files changed, 198 insertions(+), 96 deletions(-)

New commits:
commit aa832231f3a5bbe47702e0df2a34f08e7bf03bd6
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 18:39:16 2009 -0800

    XQuartz: Cleanup X11Controller.m compilation warnings.
    
    Declare X11Controller as implementing NSTableViewDataSource.
    Use selectRowIndexes:byExtendingSelection instead of selectRow:byExtendingSelection
    (cherry picked from commit 0ea1a15cb779f2b52ef25413c75e419f76a4149d)

diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 88f50a1..bb28447 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -55,7 +55,7 @@ typedef unsigned int NSUInteger;
 #endif
 #endif
 
- at interface X11Controller : NSObject
+ at interface X11Controller : NSObject <NSTableViewDataSource>
 {
     IBOutlet NSPanel *prefs_panel;
 
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
index 1191547..b28f4d3 100644
--- a/hw/xquartz/X11Controller.m
+++ b/hw/xquartz/X11Controller.m
@@ -426,8 +426,8 @@
   [[columns objectAtIndex:2] setIdentifier:@"2"];
 	
   [apps_table setDataSource:self];
-  [apps_table selectRow:0 byExtendingSelection:NO];
-	
+  [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:0] byExtendingSelection:NO];
+
   [[apps_table window] makeKeyAndOrderFront:sender];
   [apps_table reloadData];
   if(oldapps != nil)
@@ -474,7 +474,7 @@
   [item release];
 	
   [apps_table reloadData];
-  [apps_table selectRow:row byExtendingSelection:NO];
+  [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
 }
 
 - (IBAction) apps_table_duplicate:sender
@@ -497,7 +497,7 @@
   [item release];
 	
   [apps_table reloadData];
-  [apps_table selectRow:row+1 byExtendingSelection:NO];
+  [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row+1] byExtendingSelection:NO];
 }
 
 - (IBAction) apps_table_delete:sender
@@ -519,10 +519,10 @@
 	
   row = MIN (row, [table_apps count] - 1);
   if (row >= 0)
-    [apps_table selectRow:row byExtendingSelection:NO];
+    [apps_table selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
 }
 
-- (int) numberOfRowsInTableView:(NSTableView *)tableView
+- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView
 {
   if (table_apps == nil) return 0;
   
@@ -530,7 +530,7 @@
 }
 
 - (id) tableView:(NSTableView *)tableView
-objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
+objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
   NSArray *item;
   int col;
@@ -547,7 +547,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row
 }
 
 - (void) tableView:(NSTableView *)tableView setObjectValue:(id)object
-    forTableColumn:(NSTableColumn *)tableColumn row:(int)row
+    forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
 {
   NSMutableArray *item;
   int col;
commit d85e31ea0509586ec6c84154083e882afdca5c8e
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 18:15:08 2009 -0800

    XQuartz: Use dixLookupResourceByType instead of LookupIDByType
    (cherry picked from commit 4e1f12e032595ccf1bd14693c35ca42e79b09fe3)

diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c
index d2cca13..d1a6175 100644
--- a/hw/xquartz/applewm.c
+++ b/hw/xquartz/applewm.c
@@ -213,10 +213,11 @@ static int
 WMFreeClient (pointer data, XID id) {
     WMEventPtr   pEvent;
     WMEventPtr   *pHead, pCur, pPrev;
+    int i;
 
     pEvent = (WMEventPtr) data;
-    pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
-    if (pHead) {
+    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess | DixWriteAccess | DixDestroyAccess);
+    if (i == Success && pHead) {
         pPrev = 0;
         for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next)
             pPrev = pCur;
@@ -254,12 +255,12 @@ ProcAppleWMSelectInput (register ClientPtr client)
     REQUEST(xAppleWMSelectInputReq);
     WMEventPtr      pEvent, pNewEvent, *pHead;
     XID             clientResource;
+    int             i;
 
     REQUEST_SIZE_MATCH (xAppleWMSelectInputReq);
-    pHead = (WMEventPtr *)SecurityLookupIDByType(client,
-                        eventResource, EventType, DixWriteAccess);
+    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, client, DixWriteAccess);
     if (stuff->mask != 0) {
-        if (pHead) {
+        if (i == Success && pHead) {
             /* check for existing entry. */
             for (pEvent = *pHead; pEvent; pEvent = pEvent->next)
             {
@@ -293,7 +294,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
          * the list may be arbitrarily rearranged which cannot be
          * done through the resource database.
          */
-        if (!pHead)
+        if (i != Success || !pHead)
         {
             pHead = (WMEventPtr *) xalloc (sizeof (WMEventPtr));
             if (!pHead ||
@@ -309,7 +310,7 @@ ProcAppleWMSelectInput (register ClientPtr client)
         updateEventMask (pHead);
     } else if (stuff->mask == 0) {
         /* delete the interest */
-        if (pHead) {
+        if (i == Success && pHead) {
             pNewEvent = 0;
             for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
                 if (pEvent->client == client)
@@ -342,9 +343,10 @@ AppleWMSendEvent (int type, unsigned int mask, int which, int arg) {
     WMEventPtr      *pHead, pEvent;
     ClientPtr       client;
     xAppleWMNotifyEvent se;
+    int             i;
 
-    pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType);
-    if (!pHead)
+    i = dixLookupResourceByType((pointer *)&pHead, eventResource, EventType, serverClient, DixReadAccess);
+    if (i != Success || !pHead)
         return;
     for (pEvent = *pHead; pEvent; pEvent = pEvent->next) {
         client = pEvent->client;
commit 2ddc1a94897df8c90aab64cbf9a9d66b59411d61
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 16:18:06 2009 -0800

    XQuartz: Don't weed out duplicates in generated keymap
    
    There seems to be an issue in the 1.5+ server where shift-space does not
    produce a space when 'keycode 57 = space' but it does when 'keycode 57 = space
    space'
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>
    (cherry picked from commit 7f919e0c0eae51a81ed5ec502a02cc8c324aafe9)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 1b3c27e..90f6610 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -387,6 +387,7 @@ void DarwinKeyboardReloadHandler(void) {
         keySyms.minKeyCode = MIN_KEYCODE;
         keySyms.maxKeyCode = MAX_KEYCODE;
 
+	// TODO: We should build the entire XkbDescRec and use XkbCopyKeymap
         /* Apply the mappings to darwinKeyboard */
         XkbApplyMappingChange(darwinKeyboard, &keySyms, keySyms.minKeyCode,
                               keySyms.maxKeyCode - keySyms.minKeyCode + 1,
@@ -767,9 +768,12 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 #endif
         }
 
-        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;
+        // There seems to be an issue with this in 1.5+, shift-space is not
+        // producing space, it's sending NoSymbol... ?
+        //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;
     }
 
     /* Fix up some things that are normally missing.. */
@@ -780,7 +784,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
 
             if    (k[0] == NoSymbol && k[1] == NoSymbol
                 && k[2] == NoSymbol && k[3] == NoSymbol)
-	      k[0] = known_keys[i].keysym;
+	      k[0] = k[1] = k[2] = k[3] = known_keys[i].keysym;
         }
     }
 
@@ -793,7 +797,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
             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;
+                k[0] = k[1] = k[2] = k[3] = known_numeric_keys[i].keypad;
         }
     }
 
commit f169c036df59a205a3c1f350bef16052a5d5a837
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Nov 4 13:34:20 2009 -0800

    XQuartz: Controller thread launches clients
    
    This avoids a memory leak due to no active auto-release pool on the server thread.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>
    (cherry picked from commit e33f640c2ae10f225eeb486c141266f85f8367ae)

diff --git a/hw/xquartz/X11Application.h b/hw/xquartz/X11Application.h
index 5e828a4..d7e9a5f 100644
--- a/hw/xquartz/X11Application.h
+++ b/hw/xquartz/X11Application.h
@@ -71,6 +71,7 @@ void X11ApplicationSetFrontProcess (void);
 void X11ApplicationSetCanQuit (int state);
 void X11ApplicationServerReady (void);
 void X11ApplicationShowHideMenubar (int state);
+void X11ApplicationLaunchClient (const char *cmd);
 
 void X11ApplicationMain(int argc, char **argv, char **envp);
 
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index 2c95485..f3c8a30 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -411,6 +411,9 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
         SetSystemUIMode(kUIModeAllHidden, quartzFullscreenMenu ? kUIOptionAutoShowMenuBar : 0); // kUIModeAllSuppressed or kUIOptionAutoShowMenuBar can be used to allow "mouse-activation"
 }
 
+- (void) launch_client:(NSString *)cmd {
+    (void)[_controller application:self openFile:cmd];
+}
 
 /* user preferences */
 
@@ -856,6 +859,16 @@ void X11ApplicationShowHideMenubar (int state) {
     [n release];
 }
 
+void X11ApplicationLaunchClient (const char *cmd) {
+    NSString *string;
+    
+    string = [[NSString alloc] initWithUTF8String:cmd];
+	
+    message_kit_thread (@selector (launch_client:), string);
+	
+    [string release];
+}
+
 static void check_xinitrc (void) {
     char *tem, buf[1024];
     NSString *msg;
@@ -961,12 +974,6 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
     /* not reached */
 }
 
-void launch_client(const char *cmd) {
-    NSString *string = [[NSString alloc] initWithUTF8String:cmd];
-    [[X11App controller] launch_client:string];
-    [string release];
-}
-
 @implementation X11Application (Private)
 
 #ifdef NX_DEVICELCMDKEYMASK
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index 3d8e007..88f50a1 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -120,6 +120,7 @@ typedef unsigned int NSUInteger;
 #endif
 - (void) set_can_quit:(OSX_BOOL)state;
 - (void) server_ready;
+- (OSX_BOOL) application:(NSApplication *)app openFile:(NSString *)filename;
 
 - (IBAction) apps_table_show:(id)sender;
 - (IBAction) apps_table_done:(id)sender;
@@ -144,6 +145,5 @@ typedef unsigned int NSUInteger;
 #endif /* __OBJC__ */
 
 void X11ControllerMain(int argc, char **argv, char **envp);
-void launch_client(const char *cmd);
 
 #endif /* X11CONTROLLER_H */
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 5bbb9c9..1b3c27e 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -408,7 +408,7 @@ void DarwinKeyboardReloadHandler(void) {
     if (access(xmodmap, F_OK) == 0) {
         if (access(sysmodmap, F_OK) == 0) {
             snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap);
-            launch_client(cmd);
+            X11ApplicationLaunchClient(cmd);
         }
     }
         
@@ -417,7 +417,7 @@ void DarwinKeyboardReloadHandler(void) {
         snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir);
         if (access(usermodmap, F_OK) == 0) {
             snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap);
-            launch_client(cmd);
+            X11ApplicationLaunchClient(cmd);
         }
     }
 }
commit ade4636c7e9cb8f9a0b03168f47d5383af9cbdaf
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Oct 27 18:00:48 2009 -0700

    dix: Properly detect if the other device is frozen
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>
    (cherry picked from commit 7897b6c2d41bccb72c19418674c3526ecce29515)

diff --git a/dix/events.c b/dix/events.c
index 1b40ba5..3e23262 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1673,7 +1673,7 @@ AllowSome(ClientPtr client,
     thisGrabbed = grabinfo->grab && SameClient(grabinfo->grab, client);
     thisSynced = FALSE;
     otherGrabbed = FALSE;
-    othersFrozen = TRUE;
+    othersFrozen = FALSE;
     grabTime = grabinfo->grabTime;
     for (dev = inputInfo.devices; dev; dev = dev->next)
     {
@@ -1689,11 +1689,9 @@ AllowSome(ClientPtr client,
 	    otherGrabbed = TRUE;
 	    if (grabinfo->sync.other == devgrabinfo->grab)
 		thisSynced = TRUE;
-	    if (devgrabinfo->sync.state < FROZEN)
-		othersFrozen = FALSE;
+	    if (devgrabinfo->sync.state >= FROZEN)
+		othersFrozen = TRUE;
 	}
-	else if (!devgrabinfo->sync.other || !SameClient(devgrabinfo->sync.other, client))
-	    othersFrozen = FALSE;
     }
     if (!((thisGrabbed && grabinfo->sync.state >= FROZEN) || thisSynced))
 	return;
commit ccbf949abb05111ad1ba3a359a621e9d7a1ffbf7
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Tue Nov 3 16:35:27 2009 -0800

    XQuartz: Run xmodmap after programatically updating the keymap.
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at freedesktop.org>
    Signed-off-by: Martin Otte <otte at duke.edu>
    (cherry picked from commit 5e79976c13c5b94b12392b493846ca26be11750b)

diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index f4fbb1a..2c95485 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -961,6 +961,12 @@ void X11ApplicationMain (int argc, char **argv, char **envp) {
     /* not reached */
 }
 
+void launch_client(const char *cmd) {
+    NSString *string = [[NSString alloc] initWithUTF8String:cmd];
+    [[X11App controller] launch_client:string];
+    [string release];
+}
+
 @implementation X11Application (Private)
 
 #ifdef NX_DEVICELCMDKEYMASK
diff --git a/hw/xquartz/X11Controller.h b/hw/xquartz/X11Controller.h
index a86b20f..3d8e007 100644
--- a/hw/xquartz/X11Controller.h
+++ b/hw/xquartz/X11Controller.h
@@ -144,5 +144,6 @@ typedef unsigned int NSUInteger;
 #endif /* __OBJC__ */
 
 void X11ControllerMain(int argc, char **argv, char **envp);
+void launch_client(const char *cmd);
 
 #endif /* X11CONTROLLER_H */
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index 06b981e..5bbb9c9 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -52,6 +52,8 @@
 #include "quartzKeyboard.h"
 #include "quartzAudio.h"
 
+#include "X11Application.h"
+
 #include "threadSafety.h"
 
 #ifdef NDEBUG
@@ -359,6 +361,10 @@ void DarwinKeyboardReloadHandler(void) {
     CFIndex initialKeyRepeatValue, keyRepeatValue;
     BOOL ok;
     DeviceIntPtr pDev = darwinKeyboard;
+    const char *xmodmap = PROJECTROOT "/bin/xmodmap";
+    const char *sysmodmap = PROJECTROOT "/lib/X11/xinit/.Xmodmap";
+    const char *homedir = getenv("HOME");
+    char usermodmap[PATH_MAX], cmd[PATH_MAX];
 
     DEBUG_LOG("DarwinKeyboardReloadHandler\n");
 
@@ -397,6 +403,23 @@ void DarwinKeyboardReloadHandler(void) {
             }
         }
     } pthread_mutex_unlock(&keyInfo_mutex);
+
+    /* Check for system .Xmodmap */
+    if (access(xmodmap, F_OK) == 0) {
+        if (access(sysmodmap, F_OK) == 0) {
+            snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, sysmodmap);
+            launch_client(cmd);
+        }
+    }
+        
+    /* Check for user's local .Xmodmap */
+    if (homedir != NULL) {
+        snprintf (usermodmap, sizeof(usermodmap), "%s/.Xmodmap", homedir);
+        if (access(usermodmap, F_OK) == 0) {
+            snprintf (cmd, sizeof(cmd), "%s %s", xmodmap, usermodmap);
+            launch_client(cmd);
+        }
+    }
 }
 
 //-----------------------------------------------------------------------------
commit 9e9ff04320ef9036b6746923188a4fbd83c44158
Author: Maarten Maathuis <madman2003 at gmail.com>
Date:   Sun Nov 1 22:08:40 2009 +0100

    exa: remove some outdated comment
    
    - This comment is still in exa_driver.c and there it makes sense.
    
    Signed-off-by: Maarten Maathuis <madman2003 at gmail.com>
    Acked-by: Michel Dänzer <michel at daenzer.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 412c56ef3332d09efbd861e41c3e985f44729729)

diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 167ffa9..ff02f27 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -154,10 +154,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
     if (pExaScr->info->ModifyPixmapHeader && pExaPixmap->driverPriv) {
 	ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
 						bitsPerPixel, devKind, pPixData);
-	/* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
-	 * If pPixmap->devPrivate.ptr is non-NULL, then we've got a non-offscreen pixmap.
-	 * We need to store the pointer, because PrepareAccess won't be called.
-	 */
 	if (ret == TRUE)
 	    goto out;
     }
commit 30572be7c795146bc4f6f2b8445feee30b5d6bfe
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Sep 21 10:23:16 2009 -0400

    EDID: Extend the HDTV hack to handle "1368x769"
    
    Hate televisions so much.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit ec98d7fc78efefcf9fc61492529157c0d289c3f2)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 93d9f66..45e28dc 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -498,8 +498,10 @@ DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
 	vsize = timing[i].vsize;
 	refresh = timing[i].refresh;
 
-	/* HDTV hack.  Hooray. */
-	if (hsize == 1360 && vsize == 765 && refresh == 60) {
+	/* HDTV hack, because you can't say 1366 */
+	if (refresh == 60 &&
+	    ((hsize == 1360 && vsize == 765) ||
+	     (hsize == 1368 && vsize == 769))) {
 	    Mode = xf86CVTMode(1366, 768, 60, FALSE, FALSE);
 	    Mode->HDisplay = 1366;
 	    Mode->VSyncStart--;
commit 9c87ede1d621bd7d69be81bdfdd2b18d47c68983
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Oct 28 15:44:37 2009 -0400

    modes: Fix duplicate detection, and do it more consistently
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 7c0803f555782dbf451b7c79112d7deae02e5c9f)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 506fbb9..9370640 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1377,34 +1377,6 @@ xf86InitialPanning (ScrnInfoPtr scrn)
     }
 }
 
-/*
- * XXX walk the monitor mode list and prune out duplicates that
- * are inserted by xf86DDCMonitorSet. In an ideal world, that
- * function would do this work by itself.
- */
-
-static void
-xf86PruneDuplicateMonitorModes (MonPtr Monitor)
-{
-    DisplayModePtr  master, clone, next;
-
-    for (master = Monitor->Modes; 
-	 master && master != Monitor->Last; 
-	 master = master->next)
-    {
-	for (clone = master->next; clone && clone != Monitor->Modes; clone = next)
-	{
-	    next = clone->next;
-	    if (xf86ModesEqual (master, clone))
-	    {
-		if (Monitor->Last == clone)
-		    Monitor->Last = clone->prev;
-		xf86DeleteMode (&Monitor->Modes, clone);
-	    }
-	}
-    }
-}
-
 /** Return - 0 + if a should be earlier, same or later than b in list
  */
 static int
@@ -1539,9 +1511,6 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY)
 	maxY = config->maxHeight;
     }
 
-    /* Elide duplicate modes before defaulting code uses them */
-    xf86PruneDuplicateMonitorModes (scrn->monitor);
-    
     /* Probe the list of modes for each output. */
     for (o = 0; o < config->num_output; o++) 
     {
diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 5992d95..93d9f66 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -975,6 +975,8 @@ xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC)
     if (quirks & DDC_QUIRK_PREFER_LARGE_75)
 	xf86DDCSetPreferredRefresh(scrnIndex, Modes, 75);
 
+    Modes = xf86PruneDuplicateModes(Modes);
+
     return Modes;
 }
 
diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c
index d105b48..862a473 100644
--- a/hw/xfree86/modes/xf86Modes.c
+++ b/hw/xfree86/modes/xf86Modes.c
@@ -689,3 +689,37 @@ xf86GetDefaultModes (void)
     }
     return head;
 }
+
+/*
+ * Walk a mode list and prune out duplicates.  Will preserve the preferred
+ * mode of an otherwise-duplicate pair.
+ *
+ * Probably best to call this on lists that are all of a single class
+ * (driver, default, user, etc.), otherwise, which mode gets deleted is
+ * not especially well defined.
+ *
+ * Returns the new list.
+ */
+
+DisplayModePtr
+xf86PruneDuplicateModes(DisplayModePtr modes)
+{
+    DisplayModePtr m, n, o;
+
+top:
+    for (m = modes; m; m = m->next) {
+	for (n = m->next; n; n = o) {
+	    o = n->next;
+	    if (xf86ModesEqual(m, n)) {
+		if (n->type & M_T_PREFERRED) {
+		    xf86DeleteMode(&modes, m);
+		    goto top;
+		}
+		else
+		    xf86DeleteMode(&modes, n);
+	    }
+	}
+    }
+
+    return modes;
+}
diff --git a/hw/xfree86/modes/xf86Modes.h b/hw/xfree86/modes/xf86Modes.h
index 908f59b..38927b1 100644
--- a/hw/xfree86/modes/xf86Modes.h
+++ b/hw/xfree86/modes/xf86Modes.h
@@ -95,6 +95,9 @@ extern _X_EXPORT void
 xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr *modeList,
 		      Bool verbose);
 
+extern _X_EXPORT DisplayModePtr
+xf86PruneDuplicateModes(DisplayModePtr modes);
+
 extern _X_EXPORT void
 xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
 		       int flags);
commit f61376b1365b558cf4d05e370cbea807ae168b27
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Oct 26 15:10:30 2009 -0400

    modes: De-duplicate a clock range check.
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit ba2d39dd5428cb5922b797a1d4ea45b859412b40)

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 0e43946..4a948d7 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -249,6 +249,15 @@ xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges)
     }
 }
 
+static Bool
+modeInClockRange(ClockRangePtr cp, DisplayModePtr p)
+{
+    return ((p->Clock >= cp->minClock) &&
+	    (p->Clock <= cp->maxClock) &&
+	    (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) &&
+	    (cp->doubleScanAllowed ||
+	     ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN))));
+}
 
 /*
  * xf86FindClockRangeForMode()    [... like the name says ...]
@@ -259,12 +268,7 @@ xf86FindClockRangeForMode(ClockRangePtr clockRanges, DisplayModePtr p)
     ClockRangePtr cp;
 
     for (cp = clockRanges; ; cp = cp->next)
-	if (!cp ||
-	    ((p->Clock >= cp->minClock) &&
-	     (p->Clock <= cp->maxClock) &&
-	     (cp->interlaceAllowed || !(p->Flags & V_INTERLACE)) &&
-	     (cp->doubleScanAllowed ||
-	      ((p->VScan <= 1) && !(p->Flags & V_DBLSCAN)))))
+	if (!cp || modeInClockRange(cp, p))
 	    return cp;
 }
 
@@ -979,11 +983,7 @@ xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
     if (scrp->progClock) {
 	/* Check clock is in range */
 	for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
-	    if ((cp->minClock <= mode->Clock) &&
-		(cp->maxClock >= mode->Clock) &&
-		(cp->interlaceAllowed || !(mode->Flags & V_INTERLACE)) &&
-		(cp->doubleScanAllowed ||
-		 ((!(mode->Flags & V_DBLSCAN)) && (mode->VScan <= 1))))
+	    if (modeInClockRange(cp, mode))
 	        break;
 	}
 	if (cp == NULL) {
@@ -999,12 +999,7 @@ xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
 	 status = MODE_CLOCK_RANGE;
 	/* Check clock is in range */
 	for (cp = scrp->clockRanges; cp != NULL; cp = cp->next) {
-	    if ((cp->minClock <= mode->Clock) &&
-		(cp->maxClock >= mode->Clock) &&
-		(cp->interlaceAllowed || !(mode->Flags & V_INTERLACE)) &&
-		(cp->doubleScanAllowed ||
-		 ((!(mode->Flags & V_DBLSCAN)) && (mode->VScan <= 1)))) {
-
+	    if (modeInClockRange(cp, mode)) {
 		/*
 	 	 * Clock is in range, so if it is not a programmable clock,
 		 * find a matching clock.
commit 263d2b05d6d8be15737a8d6c18071eb94d667b42
Author: Adam Jackson <ajax at redhat.com>
Date:   Mon Oct 26 14:49:57 2009 -0400

    EDID: Fix interlaced detailed timings to be frame size, not field size
    
    Signed-off-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 25236d19e6ef07fcb2c71569f1b7b0c12810834a)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 058e75d..5992d95 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -527,6 +527,45 @@ DDCModesFromStandardTiming(struct std_timings *timing, ddc_quirk_t quirks,
     return Modes;
 }
 
+static void
+DDCModeDoInterlaceQuirks(DisplayModePtr mode)
+{
+    /*
+     * EDID is delightfully ambiguous about how interlaced modes are to be
+     * encoded.  X's internal representation is of frame height, but some
+     * HDTV detailed timings are encoded as field height.
+     *
+     * The format list here is from CEA, in frame size.  Technically we
+     * should be checking refresh rate too.  Whatever.
+     */
+    static const struct {
+	int w, h;
+    } cea_interlaced[] = {
+	{ 1920, 1080 },
+	{  720,  480 },
+	{ 1440,  480 },
+	{ 2880,  480 },
+	{  720,  576 },
+	{ 1440,  576 },
+	{ 2880,  576 },
+    };
+    static const int n_modes = sizeof(cea_interlaced)/sizeof(cea_interlaced[0]);
+    int i;
+
+    for (i = 0; i < n_modes; i++) {
+	if ((mode->HDisplay == cea_interlaced[i].w) &&
+	    (mode->VDisplay == cea_interlaced[i].h / 2)) {
+	    mode->VDisplay *= 2;
+	    mode->VSyncStart *= 2;
+	    mode->VSyncEnd *= 2;
+	    mode->VTotal *= 2;
+	    mode->VTotal |= 1;
+	}
+    }
+
+    mode->Flags |= V_INTERLACE;
+}
+
 /*
  *
  */
@@ -596,7 +635,7 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
     /* We ignore h/v_size and h/v_border for now. */
 
     if (timing->interlaced)
-        Mode->Flags |= V_INTERLACE;
+	DDCModeDoInterlaceQuirks(Mode);
 
     if (quirks & DDC_QUIRK_DETAILED_SYNC_PP)
 	Mode->Flags |= V_PVSYNC | V_PHSYNC;
commit 4caa7982efd7b40c53d8b37e41ce9155e2dd1a56
Author: Jamey Sharp <jamey at minilop.net>
Date:   Wed Oct 28 17:48:19 2009 -0700

    Suppress certain GCC warnings in auto-generated code.
    
    - Don't warn for references to deprecated functions in xorg_symbols.
    - Ignore functions generated by gl_apitemp.py that are never used.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit fab74d1081270fb8f1d231e6e10d10aa33e164da)

diff --git a/glx/glapi.c b/glx/glapi.c
index fa3808e..d6a568e 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -114,10 +114,15 @@ warn(void)
    }
 }
 
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define possibly_unused __attribute((unused))
+#else
+#define possibly_unused
+#endif
 
 #define KEYWORD1 static
 #define KEYWORD1_ALT static
-#define KEYWORD2 GLAPIENTRY
+#define KEYWORD2 GLAPIENTRY possibly_unused
 #define NAME(func)  NoOp##func
 
 #define F NULL
diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index 1186547..eea0240 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -2,6 +2,7 @@
 
 cat > sdksyms.c << EOF
 /* This file is automatically generated by sdksyms.sh. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
commit 6ca6283bce5e0d272ec2b416f1ab230ec8719fdd
Author: Jamey Sharp <jamey at minilop.net>
Date:   Wed Oct 28 17:48:18 2009 -0700

    Don't cast double to int: use default conversions or explicitly round.
    
    GCC warns about casting a double return value to int.
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 239435875d6a92ed31731b500a992a3af0943594)

diff --git a/hw/xfree86/i2c/fi1236.c b/hw/xfree86/i2c/fi1236.c
index 110563e..7c39edb 100644
--- a/hw/xfree86/i2c/fi1236.c
+++ b/hw/xfree86/i2c/fi1236.c
@@ -225,7 +225,7 @@ m->f_ifbw=f_ifbw;
 m->f_step=f_step;
 
 m->f_lo1=f_rf+f_if1;
-m->LO1I=(int)floor((m->f_lo1/f_ref)+0.5);
+m->LO1I=lrint(m->f_lo1/f_ref);
 m->f_lo1=f_ref*m->LO1I;
 
 m->f_lo2=m->f_lo1-f_rf-f_if2;
@@ -258,10 +258,10 @@ if(m->f_lo1<1890.0)m->SEL=1;
 	m->SEL=0;
 
 /* calculate the rest of the registers */
-m->LO2I=(int)floor(m->f_lo2/f_ref);
-m->STEP=(int)floor(3780.0*f_step/f_ref);
-m->NUM=(int)floor(3780.0*(m->f_lo2/f_ref-m->LO2I));
-m->NUM=m->STEP*(int)floor((1.0*m->NUM)/(1.0*m->STEP)+0.5);
+m->LO2I=floor(m->f_lo2/f_ref);
+m->STEP=floor(3780.0*f_step/f_ref);
+m->NUM=floor(3780.0*(m->f_lo2/f_ref-m->LO2I));
+m->NUM=m->STEP*lrint((1.0*m->NUM)/(1.0*m->STEP));
 }
 
 static int MT2032_wait_for_lock(FI1236Ptr f)
diff --git a/hw/xfree86/parser/Flags.c b/hw/xfree86/parser/Flags.c
index 6865d35..699f15c 100644
--- a/hw/xfree86/parser/Flags.c
+++ b/hw/xfree86/parser/Flags.c
@@ -434,7 +434,7 @@ xf86uLongToString(unsigned long i)
 	char *s;
 	int l;
 
-	l = (int)(ceil(log10((double)i) + 2.5));
+	l = ceil(log10((double)i) + 2.5);
 	s = malloc(l);
 	if (!s)
 		return NULL;
commit ebbac195508c9941a9349f48867aff1b0dd827b1
Author: Jamey Sharp <jamey at minilop.net>
Date:   Wed Oct 28 17:48:17 2009 -0700

    Suppress GCC warnings like "the address of `u1' will always evaluate as `true'".
    
    Signed-off-by: Jamey Sharp <jamey at minilop.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit e8c48fd8f7aab54327b0091cd17c60235ae27168)

diff --git a/glx/unpack.h b/glx/unpack.h
index a1dd17d..90cb71b 100644
--- a/glx/unpack.h
+++ b/glx/unpack.h
@@ -47,7 +47,7 @@
 ** Fetch a double from potentially unaligned memory.
 */
 #ifdef __GLX_ALIGN64
-#define __GLX_MEM_COPY(dst,src,n)	if (src && dst) memcpy(dst,src,n)
+#define __GLX_MEM_COPY(dst,src,n)	if (src != NULL && dst != NULL) memcpy(dst,src,n)
 #define __GLX_GET_DOUBLE(dst,src)	__GLX_MEM_COPY(&dst,src,8)
 #else
 #define __GLX_GET_DOUBLE(dst,src)	(dst) = *((GLdouble*)(src))
commit 171dc59ec52cda3d73bbb3ed8091904c124011bb
Author: Mikhail Gusarov <dottedmag at dottedmag.net>
Date:   Thu Oct 29 00:40:48 2009 +0600

    kdrive: Grab evdev mouse/keyboard devices when X server is active
    
    Input events are directed to both vt and input devices by default.
    Unless input devices are grabbed, keyboard events fill it vt buffers
    and cause spontaneous wakeups in kernel tty layer when buffers are full.
    
    Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 662594aeff9d1767316f08600949c73ac5060d18)

diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index f6017ba..096a2dd 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -243,7 +243,9 @@ EvdevPtrEnable (KdPointerInfo *pi)
     if (fd < 0)
         return BadMatch;
 
-        
+    if (ioctl (fd, EVIOCGRAB, 1) < 0)
+        perror ("Grabbing evdev mouse device failed");
+
     if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
     {
         perror ("EVIOCGBIT 0");
@@ -335,6 +337,10 @@ EvdevPtrDisable (KdPointerInfo *pi)
         return;
 
     KdUnregisterFd (pi, ke->fd, TRUE);
+
+    if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
+        perror ("Ungrabbing evdev mouse device failed");
+
     xfree (ke);
     pi->driverPrivate = 0;
 }
@@ -425,6 +431,9 @@ EvdevKbdEnable (KdKeyboardInfo *ki)
     if (fd < 0)
         return BadMatch;
 
+    if (ioctl (fd, EVIOCGRAB, 1) < 0)
+        perror ("Grabbing evdev keyboard device failed");
+
     if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0) {
         perror ("EVIOCGBIT 0");
         close (fd);
@@ -496,6 +505,10 @@ EvdevKbdDisable (KdKeyboardInfo *ki)
         return;
 
     KdUnregisterFd (ki, ke->fd, TRUE);
+
+    if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
+        perror ("Ungrabbing evdev keyboard device failed");
+
     xfree (ke);
     ki->driverPrivate = 0;
 }
commit 9ed5acec417f683102c0f52138a5d52131604c3c
Author: Tormod Volden <lists.tormod at gmail.com>
Date:   Wed Oct 28 23:10:43 2009 +0100

    xfree86: Fix description of DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE
    
    The message ending up in the log is misleading as to what the quirk
    actually does: It ignores the sizes in the detailed timings and
    replaces them with the display "Max Image Size".
    
    Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 757c11630d5999ad13dcac79191429badc92a3a6)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 2f80070..058e75d 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -266,7 +266,7 @@ static const ddc_quirk_map_t ddc_quirks[] = {
     },
     {
 	quirk_detailed_use_maximum_size,   DDC_QUIRK_DETAILED_USE_MAXIMUM_SIZE,
-	"Detailed timings give sizes in cm."
+	"Use maximum size instead of detailed timing sizes."
     },
     {
 	quirk_first_detailed_preferred, DDC_QUIRK_FIRST_DETAILED_PREFERRED,
commit 9db4c77956d3d1598955e777ce6607fe7901a395
Author: Hans Nieser <hnsr at xs4all.nl>
Date:   Wed Oct 28 06:59:40 2009 +0100

    Xinput: allow non-integer values again for Constant- and AdaptiveDeceleration
    
    This was initially fixed by commit 3932a848572f4eaf8b7f1d91d9b74aeafab069a2
    but then (presumably not intentionally) undone by commit
    1d54479cb3c8b4f75b7564f8b5e1c5da940b20f4 .
    
    Signed-off-by: Hans Nieser <hnsr at xs4all.nl>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 55f4c80a4c891b355a99e6a05978ca945397c5cc)

diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c
index 6887f55..f637cfe 100644
--- a/hw/xfree86/common/xf86Xinput.c
+++ b/hw/xfree86/common/xf86Xinput.c
@@ -113,7 +113,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
         return;
 
     /* common settings (available via device properties) */
-    tempf = xf86SetIntOption(list, "ConstantDeceleration", 1);
+    tempf = xf86SetRealOption(list, "ConstantDeceleration", 1.0);
     if(tempf > 1.0){
         xf86Msg(X_CONFIG, "%s: (accel) constant deceleration by %.1f\n",
                 devname, tempf);
@@ -122,7 +122,7 @@ ProcessVelocityConfiguration(DeviceIntPtr pDev, char* devname, pointer list,
                                PropModeReplace, 1, &tempf, FALSE);
     }
 
-    tempf = xf86SetIntOption(list, "AdaptiveDeceleration", 1);
+    tempf = xf86SetRealOption(list, "AdaptiveDeceleration", 1.0);
     if(tempf > 1.0){
         xf86Msg(X_CONFIG, "%s: (accel) adaptive deceleration by %.1f\n",
                 devname, tempf);
commit 6e2f5912b6ab54a5d78c7dfddc558e0bed08e270
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Fri Oct 23 19:32:42 2009 +0100

    dmx: Correctly compute DMXGetScreenAttributes reply length
    
    Correctly allow for excess length of DMXGetScreenAttributes reply
    over standard 32 byte reply in addition to the displayName string
    when computing the length of reply
    
    http://bugs.freedesktop.org/show_bug.cgi?id=24685
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
    Reviewed-by:  Julien Cristau <jcristau at debian.org>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 50a5c32430a5267f2a05656d2417f9a8a44d8b97)

diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c
index 1a0c3fe..9f02855 100644
--- a/hw/dmx/dmx.c
+++ b/hw/dmx/dmx.c
@@ -362,7 +362,8 @@ static int ProcDMXGetScreenAttributes(ClientPtr client)
     paddedLength            = pad_to_int32(length);
     rep.type                = X_Reply;
     rep.sequenceNumber      = client->sequence;
-    rep.length              = bytes_to_int32(paddedLength);
+    rep.length              = bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) - sizeof(xGenericReply))
+                                             + paddedLength);
     rep.displayNameLength   = length;
 
     if (client->swapped) {


More information about the Xquartz-changes mailing list