xserver: Branch 'master' - 2 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Fri Oct 31 19:05:55 PDT 2008


 hw/xquartz/GL/indirect.c        |   14 +++++-----
 hw/xquartz/X11Application.m     |    6 ++++
 hw/xquartz/quartzAudio.c        |    8 ++---
 hw/xquartz/quartzKeyboard.c     |   16 +++++++++--
 hw/xquartz/xpr/appledri.c       |    6 ++--
 hw/xquartz/xpr/dri.c            |   10 +++----
 hw/xquartz/xpr/x-hash.c         |   12 ++++----
 hw/xquartz/xpr/x-hash.h         |   31 ++++++++++++++++++++++
 hw/xquartz/xpr/xprAppleWM.c     |    7 ++---
 hw/xquartz/xpr/xprCursor.c      |    1 
 hw/xquartz/xpr/xprFrame.c       |   54 ++++++++++++++++++++++++++++------------
 miext/rootless/rootlessCommon.h |    2 -
 miext/rootless/rootlessWindow.c |    8 +++--
 13 files changed, 125 insertions(+), 50 deletions(-)

New commits:
commit c5086badf0387d4d5af10882de90a1faa180550f
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Oct 31 18:58:57 2008 -0700

    XQuartz: LP64 related casting fixes from Bob Murphy
    (cherry picked from commit ea71710aaa7166ab510abe70f2dc47942de0ead7)

diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 94ce10c..2a15a81 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -230,9 +230,9 @@ static void __glXAquaContextDestroy(__GLXcontext *baseContext) {
                      (unsigned int) baseContext);
     if (context != NULL) {
       if (context->sid != 0 && surface_hash != NULL) {
-		lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+		lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL);
 		lst = x_list_remove(lst, context);
-		x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+		x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst);
       }
 
       if (context->ctx != NULL) CGLDestroyContext(context->ctx);
@@ -273,14 +273,14 @@ static void surface_notify(void *_arg, void *data) {
     switch (arg->kind) {
     case AppleDRISurfaceNotifyDestroyed:
         if (surface_hash != NULL)
-            x_hash_table_remove(surface_hash, (void *) arg->id);
+            x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(arg->id));
 	        draw->base.pDraw = NULL;
 			draw->sid = 0;
         break;
 
     case AppleDRISurfaceNotifyChanged:
         if (surface_hash != NULL) {
-            lst = x_hash_table_lookup(surface_hash, (void *) arg->id, NULL);
+            lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(arg->id), NULL);
             for (; lst != NULL; lst = lst->next)
             {
                 context = lst->data;
@@ -316,7 +316,7 @@ static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
             DRIDestroySurface(pDraw->pScreen, pDraw->id, pDraw,
 								surface_notify, draw);
             if (surface_hash != NULL)
-                x_hash_table_remove(surface_hash, (void *) draw->sid);
+                x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(draw->sid));
 
             draw->sid = 0;
             return;
@@ -328,10 +328,10 @@ static void attach(__GLXAquaContext *context, __GLXAquaDrawable *draw) {
         if (surface_hash == NULL)
             surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
 
-        lst = x_hash_table_lookup(surface_hash, (void *) context->sid, NULL);
+        lst = x_hash_table_lookup(surface_hash, x_cvt_uint_to_vptr(context->sid), NULL);
         if (x_list_find(lst, context) == NULL) {
             lst = x_list_prepend(lst, context);
-            x_hash_table_insert(surface_hash, (void *) context->sid, lst);
+            x_hash_table_insert(surface_hash, x_cvt_uint_to_vptr(context->sid), lst);
         }
 
         GLAQUA_DEBUG_MSG("attached 0x%x to 0x%x\n", (unsigned int) pDraw->id,
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
index cd77b63..e6a6117 100644
--- a/hw/xquartz/X11Application.m
+++ b/hw/xquartz/X11Application.m
@@ -353,8 +353,14 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
 }
 
 - (void) show_hide_menubar:(NSNumber *)state {
+#if defined(__LP64__)
+	/* Also shows/hides the dock */
+	if ([state boolValue]) SetSystemUIMode(kUIModeNormal, 0);
+	else SetSystemUIMode(kUIModeAllHidden, 0);
+#else
 	if ([state boolValue]) ShowMenuBar ();
 	else HideMenuBar ();
+#endif
 }
 
 
diff --git a/hw/xquartz/quartzAudio.c b/hw/xquartz/quartzAudio.c
index d3698d7..2e8f3a4 100644
--- a/hw/xquartz/quartzAudio.c
+++ b/hw/xquartz/quartzAudio.c
@@ -238,7 +238,7 @@ static void QuartzCoreAudioBell(
         OSStatus status;
         status = AudioDeviceStart(quartzAudioDevice, QuartzAudioIOProc);
         if (status) {
-            ErrorF("QuartzAudioBell: AudioDeviceStart returned %ld\n", status);
+            ErrorF("QuartzAudioBell: AudioDeviceStart returned %ld\n", (long)status);
         } else {
             data.playing = TRUE;
         }
@@ -299,7 +299,7 @@ void QuartzAudioInit(void)
                     &propertySize, &outputDevice);
     if (status) {
         ErrorF("QuartzAudioInit: AudioHardwareGetProperty returned %ld\n",
-               status);
+               (long)status);
         return;
     }
     if (outputDevice == kAudioDeviceUnknown) {
@@ -314,7 +314,7 @@ void QuartzAudioInit(void)
                                     &propertySize, &outputStreamDescription);
     if (status) {
         ErrorF("QuartzAudioInit: GetProperty(stream format) returned %ld\n",
-               status);
+               (long)status);
         return;
     }
     sampleRate = outputStreamDescription.mSampleRate;
