diff options
author | Kevin Walzer <kw@codebykevin.com> | 2016-07-17 03:19:48 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2016-07-17 03:19:48 (GMT) |
commit | ab02e2e1a2936771e3de8bbd3e4fa9c6b84296a4 (patch) | |
tree | de27a92e34064f7884a8185a6c7103120f024777 /macosx/tkMacOSXSubwindows.c | |
parent | dd3deac9990a92730e998c6ae282fe02cde5a700 (diff) | |
download | tk-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
Diffstat (limited to 'macosx/tkMacOSXSubwindows.c')
-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 { |