diff options
author | Kevin Walzer <kw@codebykevin.com> | 2016-07-17 03:19:10 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2016-07-17 03:19:10 (GMT) |
commit | e56c3ddc91d21776f48e2387d987da8b555a3e65 (patch) | |
tree | 85487d891e55b33b4dae351b5ef8bdf3c2209a0a | |
parent | 657059c544043fca33be51d893ad79cdb8941e24 (diff) | |
download | tk-e56c3ddc91d21776f48e2387d987da8b555a3e65.zip tk-e56c3ddc91d21776f48e2387d987da8b555a3e65.tar.gz tk-e56c3ddc91d21776f48e2387d987da8b555a3e65.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.c | 20 |
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 { |