@@ -339,7 +339,7 @@ void QuartzAudioInit(void)
     // Prepare for playback
     status = AudioDeviceAddIOProc(outputDevice, QuartzAudioIOProc, &data);
     if (status) {
-        ErrorF("QuartzAudioInit: AddIOProc returned %ld\n", status);
+        ErrorF("QuartzAudioInit: AddIOProc returned %ld\n", (long)status);
         return;
     }
 
diff --git a/hw/xquartz/quartzKeyboard.c b/hw/xquartz/quartzKeyboard.c
index eb57546..b462c77 100644
--- a/hw/xquartz/quartzKeyboard.c
+++ b/hw/xquartz/quartzKeyboard.c
@@ -701,13 +701,16 @@ static KeySym make_dead_key(KeySym in) {
 }
 
 Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
-#if !defined(__x86_64__) && !defined(__ppc64__)
+#if !defined(__LP64__)
     KeyboardLayoutRef key_layout;
 #endif
     const void *chr_data = NULL;
     int num_keycodes = NUM_KEYCODES;
     UInt32 keyboard_type = 0;
-    int is_uchr = 1, i, j;
+#if !defined(__LP64__)
+    int is_uchr = 1;
+#endif
+    int i, j;
     OSStatus err;
     KeySym *k;
     CFDataRef currentKeyLayoutDataRef = NULL;
@@ -721,7 +724,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
           chr_data = CFDataGetBytePtr(currentKeyLayoutDataRef);
     }
 
