From 22f49d639009f2cbb687a3a956d5f00eb7050948 Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 4 Dec 2018 21:02:04 +0000 Subject: Fix bug[185c8557d9]: issues with overrideredirect and zoomed state --- macosx/tkMacOSXWindowEvent.c | 13 +++++++++++++ macosx/tkMacOSXWm.c | 33 +++++++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index b234e72..1f62d6e 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -136,6 +136,19 @@ extern NSString *NSWindowDidOrderOffScreenNotification; } } +- (NSRect)windowWillUseStandardFrame:(NSWindow *)window + defaultFrame:(NSRect)newFrame +{ + + /* + * This method needs to be implemented in order for [NSWindow isZoomed] + * to give the correct answer. But it suffices to always validate + * every request. + */ + + return newFrame; +} + - (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize { diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 7f707b0..9465362 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -414,7 +414,6 @@ static void RemapWindows(TkWindow *winPtr, } #endif - - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize { @@ -1736,6 +1735,7 @@ WmDeiconifyCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; + NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); @@ -1758,6 +1758,9 @@ WmDeiconifyCmd( TkpWmSetState(winPtr, TkMacOSXIsWindowZoomed(winPtr) ? ZoomState : NormalState); + [win setExcludedFromWindowsMenu:NO]; + TkMacOSXApplyWindowAttributes(winPtr, win); + [win orderFront:nil]; return TCL_OK; } @@ -2241,7 +2244,7 @@ WmIconifyCmd( if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify \"%s\": override-redirect flag is set", + "can't iconify \"%s\": overrideredirect flag is set", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT", NULL); @@ -2822,6 +2825,19 @@ WmOverrideredirectCmd( atts.override_redirect = (boolean) ? True : False; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); ApplyMasterOverrideChanges(winPtr, NULL); + NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + if (boolean) { + [win setExcludedFromWindowsMenu:YES]; + [win setStyleMask:([win styleMask] & ~NSTitledWindowMask)]; + } else { + const char *title = winPtr->wmInfoPtr->titleUid; + if (!title) { + title = winPtr->nameUid; + } + [win setStyleMask:([win styleMask] | NSTitledWindowMask)]; + [win setTitle:[NSString stringWithUTF8String:title]]; + [win setExcludedFromWindowsMenu:NO]; + } return TCL_OK; } @@ -3563,8 +3579,8 @@ WmWithdrawCmd( return TCL_ERROR; } TkpWmSetState(winPtr, WithdrawnState); - /*Remove window from Window menu.*/ NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + [win orderOut:nil]; [win setExcludedFromWindowsMenu:YES]; return TCL_OK; @@ -5199,7 +5215,8 @@ MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { - return [TkMacOSXDrawableWindow(winPtr->window) isZoomed]; + NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); + return [macWindow isZoomed]; } @@ -5244,13 +5261,13 @@ TkMacOSXZoomToplevel( * Do nothing if already in desired zoom state. */ - if ((![window isZoomed] == (zoomPart == inZoomIn))) { + if (([window isZoomed] == (zoomPart == inZoomOut))) { return false; } - [window zoom:NSApp]; + [window zoom:NSApp]; - wmPtr->hints.initial_state = - (zoomPart == inZoomIn ? NormalState : ZoomState); + wmPtr->hints.initial_state = + (zoomPart == inZoomIn ? NormalState : ZoomState); return true; } -- cgit v0.12 From 68112ff61624e85913f4b0c5b3bcde8bb5f08600 Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 4 Dec 2018 22:41:37 +0000 Subject: Stop withdrawn windows from being displayed when the Wish app is reopened. --- macosx/tkMacOSXHLEvents.c | 7 +------ macosx/tkMacOSXWindowEvent.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/macosx/tkMacOSXHLEvents.c b/macosx/tkMacOSXHLEvents.c index 468e41c..9b874a5 100644 --- a/macosx/tkMacOSXHLEvents.c +++ b/macosx/tkMacOSXHLEvents.c @@ -93,12 +93,7 @@ static int ReallyKillMe(Tcl_Event *eventPtr, int flags); - (void) handleReopenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 - ProcessSerialNumber thePSN = {0, kCurrentProcess}; - SetFrontProcess(&thePSN); -#else - [[NSApplication sharedApplication] activateIgnoringOtherApps: YES]; -#endif + [NSApp activateIgnoringOtherApps: YES]; if (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ReopenApplication", NULL, 0)) { int code = Tcl_EvalEx(_eventInterp, "::tk::mac::ReopenApplication", diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 1f62d6e..30ef6a5 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -310,6 +310,20 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #endif } +- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender + hasVisibleWindows:(BOOL)flag +{ + /* + * Allowing the default response means that withdrawn windows will get + * displayed on the screen with unresponsive title buttons. We don't + * really want that. Besides, we can write our own code to handle this + * with ::tk::mac::ReopenApplication. So we just say NO. + */ + + return NO; +} + + - (void) applicationShowHide: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS -- cgit v0.12 From c725a0f33f826163d6e3c5b1582c6a96c4a5cf5a Mon Sep 17 00:00:00 2001 From: culler Date: Thu, 6 Dec 2018 03:56:57 +0000 Subject: Make overrideredirect windows display correctly even if the underlying NSWindow did not exist when the flag was set and fix some bounds computation bugs. --- macosx/tkMacOSXWindowEvent.c | 10 ++-- macosx/tkMacOSXWm.c | 107 ++++++++++++++++++++++++++++++------------- 2 files changed, 79 insertions(+), 38 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 30ef6a5..46be0c7 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -136,16 +136,16 @@ extern NSString *NSWindowDidOrderOffScreenNotification; } } -- (NSRect)windowWillUseStandardFrame:(NSWindow *)window +- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame { - + /* * This method needs to be implemented in order for [NSWindow isZoomed] * to give the correct answer. But it suffices to always validate * every request. */ - + return newFrame; } @@ -310,7 +310,7 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #endif } -- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender +- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag { /* @@ -995,7 +995,7 @@ ConfigureRestrictProc( /* * Finally, unlock the main autoreleasePool. */ - + [NSApp _unlockAutoreleasePool]; } } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 9465362..d48740e 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -389,7 +389,7 @@ static void RemapWindows(TkWindow *winPtr, */ if ([self styleMask] & NSFullScreenWindowMask) { - frameRect = [NSWindow frameRectForContentRect:NSZeroRect + frameRect = [NSWindow frameRectForContentRect:NSZeroRect styleMask:[self styleMask]]; } else { frameRect = [self frameRectForContentRect:NSZeroRect]; @@ -934,7 +934,8 @@ TkWmDeadWindow( if (title == nil) { title = "unnamed window"; } - printf(">>>> Closing <%s>. Count is: %lu\n", title, [window retainCount]); + fprintf(stderr, ">>>> Closing <%s>. Count is: %lu\n", title, + [window retainCount]); } #endif [window close]; @@ -2244,7 +2245,7 @@ WmIconifyCmd( if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "can't iconify \"%s\": overrideredirect flag is set", + "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT", NULL); @@ -2805,8 +2806,9 @@ WmOverrideredirectCmd( int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { - int boolean; + int flag; XSetWindowAttributes atts; + TKWindow *win = (TKWindow *)TkMacOSXDrawableWindow(winPtr->window); if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); @@ -2819,25 +2821,12 @@ WmOverrideredirectCmd( return TCL_OK; } - if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) { + if (Tcl_GetBooleanFromObj(interp, objv[3], &flag) != TCL_OK) { return TCL_ERROR; } - atts.override_redirect = (boolean) ? True : False; + atts.override_redirect = flag ? True : False; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); - ApplyMasterOverrideChanges(winPtr, NULL); - NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); - if (boolean) { - [win setExcludedFromWindowsMenu:YES]; - [win setStyleMask:([win styleMask] & ~NSTitledWindowMask)]; - } else { - const char *title = winPtr->wmInfoPtr->titleUid; - if (!title) { - title = winPtr->nameUid; - } - [win setStyleMask:([win styleMask] | NSTitledWindowMask)]; - [win setTitle:[NSString stringWithUTF8String:title]]; - [win setExcludedFromWindowsMenu:NO]; - } + ApplyMasterOverrideChanges(winPtr, win); return TCL_OK; } @@ -3885,6 +3874,7 @@ UpdateGeometryInfo( return; } + /* * Compute the new size for the top-level window. See the user * documentation for details on this, but the size requested depends on @@ -5215,7 +5205,7 @@ MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { - NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); + NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); return [macWindow isZoomed]; } @@ -5681,6 +5671,8 @@ TkMacOSXMakeRealWindowExist( { WmInfo *wmPtr = winPtr->wmInfoPtr; MacDrawable *macWin; + WindowClass macClass; + Bool overrideRedirect = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (TkMacOSXHostToplevelExists(winPtr)) { return; @@ -5717,7 +5709,16 @@ TkMacOSXMakeRealWindowExist( * TODO: Here we should handle out of process embedding. */ } - WindowClass macClass = wmPtr->macClass; + + /* + * If this is an override-redirect window, the NSWindow is created + * first as a document window then converted to a simple window. + */ + + if (overrideRedirect) { + wmPtr->macClass = kDocumentWindowClass; + } + macClass = wmPtr->macClass; wmPtr->attributes &= (tkAlwaysValidAttributes | macClassAttrs[macClass].validAttrs); wmPtr->flags |= macClassAttrs[macClass].flags | @@ -5770,12 +5771,10 @@ TkMacOSXMakeRealWindowExist( */ [window setMovableByWindowBackground:NO]; } - [window setDocumentEdited:NO]; wmPtr->window = window; macWin->view = window.contentView; TkMacOSXApplyWindowAttributes(winPtr, window); - NSRect geometry = InitialWindowBounds(winPtr, window); geometry.size.width += structureRect.size.width; geometry.size.height += structureRect.size.height; @@ -5783,7 +5782,14 @@ TkMacOSXMakeRealWindowExist( geometry.size.height); [window setFrame:geometry display:YES]; TkMacOSXRegisterOffScreenWindow((Window) macWin, window); + macWin->flags |= TK_HOST_EXISTS; + if (overrideRedirect) { + XSetWindowAttributes atts; + atts.override_redirect = True; + Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); + ApplyMasterOverrideChanges(winPtr, NULL); + } } /* @@ -6496,7 +6502,7 @@ ApplyWindowAttributeFlagChanges( #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) if (!(macWindow.styleMask & NSUtilityWindowMask)) { - NSSize screenSize = [[macWindow screen]frame].size; + NSSize screenSize = [[macWindow screen]frame].size; b |= NSWindowCollectionBehaviorFullScreenPrimary; /* The default max size has height less than the screen height. @@ -6504,7 +6510,7 @@ ApplyWindowAttributeFlagChanges( * to be resized when it is a split window. To work around * this we make the max size equal to the screen size. */ - + [macWindow setMaxFullScreenContentSize:screenSize]; } #endif @@ -6565,6 +6571,14 @@ ApplyMasterOverrideChanges( WmInfo *wmPtr = winPtr->wmInfoPtr; UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; + unsigned long styleMask; + NSRect structureRect; + + if (!macWindow && winPtr->window != None && + TkMacOSXHostToplevelExists(winPtr)) { + macWindow = TkMacOSXDrawableWindow(winPtr->window); + } + styleMask = [macWindow styleMask]; /* * FIX: We need an UpdateWrapper equivalent to make this 100% correct @@ -6576,6 +6590,7 @@ ApplyMasterOverrideChanges( wmPtr->attributes = macClassAttrs[kSimpleWindowClass].defaultAttrs; } wmPtr->attributes |= kWindowNoActivatesAttribute; + styleMask &= ~NSTitledWindowMask; } else { if (wmPtr->macClass == kSimpleWindowClass && oldAttributes == kWindowNoActivatesAttribute) { @@ -6584,18 +6599,43 @@ ApplyMasterOverrideChanges( macClassAttrs[kDocumentWindowClass].defaultAttrs; } wmPtr->attributes &= ~kWindowNoActivatesAttribute; - } - if (!macWindow && winPtr->window != None && - TkMacOSXHostToplevelExists(winPtr)) { - macWindow = TkMacOSXDrawableWindow(winPtr->window); + styleMask |= NSTitledWindowMask; } if (macWindow) { - if (winPtr->atts.override_redirect && wmPtr->master != None) { - wmPtr->flags |= WM_TOPMOST; + NSWindow *parentWindow = [macWindow parentWindow]; + structureRect = [NSWindow frameRectForContentRect:NSZeroRect + styleMask:styleMask]; + + /* + * Synchronize the wmInfoPtr to match the new window configuration + * so windowBoundsChanged won't corrupt the window manager info. + */ + + wmPtr->xInParent = -structureRect.origin.x; + wmPtr->yInParent = structureRect.origin.y + structureRect.size.height; + wmPtr->parentWidth = winPtr->changes.width + structureRect.size.width; + wmPtr->parentHeight = winPtr->changes.height + structureRect.size.height; + if (winPtr->atts.override_redirect) { + [macWindow setExcludedFromWindowsMenu:YES]; + [macWindow setStyleMask:styleMask]; + if (wmPtr->hints.initial_state == NormalState) { + [macWindow orderFront:nil]; + } + if (wmPtr->master != None) { + wmPtr->flags |= WM_TOPMOST; + } else { + wmPtr->flags &= ~WM_TOPMOST; + } } else { + const char *title = winPtr->wmInfoPtr->titleUid; + if (!title) { + title = winPtr->nameUid; + } + [macWindow setStyleMask:styleMask]; + [macWindow setTitle:[NSString stringWithUTF8String:title]]; + [macWindow setExcludedFromWindowsMenu:NO]; wmPtr->flags &= ~WM_TOPMOST; } - NSWindow *parentWindow = [macWindow parentWindow]; if (wmPtr->master != None) { TkDisplay *dispPtr = TkGetDisplayList(); TkWindow *masterWinPtr = (TkWindow *) @@ -6623,6 +6663,7 @@ ApplyMasterOverrideChanges( } ApplyWindowAttributeFlagChanges(winPtr, macWindow, oldAttributes, oldFlags, 0, 0); + //TkMacOSXApplyWindowAttributes(winPtr, macWindow); } } -- cgit v0.12 From b20ff2508d949ce13f83e27d4a0f24898c3966d5 Mon Sep 17 00:00:00 2001 From: culler Date: Thu, 6 Dec 2018 20:33:45 +0000 Subject: Fix the inconsistencies in the wm geometry command reported in ticket [1c1f8d34be]. --- macosx/tkMacOSXWindowEvent.c | 21 ++++++++++++++++++--- macosx/tkMacOSXWm.c | 1 - 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index 46be0c7..fd401ab 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -69,7 +69,6 @@ extern NSString *NSWindowDidOrderOffScreenNotification; #endif BOOL movedOnly = [[notification name] isEqualToString:NSWindowDidMoveNotification]; - NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); @@ -77,10 +76,10 @@ extern NSString *NSWindowDidOrderOffScreenNotification; WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect bounds = [w frame]; int x, y, width = -1, height = -1, flags = 0; - + int minY = 1 + [[NSApp mainMenu] menuBarHeight]; x = bounds.origin.x; y = tkMacOSXZeroScreenHeight - (bounds.origin.y + bounds.size.height); - if (winPtr->changes.x != x || winPtr->changes.y != y){ + if (winPtr->changes.x != x || winPtr->changes.y != y) { flags |= TK_LOCATION_CHANGED; } else { x = y = -1; @@ -99,8 +98,24 @@ extern NSString *NSWindowDidOrderOffScreenNotification; flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY; } + + /* + * Mac windows cannot go higher than the bottom of the menu bar. The + * Tk window manager can request that a window be drawn so that it + * overlaps the menu bar, but it will actually be drawn immediately + * below the menu bar. In such a case it saves a lot of trouble and + * causes no harm if we let Tk think that the window is located at the + * requested point. (Many of the the tests assume that this is the + * case, especially for windows with upper left corner at (0,0).) So + * we just tell a harmless white lie here. + */ + + if (y == minY && wmPtr->y < minY) { + y = wmPtr->y; + } TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags); } + } - (void) windowExpanded: (NSNotification *) notification diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index d48740e..f36ef1d 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6663,7 +6663,6 @@ ApplyMasterOverrideChanges( } ApplyWindowAttributeFlagChanges(winPtr, macWindow, oldAttributes, oldFlags, 0, 0); - //TkMacOSXApplyWindowAttributes(winPtr, macWindow); } } -- cgit v0.12 From ed697270bf79d3525fdb01477d309fef2153bfcd Mon Sep 17 00:00:00 2001 From: culler Date: Thu, 6 Dec 2018 22:27:30 +0000 Subject: Implement the fancy negative coordinates in wm geometry to make many more unixWm tests pass. --- macosx/tkMacOSXWindowEvent.c | 9 ++++++--- macosx/tkMacOSXWm.c | 25 +++++++++++++++++-------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index fd401ab..a07ef15 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -31,7 +31,7 @@ */ static int GenerateUpdates(HIShapeRef updateRgn, - CGRect *updateBounds, TkWindow *winPtr); + CGRect *updateBounds, TkWindow *winPtr); static int GenerateActivateEvents(TkWindow *winPtr, int activeFlag); static void DoWindowActivate(ClientData clientData); @@ -75,10 +75,12 @@ extern NSString *NSWindowDidOrderOffScreenNotification; if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect bounds = [w frame]; + NSRect screenRect = [[w screen] frame]; int x, y, width = -1, height = -1, flags = 0; int minY = 1 + [[NSApp mainMenu] menuBarHeight]; + x = bounds.origin.x; - y = tkMacOSXZeroScreenHeight - (bounds.origin.y + bounds.size.height); + y = screenRect.size.height - (bounds.origin.y + bounds.size.height); if (winPtr->changes.x != x || winPtr->changes.y != y) { flags |= TK_LOCATION_CHANGED; } else { @@ -679,7 +681,7 @@ TkGenWMConfigureEvent( if (flags & TK_LOCATION_CHANGED) { wmPtr->x = x; wmPtr->y = y; - wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y); + //wmPtr->flags &= ~(WM_NEGATIVE_X | WM_NEGATIVE_Y); } if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) && ((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) { @@ -722,6 +724,7 @@ TkGenWMConfigureEvent( } } + /* * Now set up the changes structure. Under X we wait for the * ConfigureNotify to set these values. On the Mac we know imediatly that diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index f36ef1d..8ef322b 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1951,8 +1951,9 @@ WmGeometryCmd( Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; - char xSign, ySign; - int width, height; + NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); + char xSign = '+', ySign = '+'; + int width, height, x = wmPtr->x, y= wmPtr->y; char *argv3; if ((objc != 3) && (objc != 4)) { @@ -1960,8 +1961,6 @@ WmGeometryCmd( return TCL_ERROR; } if (objc == 3) { - xSign = (wmPtr->flags & WM_NEGATIVE_X) ? '-' : '+'; - ySign = (wmPtr->flags & WM_NEGATIVE_Y) ? '-' : '+'; if (wmPtr->gridWin != NULL) { width = wmPtr->reqGridWidth + (winPtr->changes.width - winPtr->reqWidth)/wmPtr->widthInc; @@ -1971,8 +1970,20 @@ WmGeometryCmd( width = winPtr->changes.width; height = winPtr->changes.height; } + if (win) { + if (wmPtr->flags & WM_NEGATIVE_X) { + xSign = '-'; + x = wmPtr->vRootWidth - wmPtr->x + - (width + (wmPtr->parentWidth - winPtr->changes.width)); + } + if (wmPtr->flags & WM_NEGATIVE_Y) { + ySign = '-'; + y = wmPtr->vRootHeight - wmPtr->y + - (height + (wmPtr->parentHeight - winPtr->changes.height)); + } + } Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d%c%d%c%d", - width, height, xSign, wmPtr->x, ySign, wmPtr->y)); + width, height, xSign, x, ySign, y)); return TCL_OK; } argv3 = Tcl_GetString(objv[3]); @@ -3874,7 +3885,6 @@ UpdateGeometryInfo( return; } - /* * Compute the new size for the top-level window. See the user * documentation for details on this, but the size requested depends on @@ -4216,7 +4226,6 @@ ParseGeometry( flags |= WM_MOVE_PENDING; } wmPtr->flags = flags; - if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); wmPtr->flags |= WM_UPDATE_PENDING; @@ -4677,7 +4686,7 @@ Tk_MoveToplevelWindow( wmPtr->x = x; wmPtr->y = y; wmPtr->flags |= WM_MOVE_PENDING; - wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y); + // wmPtr->flags &= ~(WM_NEGATIVE_X|WM_NEGATIVE_Y); if (!(wmPtr->sizeHintsFlags & (USPosition|PPosition))) { wmPtr->sizeHintsFlags |= USPosition; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; -- cgit v0.12 From 92839a2b0c49101693b1bd73e7e1e68685ed0542 Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 7 Dec 2018 15:51:41 +0000 Subject: Mark tests wm-stackorder-5.2 and wm-stackorder-6.1 as inappropriate for aqua. --- tests/wm.test | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/wm.test b/tests/wm.test index 9cbe49a..d8b1c04 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1516,8 +1516,8 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { } -cleanup { destroy .t } -result {.t .} -test wm-stackorder-5.2 {A normal toplevel can't be\ - raised above an overrideredirect toplevel} -body { +test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ + overrideredirect toplevel} -constraints !aqua -body { toplevel .t wm overrideredirect .t 1 raise . @@ -1530,6 +1530,7 @@ test wm-stackorder-5.2 {A normal toplevel can't be\ test wm-stackorder-5.3 {An overrideredirect window\ can be explicitly lowered} -body { toplevel .t + tkwait visibility .t wm overrideredirect .t 1 lower .t update @@ -1540,7 +1541,7 @@ test wm-stackorder-5.3 {An overrideredirect window\ } -result 1 test wm-stackorder-6.1 {An embedded toplevel does not\ - appear in the stacking order} -body { + appear in the stacking order} -constraints !aqua -body { toplevel .real -container 1 toplevel .embd -bg blue -use [winfo id .real] update -- cgit v0.12 From ce1d175a1627d9e2010cbe0e186bc80bb0c79aa9 Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 7 Dec 2018 17:04:42 +0000 Subject: Give overrideredirect windows CollectionBehaviors so they do not try to become FullScreen, but can appear on top of a FullScreen window. --- macosx/tkMacOSXWindowEvent.c | 1 - macosx/tkMacOSXWm.c | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c index a07ef15..ad6af30 100644 --- a/macosx/tkMacOSXWindowEvent.c +++ b/macosx/tkMacOSXWindowEvent.c @@ -176,7 +176,6 @@ extern NSString *NSWindowDidOrderOffScreenNotification; * be sized to the screen's visibleFrame, leaving black bands at * the top and bottom. */ - return proposedSize; } diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 8ef322b..3ccf1b3 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6511,16 +6511,21 @@ ApplyWindowAttributeFlagChanges( #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) if (!(macWindow.styleMask & NSUtilityWindowMask)) { - NSSize screenSize = [[macWindow screen]frame].size; - b |= NSWindowCollectionBehaviorFullScreenPrimary; + if (winPtr->atts.override_redirect) { + b |= (NSWindowCollectionBehaviorCanJoinAllSpaces | + NSWindowCollectionBehaviorFullScreenAuxiliary); + } else { + NSSize screenSize = [[macWindow screen]frame].size; + b |= NSWindowCollectionBehaviorFullScreenPrimary; - /* The default max size has height less than the screen height. - * This causes the window manager to refuse to allow the window - * to be resized when it is a split window. To work around - * this we make the max size equal to the screen size. - */ + /* The default max size has height less than the screen height. + * This causes the window manager to refuse to allow the window + * to be resized when it is a split window. To work around + * this we make the max size equal to the screen size. + */ - [macWindow setMaxFullScreenContentSize:screenSize]; + [macWindow setMaxFullScreenContentSize:screenSize]; + } } #endif -- cgit v0.12 From d076d10caa0719bc1a1626281c24bc33dfd624a4 Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 7 Dec 2018 18:22:34 +0000 Subject: Fix constraint name. !aqua is not a known constraint (the test was skipped in all platforms), however notAqua is known and lets the test run in anything else than aqua. --- tests/wm.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/wm.test b/tests/wm.test index d8b1c04..ad01b7d 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1517,7 +1517,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ - overrideredirect toplevel} -constraints !aqua -body { + overrideredirect toplevel} -constraints notAqua -body { toplevel .t wm overrideredirect .t 1 raise . @@ -1541,7 +1541,7 @@ test wm-stackorder-5.3 {An overrideredirect window\ } -result 1 test wm-stackorder-6.1 {An embedded toplevel does not\ - appear in the stacking order} -constraints !aqua -body { + appear in the stacking order} -constraints notAqua -body { toplevel .real -container 1 toplevel .embd -bg blue -use [winfo id .real] update -- cgit v0.12 From d2012724b16532a0594432171a2ea54a9bace17b Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 7 Dec 2018 19:18:38 +0000 Subject: Refine tests wm-stackorder-5.2 and -6.1 to run a test of the behavior on all platforms (the expected results are different on different platforms) --- tests/wm.test | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/wm.test b/tests/wm.test index ad01b7d..30b6553 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1517,8 +1517,9 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ - overrideredirect toplevel} -constraints notAqua -body { + overrideredirect toplevel on unix} -constraints unix -body { toplevel .t + tkwait visibility .t wm overrideredirect .t 1 raise . update @@ -1527,6 +1528,18 @@ test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ } -cleanup { destroy .t } -result 0 +test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ + overrideredirect toplevel on macOS or win} -constraints aquaOrWin32 -body { + toplevel .t + tkwait visibility .t + wm overrideredirect .t 1 + raise . + update + raiseDelay + wm stackorder . isabove .t +} -cleanup { + destroy .t +} -result 1 test wm-stackorder-5.3 {An overrideredirect window\ can be explicitly lowered} -body { toplevel .t @@ -1541,7 +1554,7 @@ test wm-stackorder-5.3 {An overrideredirect window\ } -result 1 test wm-stackorder-6.1 {An embedded toplevel does not\ - appear in the stacking order} -constraints notAqua -body { + appear in the stacking order on unix or win} -constraints notAqua -body { toplevel .real -container 1 toplevel .embd -bg blue -use [winfo id .real] update @@ -1549,6 +1562,15 @@ test wm-stackorder-6.1 {An embedded toplevel does not\ } -cleanup { deleteWindows } -result {. .real} +test wm-stackorder-6.1.1 {An embedded toplevel does\ + appear in the stacking order on macOS} -constraints aqua -body { + toplevel .real -container 1 + toplevel .embd -bg blue -use [winfo id .real] + update + wm stackorder . +} -cleanup { + deleteWindows +} -result {. .embd} stdWindow -- cgit v0.12 From b8cf9c7dcf74f1608c10559d77b394c2e9d75aec Mon Sep 17 00:00:00 2001 From: fvogel Date: Fri, 7 Dec 2018 21:30:55 +0000 Subject: Fix error on constraint name: unix is not x11 --- tests/wm.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wm.test b/tests/wm.test index 30b6553..f56eaa7 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -1517,7 +1517,7 @@ test wm-stackorder-5.1 {a menu is not a toplevel} -body { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ - overrideredirect toplevel on unix} -constraints unix -body { + overrideredirect toplevel on unix} -constraints x11 -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 -- cgit v0.12 From 699c6d8d3a33f573176f71808958097077a0ad39 Mon Sep 17 00:00:00 2001 From: Kevin Walzer Date: Sat, 8 Dec 2018 03:08:58 +0000 Subject: Remove overrideredirect, transient, and help-styled windows from fullscreen API --- macosx/tkMacOSXWm.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index 3ccf1b3..f761a68 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -5440,21 +5440,6 @@ WmWinStyle( { "moveToActiveSpace", tkMoveToActiveSpaceAttribute }, { "nonActivating", tkNonactivatingPanelAttribute }, { "hud", tkHUDWindowAttribute }, - { "black", 0 }, - { "dark", 0 }, - { "light", 0 }, - { "gray", 0 }, - { "red", 0 }, - { "green", 0 }, - { "blue", 0 }, - { "cyan", 0 }, - { "yellow", 0 }, - { "magenta", 0 }, - { "orange", 0 }, - { "purple", 0 }, - { "brown", 0 }, - { "clear", 0 }, - { "opacity", 0 }, { NULL } }; @@ -5536,10 +5521,8 @@ WmWinStyle( macClassAttrs[macClass].validAttrs); wmPtr->flags |= macClassAttrs[macClass].flags; wmPtr->macClass = macClass; - ApplyWindowAttributeFlagChanges(winPtr, NULL, oldAttributes, oldFlags, 0, 1); - return TCL_OK; badClassAttrs: @@ -6511,7 +6494,14 @@ ApplyWindowAttributeFlagChanges( #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) if (!(macWindow.styleMask & NSUtilityWindowMask)) { - if (winPtr->atts.override_redirect) { + + /* + * Exclude overrideredirect, transient, and "help"-styled + * windows from moving into their own fullscreen space. + * + */ + + if ((winPtr->atts.override_redirect) || (wmPtr->master != None) || (winPtr->wmInfoPtr->macClass == kHelpWindowClass)) { b |= (NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary); } else { -- cgit v0.12 From 14082f2521396ab5e9525d6d1ce4312886b3f480 Mon Sep 17 00:00:00 2001 From: culler Date: Sat, 8 Dec 2018 16:25:48 +0000 Subject: On Aqua, tests should wait for the animation to finish before checking the geometry of a newly iconified window. --- macosx/tkMacOSXWm.c | 10 ++++++---- tests/unixWm.test | 11 +++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index f761a68..d95ce03 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6494,14 +6494,16 @@ ApplyWindowAttributeFlagChanges( #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) if (!(macWindow.styleMask & NSUtilityWindowMask)) { - + /* * Exclude overrideredirect, transient, and "help"-styled - * windows from moving into their own fullscreen space. + * windows from moving into their own fullscreen space. * */ - - if ((winPtr->atts.override_redirect) || (wmPtr->master != None) || (winPtr->wmInfoPtr->macClass == kHelpWindowClass)) { + + if ((winPtr->atts.override_redirect) || + (wmPtr->master != None) || + (winPtr->wmInfoPtr->macClass == kHelpWindowClass)) { b |= (NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary); } else { diff --git a/tests/unixWm.test b/tests/unixWm.test index d579fc7..dfb3d0b 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -19,6 +19,14 @@ proc sleep ms { vwait x } +# Recent versions of macOS show an animation when a window is deiconified. +# Tests which check the geometry of a window after deiconifying it should +# wait for the animation to finish. + +proc deiconifyDelay {} { + sleep 250 +} + # Procedure to set up a collection of top-level windows proc makeToplevels {} { @@ -76,6 +84,7 @@ foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} { wm geom .t $geom update wm deiconify .t + deiconifyDelay scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \ [eval expr $y$ysign$yerr] @@ -91,6 +100,7 @@ foreach geom {+20+80 +100+40 +0+0} { wm geom .t $geom update wm deiconify .t + deiconifyDelay wm geom .t } 100x150$geom incr i @@ -401,6 +411,7 @@ test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix { sleep 500 toplevel .t -width 100 -height 50 -bg blue wm iconwindow . .t + sleep 200 update set result [winfo ismapped .t] } {0} -- cgit v0.12 From 77ac411b0567500011861bcbe1063774926561a9 Mon Sep 17 00:00:00 2001 From: culler Date: Sun, 9 Dec 2018 16:42:47 +0000 Subject: Aqua: Fix some subtle bugs in wm geometry. Fix the iconwindow implementation. Adjust some unixWm tests. --- macosx/tkMacOSXWm.c | 98 +++++++++++++++++++++++++++++++++-------------------- tests/unixWm.test | 42 +++++++++++++++-------- 2 files changed, 88 insertions(+), 52 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index d95ce03..fc6cab7 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -1762,6 +1762,9 @@ WmDeiconifyCmd( [win setExcludedFromWindowsMenu:NO]; TkMacOSXApplyWindowAttributes(winPtr, win); [win orderFront:nil]; + if (wmPtr->icon) { + Tk_UnmapWindow((Tk_Window)wmPtr->icon); + } return TCL_OK; } @@ -2281,6 +2284,9 @@ WmIconifyCmd( } TkpWmSetState(winPtr, IconicState); + if (wmPtr->icon) { + Tk_MapWindow((Tk_Window)wmPtr->icon); + } return TCL_OK; } @@ -2599,8 +2605,17 @@ WmIconwindowCmd( return TCL_ERROR; } if (wmPtr->icon != NULL) { - WmInfo *wmPtr3 = ((TkWindow *) wmPtr->icon)->wmInfoPtr; + TkWindow *oldIcon = (TkWindow *)wmPtr->icon; + WmInfo *wmPtr3 = oldIcon->wmInfoPtr; + NSWindow *win = TkMacOSXDrawableWindow(oldIcon->window); + /* + * The old icon should be withdrawn. + */ + + TkpWmSetState(oldIcon, WithdrawnState); + [win orderOut:nil]; + [win setExcludedFromWindowsMenu:YES]; wmPtr3->iconFor = NULL; } Tk_MakeWindowExist(tkwin2); @@ -2609,11 +2624,16 @@ WmIconwindowCmd( wmPtr->icon = tkwin2; wmPtr2->iconFor = (Tk_Window) winPtr; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { + /* - * Don't have iconwindows on the Mac. We just withdraw. + * If the window is in normal or zoomed state, the icon should be + * unmapped. */ - Tk_UnmapWindow(tkwin2); + if (wmPtr->hints.initial_state == NormalState || + wmPtr->hints.initial_state == ZoomState) { + Tk_UnmapWindow(tkwin2); + } } } return TCL_OK; @@ -3493,6 +3513,7 @@ WmTransientCmd( } TkWindow* masterPtr = (TkWindow*) master; while (!Tk_TopWinHierarchy(masterPtr)) { + /* * Ensure that the master window is actually a Tk toplevel. */ @@ -3963,27 +3984,8 @@ UpdateGeometryInfo( } else if ((max > 0) && (height > max)) { height = max; } - - /* - * Compute the new position for the upper-left pixel of the window's - * decorative frame. This is tricky, because we need to include the border - * widths supplied by a reparented parent in this calculation, but can't - * use the parent's current overall size since that may change as a result - * of this code. - */ - - if (wmPtr->flags & WM_NEGATIVE_X) { - x = wmPtr->vRootWidth - wmPtr->x - - (width + (wmPtr->parentWidth - winPtr->changes.width)); - } else { - x = wmPtr->x; - } - if (wmPtr->flags & WM_NEGATIVE_Y) { - y = wmPtr->vRootHeight - wmPtr->y - - (height + (wmPtr->parentHeight - winPtr->changes.height)); - } else { - y = wmPtr->y; - } + x = wmPtr->x; + y = wmPtr->y; /* * If the window's size is going to change and the window is supposed to @@ -4144,8 +4146,8 @@ ParseGeometry( width = wmPtr->width; height = wmPtr->height; - x = wmPtr->x; - y = wmPtr->y; + x = -1; + y = -1; flags = wmPtr->flags; if (isdigit(UCHAR(*p))) { width = strtoul(p, &end, 10); @@ -4209,22 +4211,44 @@ ParseGeometry( * Everything was parsed OK. Update the fields of *wmPtr and arrange for * the appropriate information to be percolated out to the window manager * at the next idle moment. + * + * Computing the new position for the upper-left pixel of the window's + * decorative frame is tricky because we need to include the border + * widths supplied by a reparented parent in the calculation, but we can't + * use the parent's current overall size since that may change as a result + * of this code. */ wmPtr->width = width; wmPtr->height = height; - if ((x != wmPtr->x) || (y != wmPtr->y) - || ((flags & (WM_NEGATIVE_X|WM_NEGATIVE_Y)) - != (wmPtr->flags & (WM_NEGATIVE_X|WM_NEGATIVE_Y)))) { - if (wmPtr->flags & WM_FULLSCREEN) { - wmPtr->configX = x; - wmPtr->configY = y; - } else { - wmPtr->x = x; - wmPtr->y = y; - } - flags |= WM_MOVE_PENDING; + if (flags & WM_NEGATIVE_X) { + int borderwidth = wmPtr->parentWidth - winPtr->changes.width; + int newWidth = width == -1 ? winPtr->changes.width : width; + x = (x == -1) ? + wmPtr->x + winPtr->changes.width - newWidth : + wmPtr->vRootWidth - x - newWidth - borderwidth; + } + if (x == -1) { + x = wmPtr->x; + } + if (flags & WM_NEGATIVE_Y) { + int borderheight = wmPtr->parentHeight - winPtr->changes.height; + int newHeight = height == -1 ? winPtr->changes.height : height; + y = (y == -1) ? + wmPtr->y + winPtr->changes.height - newHeight : + wmPtr->vRootHeight - y - newHeight - borderheight; + } + if (y == -1) { + y = wmPtr->y; + } + if (wmPtr->flags & WM_FULLSCREEN) { + wmPtr->configX = x; + wmPtr->configY = y; + } else { + wmPtr->x = x; + wmPtr->y = y; } + flags |= WM_MOVE_PENDING; wmPtr->flags = flags; if (!(wmPtr->flags & (WM_UPDATE_PENDING|WM_NEVER_MAPPED))) { Tcl_DoWhenIdle(UpdateGeometryInfo, winPtr); diff --git a/tests/unixWm.test b/tests/unixWm.test index dfb3d0b..6f1c94b 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -23,8 +23,8 @@ proc sleep ms { # Tests which check the geometry of a window after deiconifying it should # wait for the animation to finish. -proc deiconifyDelay {} { - sleep 250 +proc animationDelay {} { + sleep 500 } # Procedure to set up a collection of top-level windows @@ -84,7 +84,7 @@ foreach geom {+20+80 +80+20 +0+0 -0-0 +0-0 -0+0 -10-5 -10+5 +10-5} { wm geom .t $geom update wm deiconify .t - deiconifyDelay + animationDelay scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \ [eval expr $y$ysign$yerr] @@ -100,7 +100,7 @@ foreach geom {+20+80 +100+40 +0+0} { wm geom .t $geom update wm deiconify .t - deiconifyDelay + animationDelay wm geom .t } 100x150$geom incr i @@ -410,8 +410,8 @@ test unixWm-9.4 {TkWmMapWindow procedure, icon windows} unix { destroy .t sleep 500 toplevel .t -width 100 -height 50 -bg blue + tkwait visibility .t wm iconwindow . .t - sleep 200 update set result [winfo ismapped .t] } {0} @@ -806,9 +806,14 @@ test unixWm-22.2 {Tk_WmCmd procedure, "iconbitmap" option} {unix testwrapper} { WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit } {{} questhead 0x4 {} 0x0} -test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option} unix { +test unixWm-22.3.1 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \ +{unix notAqua} { list [catch {wm iconbitmap .t bad-bitmap} msg] $msg } {1 {bitmap "bad-bitmap" not defined}} +test unixWm-22.3.2 {Tk_WmCmd procedure, "iconbitmap" option for Aqua only} \ +Aqua { + list [catch {wm iconbitmap .t bad-bitmap} msg] $msg +} {1 {}} test unixWm-23.1 {Tk_WmCmd procedure, "iconify" option} unix { list [catch {wm iconify .t 12} msg] $msg @@ -1212,9 +1217,12 @@ test unixWm-34.3 {Tk_WmCmd procedure, "sizefrom" option} unix { list [catch {wm sizefrom .t none} msg] $msg } {1 {bad argument "none": must be program or user}} -test unixWm-35.1 {Tk_WmCmd procedure, "state" option} unix { +test unixWm-35.1.1 {Tk_WmCmd procedure, "state" option} {unix notAqua} { list [catch {wm state .t 1} msg] $msg } {1 {bad argument "1": must be normal, iconic, or withdrawn}} +test unixWm-35.1.2 {Tk_WmCmd procedure, "state" option} Aqua { + list [catch {wm state .t 1} msg] $msg +} {1 {bad argument "1": must be normal, iconic, withdrawn, or zoomed}} test unixWm-35.2 {Tk_WmCmd procedure, "state" option} unix { list [catch {wm state .t iconic 1} msg] $msg } {1 {wrong # args: should be "wm state window ?state?"}} @@ -1426,9 +1434,11 @@ test unixWm-42.1 {WrapperEventProc procedure, map and unmap events} unix { bind .t {set x "unmapped"} set x {no event} wm iconify .t + animationDelay lappend result $x [winfo ismapped .t] set x {no event} wm deiconify .t + animationDelay lappend result $x [winfo ismapped .t] } {unmapped 0 mapped 1} @@ -1518,9 +1528,9 @@ test unixWm-44.5 {UpdateGeometryInfo procedure, negative width} unix { update list [winfo width .t] [winfo height .t] } {1 72} +destroy .t +toplevel .t -width 80 -height 60 test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix { - destroy .t - toplevel .t -width 80 -height 60 wm grid .t 18 7 10 12 wm geometry .t +30+40 wm overrideredirect .t 1 @@ -1529,22 +1539,24 @@ test unixWm-44.6 {UpdateGeometryInfo procedure, negative height} unix { update list [winfo width .t] [winfo height .t] } {100 1} - destroy .t toplevel .t -width 80 -height 60 test unixWm-44.7 {UpdateGeometryInfo procedure, computing position} unix { - wm geometry .t +5-10 - wm overrideredirect .t 1 tkwait visibility .t + wm overrideredirect .t 1 + update + wm geometry .t +5-10 + update list [winfo x .t] [winfo y .t] } [list 5 [expr [winfo screenheight .t] - 70]] - destroy .t toplevel .t -width 80 -height 60 test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix { - wm geometry .t -30+2 - wm overrideredirect .t 1 tkwait visibility .t + wm overrideredirect .t 1 + update + wm geometry .t -30+2 + update list [winfo x .t] [winfo y .t] } [list [expr [winfo screenwidth .t] - 110] 2] destroy .t -- cgit v0.12 From 91766cbfd1a4af5e5df1bde664f65ec7cde7ed19 Mon Sep 17 00:00:00 2001 From: culler Date: Mon, 10 Dec 2018 19:18:47 +0000 Subject: Don't force other platforms to wait for the aqua animations to finish. --- tests/unixWm.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unixWm.test b/tests/unixWm.test index 6f1c94b..d85b7e2 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -13,11 +13,11 @@ tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand -proc sleep ms { - global x - after $ms {set x 1} - vwait x -} + proc animationDelay {} { + if {[tk windowingsystem] == "aqua"} { + sleep 250 + } + } # Recent versions of macOS show an animation when a window is deiconified. # Tests which check the geometry of a window after deiconifying it should -- cgit v0.12 From 3deab41767b92c500aa9f57d9905827e2ad6629e Mon Sep 17 00:00:00 2001 From: culler Date: Mon, 10 Dec 2018 21:03:22 +0000 Subject: Fix cut-and-paste error. --- tests/unixWm.test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/unixWm.test b/tests/unixWm.test index d85b7e2..da324bb 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -13,19 +13,21 @@ tcltest::loadTestedCommands namespace import -force ::tk::test:loadTkCommand - proc animationDelay {} { - if {[tk windowingsystem] == "aqua"} { - sleep 250 - } - } +proc sleep ms { + global x + after $ms {set x 1} + vwait x +} # Recent versions of macOS show an animation when a window is deiconified. # Tests which check the geometry of a window after deiconifying it should # wait for the animation to finish. -proc animationDelay {} { - sleep 500 -} + proc animationDelay {} { + if {[tk windowingsystem] == "aqua"} { + sleep 250 + } + } # Procedure to set up a collection of top-level windows -- cgit v0.12 From 46f185860fa00ffdd16e76a376385374bff03596 Mon Sep 17 00:00:00 2001 From: culler Date: Tue, 11 Dec 2018 16:18:28 +0000 Subject: On OSX 10.6 the styleMask must be cleared to get rid of the title bar. Fix a compiler error on 10.9. --- macosx/tkMacOSXWm.c | 19 +++++++++++++++---- tests/unixWm.test | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c index fc6cab7..5cf0820 100644 --- a/macosx/tkMacOSXWm.c +++ b/macosx/tkMacOSXWm.c @@ -6513,10 +6513,10 @@ ApplyWindowAttributeFlagChanges( * This behavior, which makes the green button expand a window to * full screen, was included in the default as of OSX 10.13. For * uniformity we use the new default in all versions of the OS - * where the behavior exists. + * after 10.10. */ -#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 1070) +#if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101000) if (!(macWindow.styleMask & NSUtilityWindowMask)) { /* @@ -6620,7 +6620,11 @@ ApplyMasterOverrideChanges( wmPtr->attributes = macClassAttrs[kSimpleWindowClass].defaultAttrs; } wmPtr->attributes |= kWindowNoActivatesAttribute; - styleMask &= ~NSTitledWindowMask; + if ([NSApp macMinorVersion] == 6) { + styleMask = 0; + } else { + styleMask &= ~NSTitledWindowMask; + } } else { if (wmPtr->macClass == kSimpleWindowClass && oldAttributes == kWindowNoActivatesAttribute) { @@ -6629,7 +6633,14 @@ ApplyMasterOverrideChanges( macClassAttrs[kDocumentWindowClass].defaultAttrs; } wmPtr->attributes &= ~kWindowNoActivatesAttribute; - styleMask |= NSTitledWindowMask; + if ([NSApp macMinorVersion] == 6) { + styleMask = NSTitledWindowMask | + NSClosableWindowMask | + NSMiniaturizableWindowMask | + NSResizableWindowMask; + } else { + styleMask |= NSTitledWindowMask; + } } if (macWindow) { NSWindow *parentWindow = [macWindow parentWindow]; diff --git a/tests/unixWm.test b/tests/unixWm.test index da324bb..a0224a1 100644 --- a/tests/unixWm.test +++ b/tests/unixWm.test @@ -19,7 +19,7 @@ proc sleep ms { vwait x } -# Recent versions of macOS show an animation when a window is deiconified. +# The macOS window manager shows an animation when a window is deiconified. # Tests which check the geometry of a window after deiconifying it should # wait for the animation to finish. -- cgit v0.12