summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2016-07-17 03:19:10 (GMT)
committerKevin Walzer <kw@codebykevin.com>2016-07-17 03:19:10 (GMT)
commit238b8d68c514e0bca1a97dea4d50a4badedf2111 (patch)
tree85487d891e55b33b4dae351b5ef8bdf3c2209a0a /macosx
parent2ae13e10ac2c3c86584cece38298da049533e803 (diff)
downloadtk-238b8d68c514e0bca1a97dea4d50a4badedf2111.zip
tk-238b8d68c514e0bca1a97dea4d50a4badedf2111.tar.gz
tk-238b8d68c514e0bca1a97dea4d50a4badedf2111.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')
-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 {