-#if !defined(__x86_64__) && !defined(__ppc64__)
+#if !defined(__LP64__)
     if (chr_data == NULL) {
         ErrorF("X11.app: Error detected in determining keyboard layout.  If you are using an Apple-provided keyboard layout, please report this error at http://xquartz.macosforge.org and http://bugreport.apple.com\n");
         ErrorF("X11.app: Debug Info: keyboard_type=%u, currentKeyLayoutRef=%p, currentKeyLayoutDataRef=%p, chr_data=%p\n",
@@ -757,6 +760,9 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
        key produces in the four shift states. Then convert that to
        an X11 keysym (which may just the bit that says "this is
        Unicode" if it can't find the real symbol.) */
+       
+    /* KeyTranslate is not available on 64-bit platforms; UCKeyTranslate
+       must be used instead. */
 
     for (i = 0; i < num_keycodes; i++) {
         static const int mods[4] = {0, MOD_SHIFT, MOD_OPTION,
@@ -765,7 +771,9 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
         k = info->keyMap + i * GLYPHS_PER_KEY;
 
         for (j = 0; j < 4; j++) {
+#if !defined(__LP64__)
             if (is_uchr)  {
+#endif
                 UniChar s[8];
                 UniCharCount len;
                 UInt32 dead_key_state = 0, extra_dead = 0;
@@ -789,6 +797,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
                     k[j] = ucs2keysym (s[0]);
                     if (dead_key_state != 0) k[j] = make_dead_key (k[j]);
                 }
+#if !defined(__LP64__)
             } else { // kchr
 	      UInt32 c, state = 0, state2 = 0;
                 UInt16 code;
@@ -812,6 +821,7 @@ Bool QuartzReadSystemKeymap(darwinKeyboardInfo *info) {
                     if (state != 0) k[j] = make_dead_key (k[j]);
                 }
             }
+#endif
         }
 	
         if (k[3] == k[2]) k[3] = NoSymbol;
diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c
index b4a4725..3667c0d 100644
--- a/hw/xquartz/xpr/appledri.c
+++ b/hw/xquartz/xpr/appledri.c
@@ -56,6 +56,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dri.h"
 #include "dristruct.h"
 #include "xpr.h"
+#include "x-hash.h"
 
 static int DRIErrorBase = 0;
 
@@ -190,7 +191,7 @@ static void surface_notify(
 )
 {
     DRISurfaceNotifyArg *arg = _arg;
-    int client_index = (int) data;
+    int client_index = (int) x_cvt_vptr_to_uint(data);
     ClientPtr client;
     xAppleDRINotifyEvent se;
 
@@ -236,7 +237,8 @@ ProcAppleDRICreateSurface(
     if (!DRICreateSurface( screenInfo.screens[stuff->screen],
                            (Drawable)stuff->drawable, pDrawable,
                            stuff->client_id, &sid, key,
-                           surface_notify, (void *) client->index)) {
+                           surface_notify,
+                           x_cvt_uint_to_vptr(client->index))) {
         return BadValue;
     }
 
diff --git a/hw/xquartz/xpr/dri.c b/hw/xquartz/xpr/dri.c
index 5b79419..8feba7e 100644
--- a/hw/xquartz/xpr/dri.c
+++ b/hw/xquartz/xpr/dri.c
@@ -376,7 +376,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
             pDRIDrawablePriv->notifiers = NULL;
 
             /* find the physical window */
-            wid = (xp_window_id) RootlessFrameForWindow(pWin, TRUE);
+            wid = x_cvt_vptr_to_uint(RootlessFrameForWindow(pWin, TRUE));
             if (wid == 0) {
                 xfree(pDRIDrawablePriv);
                 return FALSE;
@@ -472,7 +472,7 @@ DRICreateSurface(ScreenPtr pScreen, Drawable id,
         if (surface_hash == NULL)
             surface_hash = x_hash_table_new(NULL, NULL, NULL, NULL);
         x_hash_table_insert(surface_hash,
-                            (void *) pDRIDrawablePriv->sid, pDRIDrawablePriv);
+                            x_cvt_uint_to_vptr(pDRIDrawablePriv->sid), pDRIDrawablePriv);
 
         /* track this in case this window is destroyed */
         AddResource(id, DRIDrawablePrivResType, (pointer)pDrawable);
@@ -554,7 +554,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
 
     if (pDRIDrawablePriv->sid != 0) {
         xp_destroy_surface(pDRIDrawablePriv->sid);
-        x_hash_table_remove(surface_hash, (void *) pDRIDrawablePriv->sid);
+        x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(pDRIDrawablePriv->sid));
     }
 
     if (pDRIDrawablePriv->notifiers != NULL)
@@ -716,7 +716,7 @@ DRISurfaceNotify(xp_surface_id id, int kind)
     if (surface_hash != NULL)
     {
         pDRIDrawablePriv = x_hash_table_lookup(surface_hash,
-                                               (void *) id, NULL);
+                                               x_cvt_uint_to_vptr(id), NULL);
     }
 
     if (pDRIDrawablePriv == NULL)
@@ -725,7 +725,7 @@ DRISurfaceNotify(xp_surface_id id, int kind)
     if (kind == AppleDRISurfaceNotifyDestroyed)
     {
         pDRIDrawablePriv->sid = 0;
-        x_hash_table_remove(surface_hash, (void *) id);
+        x_hash_table_remove(surface_hash, x_cvt_uint_to_vptr(id));
     }
 
     x_hook_run(pDRIDrawablePriv->notifiers, &arg);
diff --git a/hw/xquartz/xpr/x-hash.c b/hw/xquartz/xpr/x-hash.c
index 55d28ba..7c6a67b 100644
--- a/hw/xquartz/xpr/x-hash.c
+++ b/hw/xquartz/xpr/x-hash.c
@@ -80,13 +80,13 @@ hash_table_destroy_item (x_hash_table *h, void *k, void *v)
         (*h->destroy_value) (v);
 }
 
-static inline unsigned int
+static inline size_t
 hash_table_hash_key (x_hash_table *h, void *k)
 {
     if (h->hash_key != 0)
         return (*h->hash_key) (k);
     else
-        return (unsigned int) k;
+        return (size_t) k;
 }
 
 static inline int
@@ -104,7 +104,7 @@ hash_table_split (x_hash_table *h)
     x_list **new, **old;
     x_list *node, *item, *next;
     int new_size, old_size;
-    unsigned int b;
+    size_t b;
     int i;
 
     if (h->bucket_index == N_BUCKET_SIZES - 1)
@@ -207,7 +207,7 @@ X_PFX (hash_table_size) (x_hash_table *h)
 static void
 hash_table_modify (x_hash_table *h, void *k, void *v, int replace)
 {
-    unsigned int hash_value;
+    size_t hash_value;
     x_list *node, *item;
 
     assert (h != NULL);
@@ -266,7 +266,7 @@ X_PFX (hash_table_replace) (x_hash_table *h, void *k, void *v)
 X_EXTERN void
 X_PFX (hash_table_remove) (x_hash_table *h, void *k)
 {
-    unsigned int hash_value;
+    size_t hash_value;
     x_list **ptr, *item;
 
     assert (h != NULL);
@@ -294,7 +294,7 @@ X_PFX (hash_table_remove) (x_hash_table *h, void *k)
 X_EXTERN void *
 X_PFX (hash_table_lookup) (x_hash_table *h, void *k, void **k_ret)
 {
-    unsigned int hash_value;
+    size_t hash_value;
     x_list *node, *item;
 
     assert (h != NULL);
diff --git a/hw/xquartz/xpr/x-hash.h b/hw/xquartz/xpr/x-hash.h
index 3456dbe..78bc7b3 100644
--- a/hw/xquartz/xpr/x-hash.h
+++ b/hw/xquartz/xpr/x-hash.h
@@ -30,6 +30,9 @@
 #ifndef X_HASH_H
 #define X_HASH_H 1
 
+#include <stdlib.h>
+#include <assert.h>
+
 typedef struct x_hash_table_struct x_hash_table;
 
 typedef int (x_compare_fun) (const void *a, const void *b);
@@ -57,4 +60,32 @@ X_EXTERN void X_PFX (hash_table_foreach) (x_hash_table *h,
 					  x_hash_foreach_fun *fun,
 					  void *data);
 
+/* Conversion between unsigned int (e.g. xp_resource_id) and void pointer */
+
+/* Forward declarations */
+static __inline__ void *
+X_PFX (cvt_uint_to_vptr) (unsigned int val) __attribute__((always_inline));
+static __inline__ unsigned int
+X_PFX (cvt_vptr_to_uint) (void * val) __attribute__((always_inline));
+
+/* Implementations */
+static __inline__ void *
+X_PFX (cvt_uint_to_vptr) (unsigned int val)
+{
+	return (void*)((size_t)(val));
+}
+
+static __inline__ unsigned int
+X_PFX (cvt_vptr_to_uint) (void * val)
+{
+	size_t sv = (size_t)val;
+	unsigned int uv = (unsigned int)sv;
+	
+	/* If this assert fails, chances are val actually is a pointer,
+	   or there's been memory corruption */
+	assert(sv == uv);
+	
+	return uv;
+}
+
 #endif /* X_HASH_H */
diff --git a/hw/xquartz/xpr/xprAppleWM.c b/hw/xquartz/xpr/xprAppleWM.c
index 6480262..fae9a04 100644
--- a/hw/xquartz/xpr/xprAppleWM.c
+++ b/hw/xquartz/xpr/xprAppleWM.c
@@ -41,12 +41,13 @@
 #include <Xplugin.h>
 #include <X11/X.h>
 #include "quartz.h"
+#include "x-hash.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,
+0, 3, 4, 5, INT_MIN + 30, INT_MIN + 29,
 };
 static const int rooted_window_levels[AppleWMNumWindowLevels+1] = {
 202, 203, 204, 205, 201, 200
@@ -59,7 +60,7 @@ static int xprSetWindowLevel(
     xp_window_id wid;
     xp_window_changes wc;
 
-    wid = (xp_window_id) RootlessFrameForWindow (pWin, TRUE);
+    wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, TRUE));
     if (wid == 0)
         return BadWindow;
 
@@ -90,7 +91,7 @@ static int xprFrameDraw(
 {
     xp_window_id wid;
 
-    wid = (xp_window_id) RootlessFrameForWindow (pWin, FALSE);
+    wid = x_cvt_vptr_to_uint(RootlessFrameForWindow (pWin, FALSE));
     if (wid == 0)
         return BadWindow;
 
diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
index 9c131fb..6d1ca07 100644
--- a/hw/xquartz/xpr/xprCursor.c
+++ b/hw/xquartz/xpr/xprCursor.c
@@ -49,6 +49,7 @@
 #include "globals.h"
 #include "servermd.h"
 #include "dixevents.h"
+#include "x-hash.h"
 
 typedef struct {
     int                     cursorVisible;
diff --git a/hw/xquartz/xpr/xprFrame.c b/hw/xquartz/xpr/xprFrame.c
index 7c143b8..9a143ad 100644
--- a/hw/xquartz/xpr/xprFrame.c
+++ b/hw/xquartz/xpr/xprFrame.c
@@ -64,6 +64,28 @@ DEFINE_ATOM_HELPER(xa_native_window_id, "_NATIVE_WINDOW_ID")
 static x_hash_table *window_hash;
 static pthread_mutex_t window_hash_mutex;
 
+/* Prototypes for static functions */
+static Bool xprCreateFrame(RootlessWindowPtr pFrame, ScreenPtr pScreen,
+               int newX, int newY, RegionPtr pShape);
+static void xprDestroyFrame(RootlessFrameID wid);
+static void xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY);
+static void xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
+               int newX, int newY, unsigned int newW, unsigned int newH,
+               unsigned int gravity);
+static void xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid);
+static void xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape);
+static void xprUnmapFrame(RootlessFrameID wid);
+static void xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow);
+static void xprStopDrawing(RootlessFrameID wid, Bool flush);
+static void xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage);
+static void xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
+               int shift_x, int shift_y);
+static void xprSwitchWindow(RootlessWindowPtr pFrame, WindowPtr oldWin);
+static Bool xprDoReorderWindow(RootlessWindowPtr pFrame);
+static void xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
+              int dx, int dy);
+
+
 static inline xp_error
 xprConfigureWindow(xp_window_id id, unsigned int mask,
                    const xp_window_changes *values)
