Some amd64 fixups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@22305 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2006-01-14 11:34:55 +00:00
parent c831510518
commit fe123cdc96
5 changed files with 53 additions and 40 deletions

View file

@ -1,3 +1,12 @@
2006-01-14 Richard Frith-Macdonald <rfm@gnu.org>
* 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 <rfm@gnu.org> 2006-01-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/win32/WIN32Server.m: Attempt to terminate gracefully when * Source/win32/WIN32Server.m: Attempt to terminate gracefully when

View file

@ -419,7 +419,8 @@ static unsigned int unique_index = 0;
DPS_ERROR(DPSundefined, @"No gstate"); DPS_ERROR(DPSundefined, @"No gstate");
return 0; return 0;
} }
NSMapInsert(gtable, (void *)++unique_index, AUTORELEASE([gstate copy])); NSMapInsert(gtable,
(void *)(uintptr_t)++unique_index, AUTORELEASE([gstate copy]));
return unique_index; return unique_index;
} }
@ -432,7 +433,7 @@ static unsigned int unique_index = 0;
{ {
if (gst <= 0) if (gst <= 0)
return; 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) if (n < 0)
DPS_ERROR(DPSinvalidparam, @"Invalid userobject index"); DPS_ERROR(DPSinvalidparam, @"Invalid userobject index");
else else
NSMapInsert(gtable, (void *)n, obj); NSMapInsert(gtable, (void *)(uintptr_t)n, obj);
} }
- (void)DPSexecuserobject: (int)index - (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"); DPS_ERROR(DPSinvalidparam, @"Invalid userobject index");
return; return;
} }
ctxt_push((id)NSMapGet(gtable, (void *)index), opstack); ctxt_push((id)NSMapGet(gtable, (void *)(uintptr_t)index), opstack);
} }
- (void)DPSundefineuserobject: (int)index - (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"); DPS_ERROR(DPSinvalidparam, @"Invalid gstate index");
return; return;
} }
NSMapRemove(gtable, (void *)index); NSMapRemove(gtable, (void *)(uintptr_t)index);
} }
- (void)DPSclear - (void)DPSclear

View file

@ -452,7 +452,7 @@ _parse_display_name(NSString *name, int *dn, int *sn)
screen = [[XGScreenContext alloc] initForDisplay: dpy screen: screen_number]; screen = [[XGScreenContext alloc] initForDisplay: dpy screen: screen_number];
AUTORELEASE(screen); AUTORELEASE(screen);
NSMapInsert(screenList, (void *)screen_number, (void *)screen); NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen);
defScreen = screen_number; defScreen = screen_number;
XSetErrorHandler(XGErrorHandler); XSetErrorHandler(XGErrorHandler);
@ -514,14 +514,14 @@ _parse_display_name(NSString *name, int *dn, int *sn)
format: @"Request for invalid screen"]; format: @"Request for invalid screen"];
} }
screen = NSMapGet(screenList, (void *)screen_number); screen = NSMapGet(screenList, (void *)(uintptr_t)screen_number);
if (screen == NULL) if (screen == NULL)
{ {
XGScreenContext *screen; XGScreenContext *screen;
screen = [[XGScreenContext alloc] screen = [[XGScreenContext alloc]
initForDisplay: dpy screen: screen_number]; initForDisplay: dpy screen: screen_number];
AUTORELEASE(screen); AUTORELEASE(screen);
NSMapInsert(screenList, (void *)screen_number, (void *)screen); NSMapInsert(screenList, (void *)(uintptr_t)screen_number, (void *)screen);
} }
return screen; return screen;
} }

View file

