summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2016-07-17 03:19:48 (GMT)
committerKevin Walzer <kw@codebykevin.com>2016-07-17 03:19:48 (GMT)
commitab02e2e1a2936771e3de8bbd3e4fa9c6b84296a4 (patch)
treede27a92e34064f7884a8185a6c7103120f024777
parentdd3deac9990a92730e998c6ae282fe02cde5a700 (diff)
downloadtk-ab02e2e1a2936771e3de8bbd3e4fa9c6b84296a4.zip
tk-ab02e2e1a2936771e3de8bbd3e4fa9c6b84296a4.tar.gz
tk-ab02e2e1a2936771e3de8bbd3e4fa9c6b84296a4.tar.bz2
Fix for Ticket c84f660833546b1b84e7fd3aef930c2f17207461 (Tk crashes when toplevel placed on second display, Mac); thanks to Marc Culler for patch
-rw-r--r--macosx/tkMacOSXSubwindows.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/macosx/tkMacOSXSubwindows.c b/macosx/tkMacOSXSubwindows.c
index f026318..d9e1d63 100644
--- a/macosx/tkMacOSXSubwindows.c
+++ b/macosx/tkMacOSXSubwindows.c
@@ -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,
+ Width, Height);
[w setFrame:[w frameRectForContentRect:r] display:YES];
}
} else {