From fe123cdc961b674320b0bfd33404e85322a333c5 Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Sat, 14 Jan 2006 11:34:55 +0000 Subject: [PATCH] Some amd64 fixups git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@22305 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 9 ++++++ Source/gsc/GSContext.m | 15 +++++----- Source/x11/XGServer.m | 6 ++-- Source/x11/XGServerWindow.m | 59 +++++++++++++++++++------------------ Source/x11/XWindowBuffer.m | 4 +-- 5 files changed, 53 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e1061d..aa46849 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-01-14 Richard Frith-Macdonald + + * Source/gsc/GSContext.m: + * Source/x11/XGServer.m: + * Source/x11/XGServerWindow.m: + * Source/x11/XWindowBuffer.m: + Some fixes for 64bit processor support (that doesn't mean it's + working yet). + 2006-01-09 Richard Frith-Macdonald * Source/win32/WIN32Server.m: Attempt to terminate gracefully when diff --git a/Source/gsc/GSContext.m b/Source/gsc/GSContext.m index 875e7ec..fdade78 100644 --- a/Source/gsc/GSContext.m +++ b/Source/gsc/GSContext.m @@ -419,7 +419,8 @@ static unsigned int unique_index = 0; DPS_ERROR(DPSundefined, @"No gstate"); return 0; } - NSMapInsert(gtable, (void *)++unique_index, AUTORELEASE([gstate copy])); + NSMapInsert(gtable, + (void *)(uintptr_t)++unique_index, AUTORELEASE([gstate copy])); return unique_index; } @@ -432,7 +433,7 @@ static unsigned int unique_index = 0; { if (gst <= 0) return; - NSMapInsert(gtable, (void *)gst, AUTORELEASE([gstate copy])); + NSMapInsert(gtable, (void *)(uintptr_t)gst, AUTORELEASE([gstate copy])); } /* ----------------------------------------------------------------------- */ @@ -864,27 +865,27 @@ static unsigned int unique_index = 0; if (n < 0) DPS_ERROR(DPSinvalidparam, @"Invalid userobject index"); else - NSMapInsert(gtable, (void *)n, obj); + NSMapInsert(gtable, (void *)(uintptr_t)n, obj); } - (void)DPSexecuserobject: (int)index { - if (index < 0 || NSMapGet(gtable, (void *)index) == nil) + if (index < 0 || NSMapGet(gtable, (void *)(uintptr_t)index) == nil) { DPS_ERROR(DPSinvalidparam, @"Invalid userobject index"); return; } - ctxt_push((id)NSMapGet(gtable, (void *)index), opstack); + ctxt_push((id)NSMapGet(gtable, (void *)(uintptr_t)index), opstack); } - (void)DPSundefineuserobject: (int)index { - if (index < 0 || NSMapGet(gtable, (void *)index) == nil) + if (index < 0 || NSMapGet(gtable, (void *)(uintptr_t)index) == nil) { DPS_ERROR(DPSinvalidparam, @"Invalid gstate index"); return; } - NSMapRemove(gtable, (void *)index); + NSMapRemove(gtable, (void *)(uintptr_t)index); } - (void)DPSclear diff --git a/Source/x11/XGServer.m b/Source/x11/XGServer.m index 744888b..4f7f719 100644 --- a/Source/x11/XGServer.m +++ b/Source/x11/XGServer.m @@ -452,7 +452,7 @@ _parse_display_name(NSString *name, int *dn, int *sn) screen = [[XGScreenContext alloc] initForDisplay: dpy screen: screen_number]; AUTORELEASE(screen); - NSMapInsert(screenList, (void *)screen_number, (void *)screen); + NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen); defScreen = screen_number; XSetErrorHandler(XGErrorHandler); @@ -514,14 +514,14 @@ _parse_display_name(NSString *name, int *dn, int *sn) format: @"Request for invalid screen"]; } - screen = NSMapGet(screenList, (void *)screen_number); + screen = NSMapGet(screenList, (void *)(uintptr_t)screen_number); if (screen == NULL) { XGScreenContext *screen; screen = [[XGScreenContext alloc] initForDisplay: dpy screen: screen_number]; AUTORELEASE(screen); - NSMapInsert(screenList, (void *)screen_number, (void *)screen); + NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen); } return screen; } diff --git a/Source/x11/XGServerWindow.m b/Source/x11/XGServerWindow.m index ab8b121..1545cd8 100644 --- a/Source/x11/XGServerWindow.m +++ b/Source/x11/XGServerWindow.m @@ -67,7 +67,7 @@ static BOOL handlesWindowDecorations = YES; */ static char *rootName = 0; -#define WINDOW_WITH_TAG(windowNumber) (gswindow_device_t *)NSMapGet(windowtags, (void *)windowNumber) +#define WINDOW_WITH_TAG(windowNumber) (gswindow_device_t *)NSMapGet(windowtags, (void *)(uintptr_t)windowNumber) /* Current mouse grab window */ static gswindow_device_t *grab_window = NULL; @@ -181,11 +181,11 @@ setNormalHints(Display *d, gswindow_device_t *w) /* Motif window hints struct */ typedef struct { - unsigned long flags; - unsigned long functions; - unsigned long decorations; - long input_mode; - unsigned long status; + uint32_t flags; + uint32_t functions; + uint32_t decorations; + int32_t input_mode; + uint32_t status; } MwmHints; /* Number of entries in the struct */ @@ -245,7 +245,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window, /* Get the already-set window hints */ success = XGetWindowProperty (dpy, window, mwhints_atom, 0, - sizeof (MwmHints) / sizeof (long), + sizeof (MwmHints) / sizeof (uint32_t), False, AnyPropertyType, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, (unsigned char **)&hints); @@ -331,7 +331,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window, /* Set the hints */ XChangeProperty (dpy, window, mwhints_atom, mwhints_atom, 32, PropModeReplace, (unsigned char *)hints, - sizeof (MwmHints) / sizeof (long)); + sizeof (MwmHints) / sizeof (uint32_t)); /* Free the hints if allocated by the X server for us */ if (needToFreeHints == YES) @@ -368,11 +368,11 @@ static void setWindowHintsForStyle (Display *dpy, Window window, + (gswindow_device_t *) _windowForXParent: (Window)xWindow { NSMapEnumerator enumerator; - Window x; + void *key; gswindow_device_t *d; enumerator = NSEnumerateMapTable(windowmaps); - while (NSNextMapEnumeratorPair(&enumerator, (void**)&x, (void**)&d) == YES) + while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&d) == YES) { if (d->root != d->parent && d->parent == xWindow) { @@ -887,7 +887,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, { // Store the id of our process Atom pid_atom = XInternAtom(dpy, "_NET_WM_PID", False); - int pid = [pInfo processIdentifier]; + int32_t pid = [pInfo processIdentifier]; XChangeProperty(dpy, ROOT, pid_atom, XA_CARDINAL, @@ -900,7 +900,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, this context */ - (void) _destroyServerWindows { - int num; + void *key; gswindow_device_t *d; NSMapEnumerator enumerator; NSMapTable *mapcopy; @@ -909,10 +909,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, the map table */ mapcopy = NSCopyMapTableWithZone(windowtags, [self zone]); enumerator = NSEnumerateMapTable(mapcopy); - while (NSNextMapEnumeratorPair(&enumerator, (void**)&num, (void**)&d) == YES) + while (NSNextMapEnumeratorPair(&enumerator, &key, (void**)&d) == YES) { if (d->display == dpy && d->ident != d->root) - [self termwindow: num]; + [self termwindow: (int)(intptr_t)key]; } NSFreeMapTable(mapcopy); } @@ -957,14 +957,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, */ -(BOOL) _createNetIcon: (NSImage*)image - result: (long**)pixeldata + result: (int32_t**)pixeldata size: (int*)size { NSBitmapImageRep *rep; int i, j, w, h, samples; unsigned char *data; int index; - long *iconPropertyData; + int32_t *iconPropertyData; int iconSize; rep = (NSBitmapImageRep *)[image bestRepresentationForDevice:nil]; @@ -989,14 +989,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, data = [rep bitmapData]; iconSize = 2 + w * h; - iconPropertyData = (long *)objc_malloc(sizeof(long) * iconSize); + iconPropertyData = (int32_t *)objc_malloc(sizeof(int32_t) * iconSize); if (iconPropertyData == NULL) { NSLog(@"No memory for WM icon"); return NO; } - memset(iconPropertyData, 0, sizeof(long)*iconSize); + memset(iconPropertyData, 0, sizeof(int32_t)*iconSize); index = 0; iconPropertyData[index++] = w; iconPropertyData[index++] = h; @@ -1058,7 +1058,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, // but currently this image is not available in the backend. static Atom icon_atom = None; static BOOL didCreateNetIcon = NO; - static long *iconPropertyData = NULL; + static int32_t *iconPropertyData = NULL; static int iconSize; NSImage *image; @@ -1077,11 +1077,13 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, if (image != nil) { didCreateNetIcon = YES; - [self _createNetIcon: image result: &iconPropertyData size: &iconSize]; + [self _createNetIcon: image + result: &iconPropertyData + size: &iconSize]; } } - if (iconPropertyData) + if (iconPropertyData != 0) { XChangeProperty(dpy, window, icon_atom, XA_CARDINAL, @@ -1296,7 +1298,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number, if (window->region) XDestroyRegion (window->region); RELEASE(window->exposedRects); - NSMapRemove(windowtags, (void*)win); + NSMapRemove(windowtags, (void*)(uintptr_t)win); objc_free(window); } @@ -2150,7 +2152,7 @@ static BOOL didCreatePixmaps; if ((generic.wm & XGWM_EWMH) != 0) { int len; - long data[2]; + int32_t data[2]; data[0] = generic.wintypes.win_normal_atom; data[1] = None; @@ -2210,7 +2212,7 @@ static BOOL didCreatePixmaps; else if ((generic.wm & XGWM_GNOME) != 0) { XEvent event; - int flag = WIN_LAYER_NORMAL; + int32_t flag = WIN_LAYER_NORMAL; if (level == NSDesktopWindowLevel) flag = WIN_LAYER_DESKTOP; @@ -2613,7 +2615,7 @@ static BOOL didCreatePixmaps; } else { - unsigned int opacity; + uint32_t opacity; opacity = (unsigned int)(alpha * 0xffffffff); XChangeProperty(window->display, window->ident, opacity_atom, @@ -2623,7 +2625,7 @@ static BOOL didCreatePixmaps; { XChangeProperty(window->display, window->parent, opacity_atom, XA_CARDINAL, 32, PropModeReplace, - (unsigned char*)&opacity, 1L); + (unsigned char*)&opacity, 1); } } } @@ -2714,15 +2716,16 @@ static BOOL cursor_hidden = NO; - (void) _DPSsetcursor: (Cursor)c : (BOOL)set { - Window win; + void *key; NSMapEnumerator enumerator; gswindow_device_t *d; NSDebugLLog (@"NSCursor", @"_DPSsetcursor: cursor = %p, set = %d", c, set); enumerator = NSEnumerateMapTable (windowmaps); - while (NSNextMapEnumeratorPair (&enumerator, (void**)&win, (void**)&d) == YES) + while (NSNextMapEnumeratorPair (&enumerator, &key, (void**)&d) == YES) { + Window win = (Window)key; if (set) XDefineCursor(dpy, win, c); else diff --git a/Source/x11/XWindowBuffer.m b/Source/x11/XWindowBuffer.m index b004438..6d923d4 100644 --- a/Source/x11/XWindowBuffer.m +++ b/Source/x11/XWindowBuffer.m @@ -117,7 +117,7 @@ static void test_xshm(Display *display, int drawing_depth) } shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); - if ((int)shminfo.shmaddr == -1 || num_xshm_test_errors) + if ((intptr_t)shminfo.shmaddr == -1 || num_xshm_test_errors) { NSLog(@"XShm not supported, shmat() failed: %m."); XDestroyImage(ximage); @@ -294,7 +294,7 @@ no_xshm: } wi->shminfo.shmaddr = wi->ximage->data = shmat(wi->shminfo.shmid, 0, 0); - if ((int)wi->shminfo.shmaddr == -1) + if ((intptr_t)wi->shminfo.shmaddr == -1) { NSLog(@"Warning: shmat() failed: %m."); NSLog(xshm_warning);