@ -67,7 +67,7 @@ static BOOL handlesWindowDecorations = YES;
*/ */
static char *rootName = 0; 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 */ /* Current mouse grab window */
static gswindow_device_t *grab_window = NULL; static gswindow_device_t *grab_window = NULL;
@ -181,11 +181,11 @@ setNormalHints(Display *d, gswindow_device_t *w)
/* Motif window hints struct */ /* Motif window hints struct */
typedef struct { typedef struct {
unsigned long flags; uint32_t flags;
unsigned long functions; uint32_t functions;
unsigned long decorations; uint32_t decorations;
long input_mode; int32_t input_mode;
unsigned long status; uint32_t status;
} MwmHints; } MwmHints;
/* Number of entries in the struct */ /* Number of entries in the struct */
@ -245,7 +245,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
/* Get the already-set window hints */ /* Get the already-set window hints */
success = XGetWindowProperty (dpy, window, mwhints_atom, 0, success = XGetWindowProperty (dpy, window, mwhints_atom, 0,
sizeof (MwmHints) / sizeof (long), sizeof (MwmHints) / sizeof (uint32_t),
False, AnyPropertyType, &type_ret, &format_ret, False, AnyPropertyType, &type_ret, &format_ret,
&nitems_ret, &bytes_after_ret, &nitems_ret, &bytes_after_ret,
(unsigned char **)&hints); (unsigned char **)&hints);
@ -331,7 +331,7 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
/* Set the hints */ /* Set the hints */
XChangeProperty (dpy, window, mwhints_atom, mwhints_atom, 32, XChangeProperty (dpy, window, mwhints_atom, mwhints_atom, 32,
PropModeReplace, (unsigned char *)hints, PropModeReplace, (unsigned char *)hints,
sizeof (MwmHints) / sizeof (long)); sizeof (MwmHints) / sizeof (uint32_t));
/* Free the hints if allocated by the X server for us */ /* Free the hints if allocated by the X server for us */
if (needToFreeHints == YES) if (needToFreeHints == YES)
@ -368,11 +368,11 @@ static void setWindowHintsForStyle (Display *dpy, Window window,
+ (gswindow_device_t *) _windowForXParent: (Window)xWindow + (gswindow_device_t *) _windowForXParent: (Window)xWindow
{ {
NSMapEnumerator enumerator; NSMapEnumerator enumerator;
Window x; void *key;
gswindow_device_t *d; gswindow_device_t *d;
enumerator = NSEnumerateMapTable(windowmaps); 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) if (d->root != d->parent && d->parent == xWindow)
{ {
@ -887,7 +887,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
{ {
// Store the id of our process // Store the id of our process
Atom pid_atom = XInternAtom(dpy, "_NET_WM_PID", False); Atom pid_atom = XInternAtom(dpy, "_NET_WM_PID", False);
int pid = [pInfo processIdentifier]; int32_t pid = [pInfo processIdentifier];
XChangeProperty(dpy, ROOT, XChangeProperty(dpy, ROOT,
pid_atom, XA_CARDINAL, pid_atom, XA_CARDINAL,
@ -900,7 +900,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
this context */ this context */
- (void) _destroyServerWindows - (void) _destroyServerWindows
{ {
int num; void *key;
gswindow_device_t *d; gswindow_device_t *d;
NSMapEnumerator enumerator; NSMapEnumerator enumerator;
NSMapTable *mapcopy; NSMapTable *mapcopy;
@ -909,10 +909,10 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
the map table */ the map table */
mapcopy = NSCopyMapTableWithZone(windowtags, [self zone]); mapcopy = NSCopyMapTableWithZone(windowtags, [self zone]);
enumerator = NSEnumerateMapTable(mapcopy); 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) if (d->display == dpy && d->ident != d->root)
[self termwindow: num]; [self termwindow: (int)(intptr_t)key];
} }
NSFreeMapTable(mapcopy); NSFreeMapTable(mapcopy);
} }
@ -957,14 +957,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
*/ */
-(BOOL) _createNetIcon: (NSImage*)image -(BOOL) _createNetIcon: (NSImage*)image
result: (long**)pixeldata result: (int32_t**)pixeldata
size: (int*)size size: (int*)size
{ {
NSBitmapImageRep *rep; NSBitmapImageRep *rep;
int i, j, w, h, samples; int i, j, w, h, samples;
unsigned char *data; unsigned char *data;
int index; int index;
long *iconPropertyData; int32_t *iconPropertyData;
int iconSize; int iconSize;
rep = (NSBitmapImageRep *)[image bestRepresentationForDevice:nil]; rep = (NSBitmapImageRep *)[image bestRepresentationForDevice:nil];
@ -989,14 +989,14 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
data = [rep bitmapData]; data = [rep bitmapData];
iconSize = 2 + w * h; iconSize = 2 + w * h;
iconPropertyData = (long *)objc_malloc(sizeof(long) * iconSize); iconPropertyData = (int32_t *)objc_malloc(sizeof(int32_t) * iconSize);
if (iconPropertyData == NULL) if (iconPropertyData == NULL)
{ {
NSLog(@"No memory for WM icon"); NSLog(@"No memory for WM icon");
return NO; return NO;
} }
memset(iconPropertyData, 0, sizeof(long)*iconSize); memset(iconPropertyData, 0, sizeof(int32_t)*iconSize);
index = 0; index = 0;
iconPropertyData[index++] = w; iconPropertyData[index++] = w;
iconPropertyData[index++] = h; iconPropertyData[index++] = h;
@ -1058,7 +1058,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
// but currently this image is not available in the backend. // but currently this image is not available in the backend.
static Atom icon_atom = None; static Atom icon_atom = None;
static BOOL didCreateNetIcon = NO; static BOOL didCreateNetIcon = NO;
static long *iconPropertyData = NULL; static int32_t *iconPropertyData = NULL;
static int iconSize; static int iconSize;
NSImage *image; NSImage *image;
@ -1077,11 +1077,13 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
if (image != nil) if (image != nil)
{ {
didCreateNetIcon = YES; didCreateNetIcon = YES;
[self _createNetIcon: image result: &iconPropertyData size: &iconSize]; [self _createNetIcon: image
result: &iconPropertyData
size: &iconSize];
} }
} }
if (iconPropertyData) if (iconPropertyData != 0)
{ {
XChangeProperty(dpy, window, XChangeProperty(dpy, window,
icon_atom, XA_CARDINAL, icon_atom, XA_CARDINAL,
@ -1296,7 +1298,7 @@ NSDebugLLog(@"Frame", @"X2O %d, %@, %@", win->number,
if (window->region) if (window->region)
XDestroyRegion (window->region); XDestroyRegion (window->region);
RELEASE(window->exposedRects); RELEASE(window->exposedRects);
NSMapRemove(windowtags, (void*)win); NSMapRemove(windowtags, (void*)(uintptr_t)win);
objc_free(window); objc_free(window);
} }
@ -2150,7 +2152,7 @@ static BOOL didCreatePixmaps;
if ((generic.wm & XGWM_EWMH) != 0) if ((generic.wm & XGWM_EWMH) != 0)
{ {
int len; int len;
long data[2]; int32_t data[2];
data[0] = generic.wintypes.win_normal_atom; data[0] = generic.wintypes.win_normal_atom;
data[1] = None; data[1] = None;
@ -2210,7 +2212,7 @@ static BOOL didCreatePixmaps;
else if ((generic.wm & XGWM_GNOME) != 0) else if ((generic.wm & XGWM_GNOME) != 0)
{ {
XEvent event; XEvent event;
int flag = WIN_LAYER_NORMAL; int32_t flag = WIN_LAYER_NORMAL;
if (level == NSDesktopWindowLevel) if (level == NSDesktopWindowLevel)
flag = WIN_LAYER_DESKTOP; flag = WIN_LAYER_DESKTOP;
@ -2613,7 +2615,7 @@ static BOOL didCreatePixmaps;
} }
else else
{ {
unsigned int opacity; uint32_t opacity;
opacity = (unsigned int)(alpha * 0xffffffff); opacity = (unsigned int)(alpha * 0xffffffff);
XChangeProperty(window->display, window->ident, opacity_atom, XChangeProperty(window->display, window->ident, opacity_atom,
@ -2623,7 +2625,7 @@ static BOOL didCreatePixmaps;
{ {
XChangeProperty(window->display, window->parent, opacity_atom, XChangeProperty(window->display, window->parent, opacity_atom,
XA_CARDINAL, 32, PropModeReplace, 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 - (void) _DPSsetcursor: (Cursor)c : (BOOL)set
{ {
Window win; void *key;
NSMapEnumerator enumerator; NSMapEnumerator enumerator;
gswindow_device_t *d; gswindow_device_t *d;
NSDebugLLog (@"NSCursor", @"_DPSsetcursor: cursor = %p, set = %d", c, set); NSDebugLLog (@"NSCursor", @"_DPSsetcursor: cursor = %p, set = %d", c, set);
enumerator = NSEnumerateMapTable (windowmaps); enumerator = NSEnumerateMapTable (windowmaps);
while (NSNextMapEnumeratorPair (&enumerator, (void**)&win, (void**)&d) == YES) while (NSNextMapEnumeratorPair (&enumerator, &key, (void**)&d) == YES)
{ {
Window win = (Window)key;
if (set) if (set)
XDefineCursor(dpy, win, c); XDefineCursor(dpy, win, c);
else else

View file

@ -117,7 +117,7 @@ static void test_xshm(Display *display, int drawing_depth)
} }
shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); 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."); NSLog(@"XShm not supported, shmat() failed: %m.");
XDestroyImage(ximage); XDestroyImage(ximage);
@ -294,7 +294,7 @@ no_xshm:
} }
wi->shminfo.shmaddr = wi->ximage->data = shmat(wi->shminfo.shmid, 0, 0); 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(@"Warning: shmat() failed: %m.");
NSLog(xshm_warning); NSLog(xshm_warning);