Commit f2eb6885 authored by andersca@apple.com's avatar andersca@apple.com

2011-04-06 Anders Carlsson <andersca@apple.com>

        Reviewed by Oliver Hunt.

        Dock stays in front of Hulu.com full screen video output
        https://bugs.webkit.org/show_bug.cgi?id=57988
        <rdar://problem/9216260>

        Instead of using -[NSMenu setMenuBarVisible:] to toggle full screen, use
        -[NSApp setPresentationOptions:]. Also, make the UI process the front most app before
        setting the presentation options when exiting full screen, otherwise the dock won't
        be restored correctly.

        * PluginProcess/mac/PluginProcessShim.mm:
        Remove some shim functions that aren't needed.

        * UIProcess/Plugins/PluginProcessProxy.cpp:
        (WebKit::PluginProcessProxy::PluginProcessProxy):
        Initialize m_preFullscreenAppPresentationOptions.

        * UIProcess/Plugins/PluginProcessProxy.h:
        Add m_preFullscreenAppPresentationOptions.

        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
        (WebKit::PluginProcessProxy::enterFullscreen):
        Change the presentation options for the app.

        (WebKit::PluginProcessProxy::exitFullscreen):
        Restore the presentation options.


git-svn-id: svn://svn.chromium.org/blink/trunk@83109 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 2cbd0777
2011-04-06 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver Hunt.
Dock stays in front of Hulu.com full screen video output
https://bugs.webkit.org/show_bug.cgi?id=57988
<rdar://problem/9216260>
Instead of using -[NSMenu setMenuBarVisible:] to toggle full screen, use
-[NSApp setPresentationOptions:]. Also, make the UI process the front most app before
setting the presentation options when exiting full screen, otherwise the dock won't
be restored correctly.
* PluginProcess/mac/PluginProcessShim.mm:
Remove some shim functions that aren't needed.
* UIProcess/Plugins/PluginProcessProxy.cpp:
(WebKit::PluginProcessProxy::PluginProcessProxy):
Initialize m_preFullscreenAppPresentationOptions.
* UIProcess/Plugins/PluginProcessProxy.h:
Add m_preFullscreenAppPresentationOptions.
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::enterFullscreen):
Change the presentation options for the app.
(WebKit::PluginProcessProxy::exitFullscreen):
Restore the presentation options.
2011-04-06 Mark Rowe <mrowe@apple.com> 2011-04-06 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler. Reviewed by Darin Adler.
......
...@@ -121,32 +121,6 @@ static void shimHideWindow(WindowRef window) ...@@ -121,32 +121,6 @@ static void shimHideWindow(WindowRef window)
HideWindow(window); HideWindow(window);
} }
static bool isMenuBarVisible = true;
static void shimShowMenuBar(void)
{
isMenuBarVisible = true;
ShowMenuBar();
}
static void shimHideMenuBar(void)
{
isMenuBarVisible = false;
// Make sure to make ourselves the front process
ProcessSerialNumber psn;
GetCurrentProcess(&psn);
SetFrontProcess(&psn);
HideMenuBar();
}
static Boolean shimIsMenuBarVisible(void)
{
return isMenuBarVisible;
}
DYLD_INTERPOSE(shimDebugger, Debugger); DYLD_INTERPOSE(shimDebugger, Debugger);
DYLD_INTERPOSE(shimGetCurrentEventButtonState, GetCurrentEventButtonState); DYLD_INTERPOSE(shimGetCurrentEventButtonState, GetCurrentEventButtonState);
DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive); DYLD_INTERPOSE(shimIsWindowActive, IsWindowActive);
...@@ -154,9 +128,6 @@ DYLD_INTERPOSE(shimModalDialog, ModalDialog); ...@@ -154,9 +128,6 @@ DYLD_INTERPOSE(shimModalDialog, ModalDialog);
DYLD_INTERPOSE(shimAlert, Alert); DYLD_INTERPOSE(shimAlert, Alert);
DYLD_INTERPOSE(shimShowWindow, ShowWindow); DYLD_INTERPOSE(shimShowWindow, ShowWindow);
DYLD_INTERPOSE(shimHideWindow, HideWindow); DYLD_INTERPOSE(shimHideWindow, HideWindow);
DYLD_INTERPOSE(shimShowMenuBar, ShowMenuBar)
DYLD_INTERPOSE(shimHideMenuBar, HideMenuBar)
DYLD_INTERPOSE(shimIsMenuBarVisible, IsMenuBarVisible);
#endif #endif
......
...@@ -51,6 +51,7 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage ...@@ -51,6 +51,7 @@ PluginProcessProxy::PluginProcessProxy(PluginProcessManager* PluginProcessManage
#if PLATFORM(MAC) #if PLATFORM(MAC)
, m_modalWindowIsShowing(false) , m_modalWindowIsShowing(false)
, m_fullscreenWindowIsShowing(false) , m_fullscreenWindowIsShowing(false)
, m_preFullscreenAppPresentationOptions(0)
#endif #endif
{ {
ProcessLauncher::LaunchOptions launchOptions; ProcessLauncher::LaunchOptions launchOptions;
......
...@@ -143,6 +143,7 @@ private: ...@@ -143,6 +143,7 @@ private:
RetainPtr<WKPlaceholderModalWindow *> m_placeholderWindow; RetainPtr<WKPlaceholderModalWindow *> m_placeholderWindow;
bool m_modalWindowIsShowing; bool m_modalWindowIsShowing;
bool m_fullscreenWindowIsShowing; bool m_fullscreenWindowIsShowing;
unsigned m_preFullscreenAppPresentationOptions;
#endif #endif
}; };
......
...@@ -105,30 +105,37 @@ void PluginProcessProxy::setFullscreenWindowIsShowing(bool fullscreenWindowIsSho ...@@ -105,30 +105,37 @@ void PluginProcessProxy::setFullscreenWindowIsShowing(bool fullscreenWindowIsSho
void PluginProcessProxy::enterFullscreen() void PluginProcessProxy::enterFullscreen()
{ {
[NSMenu setMenuBarVisible:NO]; // Get the current presentation options.
m_preFullscreenAppPresentationOptions = [NSApp presentationOptions];
// Figure out which presentation options to use.
unsigned presentationOptions = m_preFullscreenAppPresentationOptions & ~(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar);
presentationOptions |= NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
[NSApp setPresentationOptions:presentationOptions];
makePluginProcessTheFrontProcess(); makePluginProcessTheFrontProcess();
} }
void PluginProcessProxy::exitFullscreen() void PluginProcessProxy::exitFullscreen()
{ {
[NSMenu setMenuBarVisible:YES];
// If the plug-in host is the current application then we should bring ourselves to the front when it exits full-screen mode. // If the plug-in host is the current application then we should bring ourselves to the front when it exits full-screen mode.
ProcessSerialNumber frontProcessSerialNumber; ProcessSerialNumber frontProcessSerialNumber;
GetFrontProcess(&frontProcessSerialNumber); GetFrontProcess(&frontProcessSerialNumber);
Boolean isSameProcess = 0;
// The UI process must be the front process in order to change the presentation mode.
makeUIProcessTheFrontProcess();
[NSApp setPresentationOptions:m_preFullscreenAppPresentationOptions];
ProcessSerialNumber pluginProcessSerialNumber; ProcessSerialNumber pluginProcessSerialNumber;
if (!getPluginProcessSerialNumber(pluginProcessSerialNumber)) if (!getPluginProcessSerialNumber(pluginProcessSerialNumber))
return; return;
SameProcess(&frontProcessSerialNumber, &pluginProcessSerialNumber, &isSameProcess); // If the plug-in process was not the front process, switch back to the previous front process.
if (!isSameProcess) // (Otherwise we'll keep the UI process as the front process).
return; Boolean isPluginProcessFrontProcess;
SameProcess(&frontProcessSerialNumber, &pluginProcessSerialNumber, &isPluginProcessFrontProcess);
makeUIProcessTheFrontProcess(); if (!isPluginProcessFrontProcess)
SetFrontProcess(&frontProcessSerialNumber);
} }
void PluginProcessProxy::setModalWindowIsShowing(bool modalWindowIsShowing) void PluginProcessProxy::setModalWindowIsShowing(bool modalWindowIsShowing)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment