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

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Thu Oct 1 13:44:23 PDT 2009


 configure.ac                  |    2 
 hw/xquartz/Makefile.am        |    2 
 hw/xquartz/darwinEvents.c     |    2 
 hw/xquartz/darwinEvents.h     |    2 
 hw/xquartz/quartz.h           |    2 
 hw/xquartz/quartzCocoa.m      |   57 ---------------
 hw/xquartz/quartzKeyboard.c   |   48 +++++++++++--
 hw/xquartz/quartzPasteboard.c |  155 ------------------------------------------
 hw/xquartz/quartzPasteboard.h |   44 -----------
 include/inputstr.h            |    2 
 10 files changed, 44 insertions(+), 272 deletions(-)

New commits:
commit 9af39f090ab4a6bde225d3dd7a954ba866751b5b
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Oct 1 13:36:06 2009 -0700

    1.4.2-apple49

diff --git a/configure.ac b/configure.ac
index ef37183..b9221f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ dnl
 dnl Process this file with autoconf to create configure.
 
 AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.4.2-apple48, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+AC_INIT([xorg-server], 1.4.2-apple49, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
 AC_CONFIG_SRCDIR([Makefile.am])
 AM_INIT_AUTOMAKE([dist-bzip2 foreign])
 AM_MAINTAINER_MODE
commit 246fcc7bbbeec76c8700c2d966405ed046280377
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Thu Oct 1 13:34:28 2009 -0700

    XQuartz: Dead code removal: quartzPasteboard.[hc]
    (cherry picked from commit 9936b5b188dd85f169c41ef8ec46c9a210528c3f)

diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am
index ae8aa7f..65c70b0 100644
--- a/hw/xquartz/Makefile.am
+++ b/hw/xquartz/Makefile.am
@@ -33,7 +33,6 @@ libXquartz_la_SOURCES = \
 	quartzAudio.c \
 	quartzCocoa.m \
 	quartzKeyboard.c \
-	quartzPasteboard.c \
 	quartzStartup.c \
 	threadSafety.c
 
@@ -50,7 +49,6 @@ EXTRA_DIST = \
 	quartzAudio.h \
 	quartzCommon.h \
 	quartzKeyboard.h \
-	quartzPasteboard.h \
 	sanitizedCarbon.h \
 	sanitizedCocoa.h \
 	threadSafety.h
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 67d38cf..e03454a 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -332,8 +332,6 @@ Bool DarwinEQInit(void) {
     mieqSetHandler(kXquartzReloadPreferences, DarwinEventHandler);
     mieqSetHandler(kXquartzSetRootClip, DarwinEventHandler);
     mieqSetHandler(kXquartzQuit, DarwinEventHandler);
-    mieqSetHandler(kXquartzReadPasteboard, QuartzReadPasteboard);
-    mieqSetHandler(kXquartzWritePasteboard, QuartzWritePasteboard);
     mieqSetHandler(kXquartzToggleFullscreen, DarwinEventHandler);
     mieqSetHandler(kXquartzSetRootless, DarwinEventHandler);
     mieqSetHandler(kXquartzSpaceChanged, DarwinEventHandler);
diff --git a/hw/xquartz/darwinEvents.h b/hw/xquartz/darwinEvents.h
index 1268514..e1585fe 100644
--- a/hw/xquartz/darwinEvents.h
+++ b/hw/xquartz/darwinEvents.h
@@ -54,8 +54,6 @@ enum {
     kXquartzDeactivate,       // clip X drawing and switch to Aqua cursor
     kXquartzSetRootClip,      // enable or disable drawing to the X screen
     kXquartzQuit,             // kill the X server and release the display
-    kXquartzReadPasteboard,   // copy Mac OS X pasteboard into X cut buffer
-    kXquartzWritePasteboard,  // copy X cut buffer onto Mac OS X pasteboard
     kXquartzBringAllToFront,  // bring all X windows to front
     kXquartzToggleFullscreen, // Enable/Disable fullscreen mode
     kXquartzSetRootless,      // Set rootless mode
diff --git a/hw/xquartz/quartz.h b/hw/xquartz/quartz.h
index 2570551..c1169b1 100644
--- a/hw/xquartz/quartz.h
+++ b/hw/xquartz/quartz.h
@@ -33,8 +33,6 @@
 #ifndef _QUARTZ_H
 #define _QUARTZ_H
 
-#include "quartzPasteboard.h"
-
 #include "screenint.h"
 #include "window.h"
 
diff --git a/hw/xquartz/quartzCocoa.m b/hw/xquartz/quartzCocoa.m
index 0ab9493..4501472 100644
--- a/hw/xquartz/quartzCocoa.m
+++ b/hw/xquartz/quartzCocoa.m
@@ -40,67 +40,10 @@
 
 #include "quartzCommon.h"
 #include "inputstr.h"
-#include "quartzPasteboard.h"
 
 #include "darwin.h"
 
 /*
- * QuartzWriteCocoaPasteboard
- *  Write text to the Mac OS X pasteboard.
- */
-void QuartzWriteCocoaPasteboard(
-    char *text)
-{
-    NSPasteboard *pasteboard;
-    NSArray *pasteboardTypes;
-    NSString *string;
-
-    if (! text) return;
-    pasteboard = [NSPasteboard generalPasteboard];
-    if (! pasteboard) return;
-    string = [NSString stringWithCString:text];
-    if (! string) return;
-    pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
-
-    // nil owner because we don't provide type translations
-    [pasteboard declareTypes:pasteboardTypes owner:nil];
-    [pasteboard setString:string forType:NSStringPboardType];
-}
-
-
-/*
- * QuartzReadCocoaPasteboard
- *  Read text from the Mac OS X pasteboard and return it as a heap string.
- *  The caller must free the string.
- */
-char *QuartzReadCocoaPasteboard(void)
-{
-    NSPasteboard *pasteboard;
-    NSArray *pasteboardTypes;
-    NSString *existingType;
-    char *text = NULL;
-
-    pasteboardTypes = [NSArray arrayWithObject:NSStringPboardType];
-    pasteboard = [NSPasteboard generalPasteboard];
-    if (! pasteboard) return NULL;
-
-    existingType = [pasteboard availableTypeFromArray:pasteboardTypes];
-    if (existingType) {
-        NSString *string = [pasteboard stringForType:existingType];
-        char *buffer;
-
-        if (! string) return NULL;
-        buffer = (char *) [string UTF8String];
-        text = (char *) malloc(strlen(buffer)+1);
-        if (text)
-            strcpy(text, buffer);
-    }
-
-    return text;
-}
-
-
-/*
  * QuartzFSUseQDCursor
  *  Return whether the screen should use a QuickDraw cursor.
  */
diff --git a/hw/xquartz/quartzPasteboard.c b/hw/xquartz/quartzPasteboard.c
deleted file mode 100644
index 3833572..0000000
--- a/hw/xquartz/quartzPasteboard.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/**************************************************************
- * quartzPasteboard.c
- *
- * Aqua pasteboard <-> X cut buffer
- * Greg Parker     gparker at cs.stanford.edu     March 8, 2001
- **************************************************************/
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * 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.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "misc.h"
-#include "inputstr.h"
-#include "quartzPasteboard.h"
-
-#include <X11/Xatom.h>
-#include "windowstr.h"
-#include "propertyst.h"
-#include "scrnintstr.h"
-#include "selection.h"
-#include "globals.h"
-
-extern Selection *CurrentSelections;
-extern int NumCurrentSelections;
-
-
-// Helper function to read the X11 cut buffer
-// FIXME: What about multiple screens? Currently, this reads the first
-// CUT_BUFFER0 from the first screen where the buffer content is a string.
-// Returns a string on the heap that the caller must free.
-// Returns NULL if there is no cut text or there is not enough memory.
-static char * QuartzReadCutBuffer(void)
-{
-    int i;
-    char *text = NULL;
-
-    for (i = 0; i < screenInfo.numScreens; i++) {
-        ScreenPtr pScreen = screenInfo.screens[i];
-        PropertyPtr pProp;
-
-        pProp = wUserProps (WindowTable[pScreen->myNum]);
-        while (pProp && pProp->propertyName != XA_CUT_BUFFER0) {
-	    pProp = pProp->next;
-        }
-        if (! pProp) continue;
-        if (pProp->type != XA_STRING) continue;
-        if (pProp->format != 8) continue;
-
-        text = xalloc(1 + pProp->size);
-        if (! text) continue;
-        memcpy(text, pProp->data, pProp->size);
-        text[pProp->size] = '\0';
-        return text;
-    }
-
-    // didn't find any text
-    return NULL;
-}
-
-// Write X cut buffer to Mac OS X pasteboard
-// Called by mieqProcessInputEvents() in response to request from X server thread.
-void QuartzWritePasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
-{
-    char *text;
-    text = QuartzReadCutBuffer();
-    if (text) {
-        QuartzWriteCocoaPasteboard(text);
-        free(text);
-    }
-}
-
-#define strequal(a, b) (0 == strcmp((a), (b)))
-
-// Read Mac OS X pasteboard into X cut buffer
-// Called by mieqProcessInputEvents() in response to request from X server thread.
-void QuartzReadPasteboard(int screenNum, xEventPtr xe, DeviceIntPtr dev, int nevents)
-{
-    char *oldText = QuartzReadCutBuffer();
-    char *text = QuartzReadCocoaPasteboard();
-
-    // Compare text with current cut buffer contents.
-    // Change the buffer if both exist and are different
-    //   OR if there is new text but no old text.
-    // Otherwise, don't clear the selection unnecessarily.
-
-    if ((text && oldText && !strequal(text, oldText)) ||
-        (text && !oldText)) {
-        int scrn, sel;
-
-        for (scrn = 0; scrn < screenInfo.numScreens; scrn++) {
-	    ScreenPtr pScreen = screenInfo.screens[scrn];
-	    // Set the cut buffers on each screen
-	    // fixme really on each screen?
-	    ChangeWindowProperty(WindowTable[pScreen->myNum], XA_CUT_BUFFER0,
-				 XA_STRING, 8, PropModeReplace,
-				 strlen(text), (pointer)text, TRUE);
-        }
-
-        // Undo any current X selection (similar to code in dispatch.c)
-        // FIXME: what about secondary selection?
-        // FIXME: only touch first XA_PRIMARY selection?
-        sel = 0;
-        while ((sel < NumCurrentSelections)  &&
-	       CurrentSelections[sel].selection != XA_PRIMARY)
-	    sel++;
-        if (sel < NumCurrentSelections) {
-	    // Notify client if necessary
-	    if (CurrentSelections[sel].client) {
-	        xEvent event;
-
-	        event.u.u.type = SelectionClear;
-		event.u.selectionClear.time = GetTimeInMillis();
-		event.u.selectionClear.window = CurrentSelections[sel].window;
-		event.u.selectionClear.atom = CurrentSelections[sel].selection;
-		TryClientEvents(CurrentSelections[sel].client, &event, 1,
-				NoEventMask, NoEventMask /*CantBeFiltered*/,
-				NullGrab);
-	    }
-
-	    // Erase it
-	    // FIXME: need to erase .selection too? dispatch.c doesn't
-	    CurrentSelections[sel].pWin = NullWindow;
-	    CurrentSelections[sel].window = None;
-	    CurrentSelections[sel].client = NullClient;
-        }
-    }
-
-    if (text) free(text);
-    if (oldText) free(oldText);
-}
diff --git a/hw/xquartz/quartzPasteboard.h b/hw/xquartz/quartzPasteboard.h
deleted file mode 100644
index b51cd88..0000000
--- a/hw/xquartz/quartzPasteboard.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 
-   QuartzPasteboard.h
-
-   Mac OS X pasteboard <-> X cut buffer
-   Greg Parker     gparker at cs.stanford.edu     March 8, 2001
-*/
-/*
- * Copyright (c) 2001 Greg Parker. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * 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.
- */
-
-#ifndef _QUARTZPASTEBOARD_H
-#define _QUARTZPASTEBOARD_H
-
-// Aqua->X 
-void QuartzReadPasteboard(int, xEventPtr, DeviceIntPtr, int);
-char * QuartzReadCocoaPasteboard(void);	// caller must free string
-
-// X->Aqua
-void QuartzWritePasteboard(int, xEventPtr, DeviceIntPtr, int);
-void QuartzWriteCocoaPasteboard(char *text);
-
-#endif	/* _QUARTZPASTEBOARD_H */
commit 2a4a79a225200a4514d641136d70799a06da6144
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Wed Sep 30 00:22:02 2009 -0700

    XQuartz: Set the proper bitmap for key repeats...
    
    XkbSetRepeatKeys lies and doesn't do what it says it will...
    (cherry picked from commit 873467adad479be02cd9cc6b43685919f5612d91)

diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index d54782b..d284b93 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -317,19 +317,53 @@ void DarwinKeyboardInit(DeviceIntPtr pDev) {
 /* Set the repeat rates based on global preferences and keycodes for modifiers.
  * Precondition: Has the keyInfo_mutex lock.
  */
-static void DarwinKeyboardSetRepeat(DeviceIntPtr pDev, CFIndex initialKeyRepeatValue, CFIndex keyRepeatValue) {
+static void DarwinKeyboardSetRepeat(DeviceIntPtr pDev, int initialKeyRepeatValue, int keyRepeatValue) {
     if(initialKeyRepeatValue == 300000) { // off
+        /* Turn off repeats globally */
         XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOff);
     } else {
-        pDev->key->xkbInfo->desc->ctrls->repeat_delay = initialKeyRepeatValue * 15;
-        pDev->key->xkbInfo->desc->ctrls->repeat_interval = keyRepeatValue * 15;
+        int i;
+        XkbControlsPtr      ctrl;
+        XkbControlsRec      old;
 
+        /* Turn on repeats globally */
         XkbSetRepeatKeys(pDev, -1, AutoRepeatModeOn);
+        
+        /* Setup the bit mask for individual key repeats */
+        ctrl = pDev->key->xkbInfo->desc->ctrls;
+        old= *ctrl;
+        
+        ctrl->repeat_delay = initialKeyRepeatValue * 15;
+        ctrl->repeat_interval = keyRepeatValue * 15;
+
+        /* Turn off key-repeat for modifier keys, on for others */
+        /* First set them all on */
+        for(i=0; i < XkbPerKeyBitArraySize; i++)
+            ctrl->per_key_repeat[i] = -1;
+
+        /* Now turn off the modifiers */
+        for(i=0; i < 32; i++) {
+            unsigned char keycode;
+            
+            keycode = keyInfo.modifierKeycodes[i][0];
+            if(keycode)
+                ClearBit(ctrl->per_key_repeat, keycode + MIN_KEYCODE);
+
+            keycode = keyInfo.modifierKeycodes[i][1];
+            if(keycode)
+                ClearBit(ctrl->per_key_repeat, keycode + MIN_KEYCODE);
+        }
+
+        /* Hurray for data duplication */
+        if (pDev->kbdfeed)
+            memcpy(pDev->kbdfeed->ctrl.autoRepeats, ctrl->per_key_repeat, XkbPerKeyBitArraySize);
+
+        //fprintf(stderr, "per_key_repeat =\n");
+        //for(i=0; i < XkbPerKeyBitArraySize; i++)
+        //    fprintf(stderr, "%02x%s", ctrl->per_key_repeat[i], (i + 1) & 7 ? "" : "\n");
 
-        /* TODO: Turn off key-repeat for modifier keys, on for others */
-        // Test: Shouldn't this turn off all the key repeats???
-        //for(i=MIN_KEYCODE; i <= MAX_KEYCODE; i++)
-        //    XkbSetRepeatKeys(pDev, i, AutoRepeatModeOff);
+        /* And now we notify the puppies about the changes */
+        XkbDDXChangeControls(pDev, &old, ctrl);
     }
 }
 
commit ba21bbf5504dae103471d569151d862f21e9a15b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Dec 12 10:49:53 2008 +1000

    dix: add SetBit(arr, bit) and ClearBit(arr, bit) to include/inputstr.h
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 5e0967f5fc2e0fcf2a55128eb03931cf6f5709e9)

diff --git a/include/inputstr.h b/include/inputstr.h
index d0cc858..df5eb45 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -54,6 +54,8 @@ SOFTWARE.
 #include "dixstruct.h"
 
 #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
+#define SetBit(ptr, bit)  (((BYTE *) (ptr))[(bit)>>3] |= (1 << ((bit) & 7)))
+#define ClearBit(ptr, bit) (((BYTE *)(ptr))[(bit)>>3] &= ~(1 << ((bit) & 7)))
 
 #define SameClient(obj,client) \
 	(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)


More information about the xorg-commit mailing list