@@ -83,7 +105,7 @@ xprSetNativeProperty(RootlessWindowPtr pFrame)
 
     TA_SERVER();
     
-    err = xp_get_native_window((xp_window_id) pFrame->wid, &native_id);
+    err = xp_get_native_window(x_cvt_vptr_to_uint(pFrame->wid), &native_id);
     if (err == Success)
     {
         /* FIXME: move this to AppleWM extension */
@@ -174,7 +196,7 @@ xprDestroyFrame(RootlessFrameID wid)
     x_hash_table_remove(window_hash, wid);
     pthread_mutex_unlock(&window_hash_mutex);
 
-    xp_destroy_window((xp_window_id) wid);
+    xp_destroy_window(x_cvt_vptr_to_uint(wid));
 }
 
 
@@ -191,7 +213,7 @@ xprMoveFrame(RootlessFrameID wid, ScreenPtr pScreen, int newX, int newY)
     wc.x = newX;
     wc.y = newY;
     //    ErrorF("xprMoveFrame(%d, %p, %d, %d)\n", wid, pScreen, newX, newY);
-    xprConfigureWindow((xp_window_id) wid, XP_ORIGIN, &wc);
+    xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_ORIGIN, &wc);
 }
 
 
@@ -216,7 +238,7 @@ xprResizeFrame(RootlessFrameID wid, ScreenPtr pScreen,
     /* It's unlikely that being async will save us anything here.
        But it can't hurt. */
 
-    xprConfigureWindow((xp_window_id) wid, XP_BOUNDS, &wc);
+    xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_BOUNDS, &wc);
 }
 
 
