summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-08-08 10:56:04 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-08-08 10:56:04 (GMT)
commitfc4f66609d70b5e360ed06d1b0be0e54c0b5cac9 (patch)
tree1e832456672c8f3df4fbfe96b51e7d9c06f73427 /macosx
parent57697b5b22a5851bca41ba3ec058f1de355ba5dc (diff)
parent14cd8c272352eb6d51553f92ac67cf695304c56c (diff)
downloadtk-fc4f66609d70b5e360ed06d1b0be0e54c0b5cac9.zip
tk-fc4f66609d70b5e360ed06d1b0be0e54c0b5cac9.tar.gz
tk-fc4f66609d70b5e360ed06d1b0be0e54c0b5cac9.tar.bz2
merge trunk
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXMenu.c23
-rw-r--r--macosx/tkMacOSXWindowEvent.c1
-rw-r--r--macosx/tkMacOSXWm.c62
3 files changed, 26 insertions, 60 deletions
diff --git a/macosx/tkMacOSXMenu.c b/macosx/tkMacOSXMenu.c
index d6f9ef1..8054c57 100644
--- a/macosx/tkMacOSXMenu.c
+++ b/macosx/tkMacOSXMenu.c
@@ -669,20 +669,25 @@ TkpConfigureMenuEntry(
submenu = nil;
} else {
[submenu setTitle:title];
+
+ if ([menuItem isEnabled]) {
+ /* This menuItem might have been previously disabled (XXX:
+ track this), which would have disabled entries; we must
+ re-enable the entries here. */
+ int i = 0;
+ NSArray *itemArray = [submenu itemArray];
+ for (NSMenuItem *item in itemArray) {
+ TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i];
+ [item setEnabled: !(submePtr->state == ENTRY_DISABLED)];
+ i++;
+ }
+ }
+
}
}
}
[menuItem setSubmenu:submenu];
- /*Disabling parent menu disables entries; we must re-enable the entries here.*/
- NSArray *itemArray = [submenu itemArray];
-
- if ([menuItem isEnabled]) {
- for (NSMenuItem *item in itemArray) {
- [item setEnabled:YES];
- }
- }
-
return TCL_OK;
}
diff --git a/macosx/tkMacOSXWindowEvent.c b/macosx/tkMacOSXWindowEvent.c
index 48ac5b2..a05302f 100644
--- a/macosx/tkMacOSXWindowEvent.c
+++ b/macosx/tkMacOSXWindowEvent.c
@@ -417,7 +417,6 @@ GenerateActivateEvents(
{
TkGenerateActivateEvents(winPtr, activeFlag);
TkMacOSXGenerateFocusEvent(winPtr, activeFlag);
- TkMacOSXEnterExitFullscreen(winPtr, activeFlag);
return true;
}
diff --git a/macosx/tkMacOSXWm.c b/macosx/tkMacOSXWm.c
index 29def64..b651b3c 100644
--- a/macosx/tkMacOSXWm.c
+++ b/macosx/tkMacOSXWm.c
@@ -6332,6 +6332,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));
@@ -6370,10 +6371,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 -
@@ -6395,55 +6406,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