summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXWm.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2012-08-06 01:29:16 (GMT)
committerKevin Walzer <kw@codebykevin.com>2012-08-06 01:29:16 (GMT)
commit2f9056435312e3542fc2ecbf11e6cd98c264d7c4 (patch)
tree53ccee50223d509344d4934095cf76d5571ad22b /macosx/tkMacOSXWm.c
parentcb9575f44e80a63234981233f4288fd29be862f8 (diff)
downloadtk-2f9056435312e3542fc2ecbf11e6cd98c264d7c4.zip
tk-2f9056435312e3542fc2ecbf11e6cd98c264d7c4.tar.gz
tk-2f9056435312e3542fc2ecbf11e6cd98c264d7c4.tar.bz2
Fixes for menu and wm fullscreen bugs; thanks to Adrian Robert for patchesmistake__off_trunk
Diffstat (limited to 'macosx/tkMacOSXWm.c')
-rw-r--r--macosx/tkMacOSXWm.c62
1 files changed, 12 insertions, 50 deletions
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index f2cb572..9ac0369 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -6268,6 +6268,7 @@ TkMacOSXMakeFullscreen(
{
WmInfo *wmPtr = winPtr->wmInfoPtr;
int result = TCL_OK, wasFullscreen = (wmPtr->flags & WM_FULLSCREEN);
+ static unsigned long prevMask = 0, prevPres = 0;
if (fullscreen) {
int screenWidth = WidthOfScreen(Tk_Screen(winPtr));
@@ -6305,10 +6306,20 @@ TkMacOSXMakeFullscreen(
}
wmPtr->flags |= WM_FULLSCREEN;
}
+
+ prevMask = [window styleMask];
+ prevPres = [NSApp presentationOptions];
+ [window setStyleMask: NSBorderlessWindowMask];
+ [NSApp setPresentationOptions: NSApplicationPresentationAutoHideDock
+ | NSApplicationPresentationAutoHideMenuBar];
+
} else {
wmPtr->flags &= ~WM_FULLSCREEN;
+
+ [NSApp setPresentationOptions: prevPres];
+ [window setStyleMask: prevMask];
}
- TkMacOSXEnterExitFullscreen(winPtr, [window isKeyWindow]);
+
if (wasFullscreen && !(wmPtr->flags & WM_FULLSCREEN)) {
UInt64 oldAttributes = wmPtr->attributes;
NSRect bounds = NSMakeRect(wmPtr->configX, tkMacOSXZeroScreenHeight -
@@ -6330,55 +6341,6 @@ TkMacOSXMakeFullscreen(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXEnterExitFullscreen --
- *
- * This procedure enters or exits fullscreen mode if required.
- *
- * Results:
- * None.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-void
-TkMacOSXEnterExitFullscreen(
- TkWindow *winPtr,
- int active)
-{
- WmInfo *wmPtr = winPtr->wmInfoPtr;
- NSWindow *window = TkMacOSXDrawableWindow(winPtr->window);
- SystemUIMode mode;
- SystemUIOptions options;
-
- GetSystemUIMode(&mode, &options);
- if (window && wmPtr && (wmPtr->flags & WM_FULLSCREEN) && active) {
- static SystemUIMode fullscreenMode = 0;
- static SystemUIOptions fullscreenOptions = 0;
-
- if (!fullscreenMode) {
- fullscreenMode = kUIModeAllSuppressed;
- }
- if (mode != fullscreenMode) {
- ChkErr(SetSystemUIMode, fullscreenMode, fullscreenOptions);
- wmPtr->flags |= WM_SYNC_PENDING;
- [window setFrame:[window frameRectForContentRect:NSMakeRect(0, 0,
- WidthOfScreen(Tk_Screen(winPtr)),
- HeightOfScreen(Tk_Screen(winPtr)))] display:YES];
- wmPtr->flags &= ~WM_SYNC_PENDING;
- }
- } else {
- if (mode != kUIModeNormal) {
- ChkErr(SetSystemUIMode, kUIModeNormal, 0);
- }
- }
-}
-
-/*
- *----------------------------------------------------------------------
- *
* GetMinSize --
*
* This function computes the current minWidth and minHeight values for a