@@ -241,10 +263,10 @@ xprRestackFrame(RootlessFrameID wid, RootlessFrameID nextWid)
     else
     {
         wc.stack_mode = XP_MAPPED_BELOW;
-        wc.sibling = (xp_window_id) nextWid;
+        wc.sibling = x_cvt_vptr_to_uint(nextWid);
     }
 
-    xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc);
+    xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
 }
 
 
@@ -271,7 +293,7 @@ xprReshapeFrame(RootlessFrameID wid, RegionPtr pShape)
 
     wc.shape_tx = wc.shape_ty = 0;
 
-    xprConfigureWindow((xp_window_id) wid, XP_SHAPE, &wc);
+    xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_SHAPE, &wc);
 }
 
 
@@ -288,7 +310,7 @@ xprUnmapFrame(RootlessFrameID wid)
     wc.stack_mode = XP_UNMAPPED;
     wc.sibling = 0;
 
-    xprConfigureWindow((xp_window_id) wid, XP_STACKING, &wc);
+    xprConfigureWindow(x_cvt_vptr_to_uint(wid), XP_STACKING, &wc);
 }
 
 
@@ -305,9 +327,9 @@ xprStartDrawing(RootlessFrameID wid, char **pixelData, int *bytesPerRow)
 
     TA_SERVER();
     
