summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorculler <culler>2018-12-04 21:02:04 (GMT)
committerculler <culler>2018-12-04 21:02:04 (GMT)
commit22f49d639009f2cbb687a3a956d5f00eb7050948 (patch)
treef030d95afb46b0397129228cea455ec5da9960d6 /macosx
parente2f6659fcb092f12f8c407636d37b267e6792f48 (diff)
downloadtk-22f49d639009f2cbb687a3a956d5f00eb7050948.zip
tk-22f49d639009f2cbb687a3a956d5f00eb7050948.tar.gz
tk-22f49d639009f2cbb687a3a956d5f00eb7050948.tar.bz2
Fix bug[185c8557d9]: issues with overrideredirect and zoomed state
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXWindowEvent.c13
-rw-r--r--macosx/tkMacOSXWm.c33
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;
}