summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXSubwindows.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-rw-r--r--macosx/tkMacOSXSubwindows.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index c1f16f3..f92d260 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -65,7 +65,7 @@ XDestroyWindow(
TkMacOSXSelDeadWindow(macWin->winPtr);
macWin->toplevel->referenceCount--;
- if (!Tk_IsTopLevel(macWin->winPtr)) {
+ if (!Tk_IsTopLevel(macWin->winPtr) ) {
TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW);
if (macWin->winPtr->parentPtr != NULL) {
TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr);
@@ -81,9 +81,9 @@ XDestroyWindow(
}
if (macWin->toplevel->referenceCount == 0) {
- ckfree((char *) macWin->toplevel);
+ ckfree(macWin->toplevel);
}
- ckfree((char *) macWin);
+ ckfree(macWin);
return;
}
if (macWin->visRgn) {
@@ -103,7 +103,7 @@ XDestroyWindow(
*/
if (macWin->toplevel->referenceCount == 0) {
- ckfree((char *) macWin->toplevel);
+ ckfree(macWin->toplevel);
}
}
@@ -153,8 +153,6 @@ XMapWindow(
if ( [win canBecomeKeyWindow] ) {
[win makeKeyAndOrderFront:NSApp];
}
- /* Why do we need this? (It is used by Carbon)*/
- [win windowRef];
TkMacOSXApplyWindowAttributes(macWin->winPtr, win);
}
TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr);
@@ -316,7 +314,6 @@ XResizeWindow(
display->request++;
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
NSWindow *w = macWin->winPtr->wmInfoPtr->window;
-
if (w) {
NSRect r = [w contentRectForFrameRect:[w frame]];
r.origin.y += r.size.height - height;
@@ -360,10 +357,19 @@ XMoveResizeWindow(
if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) {
NSWindow *w = macWin->winPtr->wmInfoPtr->window;
if (w) {
- NSRect r = NSMakeRect(x + macWin->winPtr->wmInfoPtr->xInParent,
- tkMacOSXZeroScreenHeight - (y +
- macWin->winPtr->wmInfoPtr->yInParent + height),
- width, height);
+ /* We explicitly convert everything to doubles so we don't get
+ * surprised (again) by what happens when you do arithmetic with
+ * unsigned ints.
+ */
+ CGFloat X = (CGFloat)x;
+ CGFloat Y = (CGFloat)y;
+ CGFloat Width = (CGFloat)width;
+ CGFloat Height = (CGFloat)height;
+ CGFloat XOff = (CGFloat)macWin->winPtr->wmInfoPtr->xInParent;
+ CGFloat YOff = (CGFloat)macWin->winPtr->wmInfoPtr->yInParent;
+ NSRect r = NSMakeRect(X + XOff,
+ tkMacOSXZeroScreenHeight - Y - YOff - Height,
+ Width, Height);
[w setFrame:[w frameRectForContentRect:r] display:YES];
}
} else {
@@ -1347,7 +1353,7 @@ Tk_GetPixmap(
if (display != NULL) {
display->request++;
}
- macPix = (MacDrawable *) ckalloc(sizeof(MacDrawable));
+ macPix = ckalloc(sizeof(MacDrawable));
macPix->winPtr = NULL;
macPix->xOff = 0;
macPix->yOff = 0;
@@ -1396,7 +1402,7 @@ Tk_FreePixmap(
}
CFRelease(macPix->context);
}
- ckfree((char *) macPix);
+ ckfree(macPix);
}
/*