-    err = xp_lock_window((xp_window_id) wid, NULL, NULL, data, rowbytes, NULL);
+    err = xp_lock_window(x_cvt_vptr_to_uint(wid), NULL, NULL, data, rowbytes, NULL);
     if (err != Success)
-        FatalError("Could not lock window %i for drawing.", (int) wid);
+        FatalError("Could not lock window %i for drawing.", (int)x_cvt_vptr_to_uint(wid));
 
     *pixelData = data[0];
     *bytesPerRow = rowbytes[0];
@@ -322,7 +344,7 @@ xprStopDrawing(RootlessFrameID wid, Bool flush)
 {
     TA_SERVER();
     
-    xp_unlock_window((xp_window_id) wid, flush);
+    xp_unlock_window(x_cvt_vptr_to_uint(wid), flush);
 }
 
 
@@ -334,7 +356,7 @@ xprUpdateRegion(RootlessFrameID wid, RegionPtr pDamage)
 {
     TA_SERVER();
     
-    xp_flush_window((xp_window_id) wid);
+    xp_flush_window(x_cvt_vptr_to_uint(wid));
 }
 
 
@@ -347,7 +369,7 @@ xprDamageRects(RootlessFrameID wid, int nrects, const BoxRec *rects,
 {
     TA_SERVER();
     
-    xp_mark_window((xp_window_id) wid, nrects, rects, shift_x, shift_y);
+    xp_mark_window(x_cvt_vptr_to_uint(wid), nrects, rects, shift_x, shift_y);
 }
 
 
@@ -389,7 +411,7 @@ xprCopyWindow(RootlessFrameID wid, int dstNrects, const BoxRec *dstRects,
 {
     TA_SERVER();
     
-    xp_copy_window((xp_window_id) wid, (xp_window_id) wid,
+    xp_copy_window(x_cvt_vptr_to_uint(wid), x_cvt_vptr_to_uint(wid),
                    dstNrects, dstRects, dx, dy);
 }
 
@@ -446,7 +468,7 @@ xprGetXWindow(xp_window_id wid)
     if (window_hash == NULL)
         return NULL;
 
-    winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
+    winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
 
     return winRec != NULL ? winRec->win : NULL;
 }
@@ -477,7 +499,7 @@ xprGetXWindowFromAppKit(int windowNumber)
     pthread_mutex_unlock(&window_hash_mutex);
 
     if (!ret) return NULL;
-    winRec = x_hash_table_lookup(window_hash, (void *) wid, NULL);
+    winRec = x_hash_table_lookup(window_hash, x_cvt_uint_to_vptr(wid), NULL);
 
     return winRec != NULL ? winRec->win : NULL;
 }
commit 20239a4deebccc9f86586ef6b8ef61311a6fa6a0
Author: Jeremy Huddleston <jeremyhu at freedesktop.org>
Date:   Fri Oct 31 18:58:25 2008 -0700

    Rootless: LP64 related casting fixes from Bob Murphy
    (cherry picked from commit 40441c4e31167932721a79d7ca572caaa1d36e72)

diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index 034d563..a92f1f1 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -238,7 +238,7 @@ extern RegionRec rootlessHugeRoot;
                             ((int)(_x) * _pPix->drawable.bitsPerPixel/8 +   \
                              (int)(_y) * _pPix->devKind);                   \
     if (_pPix->drawable.bitsPerPixel != FB_UNIT) {                          \
-        unsigned _diff = ((unsigned) _pPix->devPrivate.ptr) &               \
+        size_t _diff = ((size_t) _pPix->devPrivate.ptr) &               \
                          (FB_UNIT / CHAR_BIT - 1);                          \
         _pPix->devPrivate.ptr = (char *) (_pPix->devPrivate.ptr) -          \
                                 _diff;                                      \
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 9f74718..1b202e1 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -63,6 +63,8 @@ extern int darwinMainScreenX, darwinMainScreenY;
 #define SCREEN_TO_GLOBAL_Y 0
 #endif
 
+#define MAKE_WINDOW_ID(x)		((xp_window_id)((size_t)(x)))
+
 #define DEFINE_ATOM_HELPER(func,atom_name)                      \
   static Atom func (void) {                                       \
     static unsigned int generation = 0;                             \
@@ -134,7 +136,7 @@ void RootlessNativeWindowMoved (WindowPtr pWin) {
     
     winRec = WINREC(pWin);
     
-    if (xp_get_window_bounds ((xp_window_id)winRec->wid, &bounds) != Success) return;
+    if (xp_get_window_bounds (MAKE_WINDOW_ID(winRec->wid), &bounds) != Success) return;
     
     sx = dixScreenOrigins[pWin->drawable.pScreen->myNum].x + darwinMainScreenX;
     sy = dixScreenOrigins[pWin->drawable.pScreen->myNum].y + darwinMainScreenY;
@@ -1499,7 +1501,7 @@ RootlessFlushWindowColormap (WindowPtr pWin)
   wc.colormap = RootlessColormapCallback;
   wc.colormap_data = pWin->drawable.pScreen;
 
-  configure_window ((xp_window_id)winRec->wid, XP_COLORMAP, &wc);
+  configure_window (MAKE_WINDOW_ID(winRec->wid), XP_COLORMAP, &wc);
 }
 
 /*
@@ -1645,7 +1647,7 @@ RootlessHideAllWindows (void)
             {
                 wc.stack_mode = XP_UNMAPPED;
                 wc.sibling = 0;
-                configure_window ((xp_window_id)winRec->wid, XP_STACKING, &wc);
+                configure_window (MAKE_WINDOW_ID(winRec->wid), XP_STACKING, &wc);
             }
         }
     }


More information about the xorg-commit mailing list