diff options
Diffstat (limited to 'macosx/tkMacOSXXStubs.c')
-rw-r--r-- | macosx/tkMacOSXXStubs.c | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c index 59c6a56..a5f1c60 100644 --- a/macosx/tkMacOSXXStubs.c +++ b/macosx/tkMacOSXXStubs.c @@ -152,8 +152,8 @@ TkpOpenDisplay( } } - display = (Display *) ckalloc(sizeof(Display)); - screen = (Screen *) ckalloc(sizeof(Screen)); + display = ckalloc(sizeof(Display)); + screen = ckalloc(sizeof(Screen)); bzero(display, sizeof(Display)); bzero(screen, sizeof(Screen)); @@ -192,7 +192,7 @@ TkpOpenDisplay( screen->white_pixel = 0x00FFFFFF | PIXEL_MAGIC << 24; screen->ext_data = (XExtData *) &maxBounds; - screen->root_visual = (Visual *) ckalloc(sizeof(Visual)); + screen->root_visual = ckalloc(sizeof(Visual)); screen->root_visual->visualid = 0; screen->root_visual->class = TrueColor; screen->root_visual->red_mask = 0x00FF0000; @@ -207,7 +207,7 @@ TkpOpenDisplay( TkMacOSXDisplayChanged(display); - gMacDisplay = (TkDisplay *) ckalloc(sizeof(TkDisplay)); + gMacDisplay = ckalloc(sizeof(TkDisplay)); /* * This is the quickest way to make sure that all the *Init flags get @@ -249,11 +249,11 @@ TkpCloseDisplay( gMacDisplay = NULL; if (display->screens != NULL) { if (display->screens->root_visual != NULL) { - ckfree((char *) display->screens->root_visual); + ckfree(display->screens->root_visual); } - ckfree((char *) display->screens); + ckfree(display->screens); } - ckfree((char *) display); + ckfree(display); } /* @@ -333,33 +333,6 @@ MacXIdAlloc( /* *---------------------------------------------------------------------- * - * TkpWindowWasRecentlyDeleted -- - * - * Tries to determine whether the given window was recently deleted. - * Called from the generic code error handler to attempt to deal with - * async BadWindow errors under some circumstances. - * - * Results: - * Always 0, we do not keep this information on the Mac, so we do not - * know whether the window was destroyed. - * - * Side effects: - * None. - * - *---------------------------------------------------------------------- - */ - -int -TkpWindowWasRecentlyDeleted( - Window win, - TkDisplay *dispPtr) -{ - return 0; -} - -/* - *---------------------------------------------------------------------- - * * DefaultErrorHandler -- * * This procedure is the default X error handler. Tk uses it's own error @@ -810,7 +783,7 @@ XCreateImage( { XImage *ximage; display->request++; - ximage = (XImage *) ckalloc(sizeof(XImage)); + ximage = ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; @@ -912,7 +885,7 @@ XGetImage( bitmap_fmt = [bitmap_rep bitmapFormat]; if ( bitmap_rep == Nil || - (bitmap_fmt != 0 && bitmap_fmt != 1) || + (bitmap_fmt != 0 && bitmap_fmt != 1) || [bitmap_rep samplesPerPixel] != 4 || [bitmap_rep isPlanar] != 0 ) { TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep"); @@ -922,8 +895,8 @@ XGetImage( NSSize image_size = NSMakeSize(width, height); NSImage* ns_image = [[NSImage alloc]initWithSize:image_size]; [ns_image addRepresentation:bitmap_rep]; - -/* Assume premultiplied nonplanar data with 4 bytes per pixel.*/ + + /* Assume premultiplied nonplanar data with 4 bytes per pixel.*/ if ( [bitmap_rep isPlanar ] == 0 && [bitmap_rep samplesPerPixel] == 4 ) { bytes_per_row = [bitmap_rep bytesPerRow]; @@ -934,9 +907,9 @@ XGetImage( bitmap = ckalloc(size); /* Oddly enough, the bitmap has the top row at the beginning, - and the pixels are in BGRA or ABGR format. + and the pixels are in BGRA or ABGR format. */ - if (bitmap_fmt == 0) { + if (bitmap_fmt == 0) { /* BGRA */ for (row=0, n=0; row<height; row++, n+=bytes_per_row) { for (m=n; m<n+bytes_per_row; m+=4) { @@ -955,9 +928,10 @@ XGetImage( *(bitmap+m+2) = *(image_data+m+1); *(bitmap+m+3) = *(image_data+m); } - } - } - } + } + } + } + } if (bitmap) { imagePtr = XCreateImage(display, NULL, depth, format, offset, (char*)bitmap, width, height, bitmap_pad, bytes_per_row); @@ -994,7 +968,7 @@ DestroyImage( if (image->data) { ckfree(image->data); } - ckfree((char*) image); + ckfree(image); } return 0; } |