зеркало из https://github.com/mozilla/gecko-dev.git
Bug 484488 - MakeFullWindow support for windows mobile. r=olli.pettay, sr=vlad
This commit is contained in:
Родитель
4eddd594bc
Коммит
d210ca62c4
|
@ -2582,6 +2582,7 @@ SessionStoreService.prototype = {
|
||||||
_getWindowDimension: function sss_getWindowDimension(aWindow, aAttribute) {
|
_getWindowDimension: function sss_getWindowDimension(aWindow, aAttribute) {
|
||||||
if (aAttribute == "sizemode") {
|
if (aAttribute == "sizemode") {
|
||||||
switch (aWindow.windowState) {
|
switch (aWindow.windowState) {
|
||||||
|
case aWindow.STATE_FULLSCREEN:
|
||||||
case aWindow.STATE_MAXIMIZED:
|
case aWindow.STATE_MAXIMIZED:
|
||||||
return "maximized";
|
return "maximized";
|
||||||
case aWindow.STATE_MINIMIZED:
|
case aWindow.STATE_MINIMIZED:
|
||||||
|
|
|
@ -148,7 +148,6 @@
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
#include "nsDOMClassInfo.h"
|
#include "nsDOMClassInfo.h"
|
||||||
#include "nsIJSNativeInitializer.h"
|
#include "nsIJSNativeInitializer.h"
|
||||||
#include "nsIFullScreen.h"
|
|
||||||
#include "nsIScriptError.h"
|
#include "nsIScriptError.h"
|
||||||
#include "nsIScriptEventManager.h" // For GetInterface()
|
#include "nsIScriptEventManager.h" // For GetInterface()
|
||||||
#include "nsIConsoleService.h"
|
#include "nsIConsoleService.h"
|
||||||
|
@ -603,7 +602,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||||
: nsPIDOMWindow(aOuterWindow),
|
: nsPIDOMWindow(aOuterWindow),
|
||||||
mIsFrozen(PR_FALSE),
|
mIsFrozen(PR_FALSE),
|
||||||
mDidInitJavaProperties(PR_FALSE),
|
mDidInitJavaProperties(PR_FALSE),
|
||||||
mFullScreen(PR_FALSE),
|
|
||||||
mIsClosed(PR_FALSE),
|
mIsClosed(PR_FALSE),
|
||||||
mInClose(PR_FALSE),
|
mInClose(PR_FALSE),
|
||||||
mHavePendingClose(PR_FALSE),
|
mHavePendingClose(PR_FALSE),
|
||||||
|
@ -2113,29 +2111,6 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
|
||||||
langCtx->ClearScope(mScriptGlobals[NS_STID_INDEX(lang_id)], PR_TRUE);
|
langCtx->ClearScope(mScriptGlobals[NS_STID_INDEX(lang_id)], PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we are closing the window while in full screen mode, be sure
|
|
||||||
// to restore os chrome
|
|
||||||
if (mFullScreen) {
|
|
||||||
// only restore OS chrome if the closing window was active
|
|
||||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
|
||||||
if (fm) {
|
|
||||||
nsCOMPtr<nsIDOMWindow> activeWindow;
|
|
||||||
fm->GetActiveWindow(getter_AddRefs(activeWindow));
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(mDocShell);
|
|
||||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
|
||||||
treeItem->GetRootTreeItem(getter_AddRefs(rootItem));
|
|
||||||
nsCOMPtr<nsIDOMWindow> rootWin = do_GetInterface(rootItem);
|
|
||||||
if (rootWin == activeWindow) {
|
|
||||||
nsCOMPtr<nsIFullScreen> fullScreen =
|
|
||||||
do_GetService("@mozilla.org/browser/fullscreen;1");
|
|
||||||
|
|
||||||
if (fullScreen)
|
|
||||||
fullScreen->ShowAllOSChrome();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ClearControllers();
|
ClearControllers();
|
||||||
|
|
||||||
mChromeEventHandler = nsnull; // force release now
|
mChromeEventHandler = nsnull; // force release now
|
||||||
|
@ -3844,8 +3819,6 @@ nsGlobalWindow::SetFullScreen(PRBool aFullScreen)
|
||||||
if (widget)
|
if (widget)
|
||||||
widget->MakeFullScreen(aFullScreen);
|
widget->MakeFullScreen(aFullScreen);
|
||||||
|
|
||||||
mFullScreen = aFullScreen;
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3867,8 +3840,13 @@ nsGlobalWindow::GetFullScreen(PRBool* aFullScreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are the root window, or something went wrong. Return our internal value.
|
nsCOMPtr<nsIWidget> widget = GetMainWidget();
|
||||||
*aFullScreen = mFullScreen;
|
PRInt32 mode;
|
||||||
|
if (!widget)
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
widget->GetSizeMode(&mode);
|
||||||
|
*aFullScreen = mode == nsSizeMode_Fullscreen;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6591,20 +6569,6 @@ nsGlobalWindow::GetLocation(nsIDOMLocation ** aLocation)
|
||||||
void
|
void
|
||||||
nsGlobalWindow::ActivateOrDeactivate(PRBool aActivate)
|
nsGlobalWindow::ActivateOrDeactivate(PRBool aActivate)
|
||||||
{
|
{
|
||||||
// if the window is deactivated while in full screen mode,
|
|
||||||
// restore OS chrome, and hide it again upon re-activation
|
|
||||||
nsGlobalWindow* outer = GetOuterWindowInternal();
|
|
||||||
if (outer && outer->mFullScreen) {
|
|
||||||
nsCOMPtr<nsIFullScreen> fullScreen =
|
|
||||||
do_GetService("@mozilla.org/browser/fullscreen;1");
|
|
||||||
if (fullScreen) {
|
|
||||||
if (aActivate)
|
|
||||||
fullScreen->HideAllOSChrome();
|
|
||||||
else
|
|
||||||
fullScreen->ShowAllOSChrome();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set / unset the "active" attribute on the documentElement
|
// Set / unset the "active" attribute on the documentElement
|
||||||
// of the top level window
|
// of the top level window
|
||||||
nsCOMPtr<nsIWidget> mainWidget = GetMainWidget();
|
nsCOMPtr<nsIWidget> mainWidget = GetMainWidget();
|
||||||
|
@ -8767,6 +8731,9 @@ nsGlobalChromeWindow::GetWindowState(PRUint16* aWindowState)
|
||||||
case nsSizeMode_Maximized:
|
case nsSizeMode_Maximized:
|
||||||
*aWindowState = nsIDOMChromeWindow::STATE_MAXIMIZED;
|
*aWindowState = nsIDOMChromeWindow::STATE_MAXIMIZED;
|
||||||
break;
|
break;
|
||||||
|
case nsSizeMode_Fullscreen:
|
||||||
|
*aWindowState = nsIDOMChromeWindow::STATE_FULLSCREEN;
|
||||||
|
break;
|
||||||
case nsSizeMode_Normal:
|
case nsSizeMode_Normal:
|
||||||
*aWindowState = nsIDOMChromeWindow::STATE_NORMAL;
|
*aWindowState = nsIDOMChromeWindow::STATE_NORMAL;
|
||||||
break;
|
break;
|
||||||
|
@ -8797,16 +8764,8 @@ nsGlobalChromeWindow::Minimize()
|
||||||
nsCOMPtr<nsIWidget> widget = GetMainWidget();
|
nsCOMPtr<nsIWidget> widget = GetMainWidget();
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (widget) {
|
if (widget)
|
||||||
// minimize doesn't send deactivate events on windows,
|
|
||||||
// so we need to forcefully restore the os chrome
|
|
||||||
nsCOMPtr<nsIFullScreen> fullScreen =
|
|
||||||
do_GetService("@mozilla.org/browser/fullscreen;1");
|
|
||||||
if (fullScreen)
|
|
||||||
fullScreen->ShowAllOSChrome();
|
|
||||||
|
|
||||||
rv = widget->SetSizeMode(nsSizeMode_Minimized);
|
rv = widget->SetSizeMode(nsSizeMode_Minimized);
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,7 +670,6 @@ protected:
|
||||||
|
|
||||||
// These members are only used on outer window objects. Make sure
|
// These members are only used on outer window objects. Make sure
|
||||||
// you never set any of these on an inner object!
|
// you never set any of these on an inner object!
|
||||||
PRPackedBool mFullScreen : 1;
|
|
||||||
PRPackedBool mIsClosed : 1;
|
PRPackedBool mIsClosed : 1;
|
||||||
PRPackedBool mInClose : 1;
|
PRPackedBool mInClose : 1;
|
||||||
// mHavePendingClose means we've got a termination function set to
|
// mHavePendingClose means we've got a termination function set to
|
||||||
|
|
|
@ -40,12 +40,13 @@
|
||||||
|
|
||||||
interface nsIBrowserDOMWindow;
|
interface nsIBrowserDOMWindow;
|
||||||
|
|
||||||
[scriptable, uuid(77a20f5a-68ad-41d3-97ac-6ff721512908)]
|
[scriptable, uuid(09A5E148-2A77-4739-9DD9-3D552F5390EE)]
|
||||||
interface nsIDOMChromeWindow : nsISupports
|
interface nsIDOMChromeWindow : nsISupports
|
||||||
{
|
{
|
||||||
const unsigned short STATE_MAXIMIZED = 1;
|
const unsigned short STATE_MAXIMIZED = 1;
|
||||||
const unsigned short STATE_MINIMIZED = 2;
|
const unsigned short STATE_MINIMIZED = 2;
|
||||||
const unsigned short STATE_NORMAL = 3;
|
const unsigned short STATE_NORMAL = 3;
|
||||||
|
const unsigned short STATE_FULLSCREEN = 4;
|
||||||
|
|
||||||
readonly attribute unsigned short windowState;
|
readonly attribute unsigned short windowState;
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,12 @@ relativesrcdir = dom/tests/mochitest/chrome
|
||||||
include $(DEPTH)/config/autoconf.mk
|
include $(DEPTH)/config/autoconf.mk
|
||||||
include $(topsrcdir)/config/rules.mk
|
include $(topsrcdir)/config/rules.mk
|
||||||
|
|
||||||
_TEST_FILES = test_domstorage.xul \
|
_TEST_FILES = \
|
||||||
|
test_fullscreen.xul \
|
||||||
|
fullscreen.xul \
|
||||||
|
test_fullscreen_preventdefault.xul \
|
||||||
|
fullscreen_preventdefault.xul \
|
||||||
|
test_domstorage.xul \
|
||||||
domstorage_global.xul \
|
domstorage_global.xul \
|
||||||
domstorage_global.js \
|
domstorage_global.js \
|
||||||
test_focus.xul \
|
test_focus.xul \
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||||
|
<!--
|
||||||
|
Test for fullscreen sizemode in chrome
|
||||||
|
-->
|
||||||
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
sizemode="fullscreen">
|
||||||
|
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
window.addEventListener("fullscreen", onFullScreen, true);
|
||||||
|
|
||||||
|
function onFullScreen()
|
||||||
|
{
|
||||||
|
window.opener.wrappedJSObject.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button id="find-button" label="Find"/>
|
||||||
|
<button id="cancel-button" label="Cancel"/>
|
||||||
|
|
||||||
|
</window>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||||
|
<!--
|
||||||
|
Test for fullscreen sizemode in chrome
|
||||||
|
-->
|
||||||
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
sizemode="fullscreen">
|
||||||
|
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
window.addEventListener("fullscreen", onFullScreen, true);
|
||||||
|
|
||||||
|
function onFullScreen(event)
|
||||||
|
{
|
||||||
|
event.preventDefault();
|
||||||
|
window.opener.wrappedJSObject.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button id="find-button" label="Find"/>
|
||||||
|
<button id="cancel-button" label="Cancel"/>
|
||||||
|
|
||||||
|
</window>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||||
|
<!--
|
||||||
|
Test for fullscreen sizemode in chrome
|
||||||
|
-->
|
||||||
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
sizemode="fullscreen">
|
||||||
|
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
newwindow = window.open("fullscreen.xul", "_blank","chrome,resizable=yes");
|
||||||
|
|
||||||
|
function done()
|
||||||
|
{
|
||||||
|
setTimeout("complete()", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function complete()
|
||||||
|
{
|
||||||
|
ok(newwindow.fullScreen, "window.fullScreen is true.");
|
||||||
|
newwindow.close();
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||||
|
|
||||||
|
</window>
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||||
|
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
|
||||||
|
<!--
|
||||||
|
Test for fullscreen sizemode in chrome
|
||||||
|
-->
|
||||||
|
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||||
|
sizemode="fullscreen">
|
||||||
|
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
newwindow = window.open("fullscreen_preventdefault.xul", "_blank","chrome,resizable=yes");
|
||||||
|
|
||||||
|
function done()
|
||||||
|
{
|
||||||
|
// because we are cancelling the fullscreen event, it
|
||||||
|
// takes a bit for the fullScreen property to be set
|
||||||
|
setTimeout("complete()", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function complete()
|
||||||
|
{
|
||||||
|
ok(!(newwindow.fullScreen), "window.fullScreen is false.");
|
||||||
|
newwindow.close();
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
||||||
|
|
||||||
|
</window>
|
|
@ -97,7 +97,6 @@ XPIDLSRCS = \
|
||||||
nsIRollupListener.idl \
|
nsIRollupListener.idl \
|
||||||
nsIBaseWindow.idl \
|
nsIBaseWindow.idl \
|
||||||
nsIBidiKeyboard.idl \
|
nsIBidiKeyboard.idl \
|
||||||
nsIFullScreen.idl \
|
|
||||||
nsIScreen.idl \
|
nsIScreen.idl \
|
||||||
nsIScreenManager.idl \
|
nsIScreenManager.idl \
|
||||||
nsIPrintSession.idl \
|
nsIPrintSession.idl \
|
||||||
|
|
|
@ -63,7 +63,8 @@ enum nsEventStatus {
|
||||||
enum nsSizeMode {
|
enum nsSizeMode {
|
||||||
nsSizeMode_Normal = 0,
|
nsSizeMode_Normal = 0,
|
||||||
nsSizeMode_Minimized,
|
nsSizeMode_Minimized,
|
||||||
nsSizeMode_Maximized
|
nsSizeMode_Maximized,
|
||||||
|
nsSizeMode_Fullscreen
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsEvent;
|
class nsEvent;
|
||||||
|
|
|
@ -1140,12 +1140,22 @@ NS_METHOD nsWindow::Show(PRBool bState)
|
||||||
if (!wasVisible && mWindowType == eWindowType_toplevel) {
|
if (!wasVisible && mWindowType == eWindowType_toplevel) {
|
||||||
switch (mSizeMode) {
|
switch (mSizeMode) {
|
||||||
#ifdef WINCE
|
#ifdef WINCE
|
||||||
|
case nsSizeMode_Fullscreen:
|
||||||
|
::SetForegroundWindow(mWnd);
|
||||||
|
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
||||||
|
MakeFullScreen(TRUE);
|
||||||
|
break;
|
||||||
|
|
||||||
case nsSizeMode_Maximized :
|
case nsSizeMode_Maximized :
|
||||||
::SetForegroundWindow(mWnd);
|
::SetForegroundWindow(mWnd);
|
||||||
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
||||||
break;
|
break;
|
||||||
// use default for nsSizeMode_Minimized on Windows CE
|
// use default for nsSizeMode_Minimized on Windows CE
|
||||||
#else
|
#else
|
||||||
|
case nsSizeMode_Fullscreen:
|
||||||
|
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
||||||
|
break;
|
||||||
|
|
||||||
case nsSizeMode_Maximized :
|
case nsSizeMode_Maximized :
|
||||||
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
::ShowWindow(mWnd, SW_SHOWMAXIMIZED);
|
||||||
break;
|
break;
|
||||||
|
@ -1497,6 +1507,10 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
switch (aMode) {
|
switch (aMode) {
|
||||||
|
case nsSizeMode_Fullscreen :
|
||||||
|
mode = SW_MAXIMIZE;
|
||||||
|
break;
|
||||||
|
|
||||||
case nsSizeMode_Maximized :
|
case nsSizeMode_Maximized :
|
||||||
mode = SW_MAXIMIZE;
|
mode = SW_MAXIMIZE;
|
||||||
break;
|
break;
|
||||||
|
@ -2303,6 +2317,27 @@ NS_METHOD nsWindow::Invalidate(const nsIntRect & aRect, PRBool aIsSynchronous)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsWindow::MakeFullScreen(PRBool aFullScreen)
|
||||||
|
{
|
||||||
|
#if WINCE
|
||||||
|
RECT rc;
|
||||||
|
if (aFullScreen) {
|
||||||
|
SetForegroundWindow(mWnd);
|
||||||
|
SHFullScreen(mWnd, SHFS_HIDETASKBAR | SHFS_HIDESTARTICON);
|
||||||
|
SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SHFullScreen(mWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSTARTICON);
|
||||||
|
SystemParametersInfo(SPI_GETWORKAREA, 0, &rc, FALSE);
|
||||||
|
}
|
||||||
|
MoveWindow(mWnd, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE);
|
||||||
|
return NS_OK;
|
||||||
|
#else
|
||||||
|
return nsBaseWidget::MakeFullScreen(aFullScreen);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
*
|
*
|
||||||
* SECTION: nsIWidget::Update
|
* SECTION: nsIWidget::Update
|
||||||
|
@ -4124,6 +4159,8 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||||
#else
|
#else
|
||||||
*aRetValue = 0;
|
*aRetValue = 0;
|
||||||
#endif
|
#endif
|
||||||
|
if (mSizeMode == nsSizeMode_Fullscreen)
|
||||||
|
MakeFullScreen(TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4283,7 +4320,7 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
||||||
else
|
else
|
||||||
event.mSizeMode = nsSizeMode_Normal;
|
event.mSizeMode = nsSizeMode_Normal;
|
||||||
#else
|
#else
|
||||||
event.mSizeMode = nsSizeMode_Normal;
|
event.mSizeMode = mSizeMode;
|
||||||
#endif
|
#endif
|
||||||
InitEvent(event);
|
InitEvent(event);
|
||||||
|
|
||||||
|
@ -6456,4 +6493,4 @@ DWORD ChildWindow::WindowStyle()
|
||||||
style |= WS_CHILD; // WS_POPUP and WS_CHILD are mutually exclusive.
|
style |= WS_CHILD; // WS_POPUP and WS_CHILD are mutually exclusive.
|
||||||
VERIFY_WINDOW_STYLE(style);
|
VERIFY_WINDOW_STYLE(style);
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ public:
|
||||||
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
||||||
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
PRUint32 aHotspotX, PRUint32 aHotspotY);
|
||||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||||
|
NS_IMETHOD MakeFullScreen(PRBool aFullScreen);
|
||||||
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
|
||||||
NS_IMETHOD Validate();
|
NS_IMETHOD Validate();
|
||||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||||
|
@ -519,4 +520,4 @@ protected:
|
||||||
virtual DWORD WindowStyle();
|
virtual DWORD WindowStyle();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // Window_h__
|
#endif // Window_h__
|
||||||
|
|
|
@ -315,7 +315,8 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode)
|
||||||
// on windows mobile, dialogs and top level windows are full screen
|
// on windows mobile, dialogs and top level windows are full screen
|
||||||
// This is partly due to the lack of a GetWindowPlacement.
|
// This is partly due to the lack of a GetWindowPlacement.
|
||||||
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel) {
|
if (mWindowType == eWindowType_dialog || mWindowType == eWindowType_toplevel) {
|
||||||
aMode = nsSizeMode_Maximized;
|
if (aMode == nsSizeMode_Normal)
|
||||||
|
aMode = nsSizeMode_Maximized;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -325,6 +326,7 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode)
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
switch (aMode) {
|
switch (aMode) {
|
||||||
|
case nsSizeMode_Fullscreen :
|
||||||
case nsSizeMode_Maximized :
|
case nsSizeMode_Maximized :
|
||||||
mode = SW_MAXIMIZE;
|
mode = SW_MAXIMIZE;
|
||||||
break;
|
break;
|
||||||
|
@ -433,4 +435,4 @@ PRBool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsGfxCIID.h"
|
#include "nsGfxCIID.h"
|
||||||
#include "nsWidgetsCID.h"
|
#include "nsWidgetsCID.h"
|
||||||
#include "nsIFullScreen.h"
|
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsIScreenManager.h"
|
#include "nsIScreenManager.h"
|
||||||
#include "nsAppDirectoryServiceDefs.h"
|
#include "nsAppDirectoryServiceDefs.h"
|
||||||
|
@ -442,8 +441,11 @@ NS_IMETHODIMP nsBaseWidget::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
NS_IMETHODIMP nsBaseWidget::SetSizeMode(PRInt32 aMode) {
|
NS_IMETHODIMP nsBaseWidget::SetSizeMode(PRInt32 aMode) {
|
||||||
|
|
||||||
if (aMode == nsSizeMode_Normal || aMode == nsSizeMode_Minimized ||
|
|
||||||
aMode == nsSizeMode_Maximized) {
|
if (aMode == nsSizeMode_Normal ||
|
||||||
|
aMode == nsSizeMode_Minimized ||
|
||||||
|
aMode == nsSizeMode_Maximized ||
|
||||||
|
aMode == nsSizeMode_Fullscreen) {
|
||||||
|
|
||||||
mSizeMode = (nsSizeMode) aMode;
|
mSizeMode = (nsSizeMode) aMode;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -586,9 +588,9 @@ NS_IMETHODIMP nsBaseWidget::HideWindowChrome(PRBool aShouldHide)
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
|
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
|
||||||
{
|
{
|
||||||
HideWindowChrome(aFullScreen);
|
SetSizeMode(aFullScreen ? nsSizeMode_Fullscreen : nsSizeMode_Normal);
|
||||||
|
|
||||||
nsCOMPtr<nsIFullScreen> fullScreen = do_GetService("@mozilla.org/browser/fullscreen;1");
|
HideWindowChrome(aFullScreen);
|
||||||
|
|
||||||
if (aFullScreen) {
|
if (aFullScreen) {
|
||||||
if (!mOriginalBounds)
|
if (!mOriginalBounds)
|
||||||
|
@ -607,12 +609,7 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
|
||||||
if (screen) {
|
if (screen) {
|
||||||
PRInt32 left, top, width, height;
|
PRInt32 left, top, width, height;
|
||||||
if (NS_SUCCEEDED(screen->GetRect(&left, &top, &width, &height))) {
|
if (NS_SUCCEEDED(screen->GetRect(&left, &top, &width, &height))) {
|
||||||
SetSizeMode(nsSizeMode_Normal);
|
|
||||||
Resize(left, top, width, height, PR_TRUE);
|
Resize(left, top, width, height, PR_TRUE);
|
||||||
|
|
||||||
// Hide all of the OS chrome
|
|
||||||
if (fullScreen)
|
|
||||||
fullScreen->HideAllOSChrome();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -620,10 +617,6 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
|
||||||
} else if (mOriginalBounds) {
|
} else if (mOriginalBounds) {
|
||||||
Resize(mOriginalBounds->x, mOriginalBounds->y, mOriginalBounds->width,
|
Resize(mOriginalBounds->x, mOriginalBounds->y, mOriginalBounds->width,
|
||||||
mOriginalBounds->height, PR_TRUE);
|
mOriginalBounds->height, PR_TRUE);
|
||||||
|
|
||||||
// Show all of the OS chrome
|
|
||||||
if (fullScreen)
|
|
||||||
fullScreen->ShowAllOSChrome();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -347,7 +347,8 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent)
|
||||||
// normal browser windows. here we just drop a raised window
|
// normal browser windows. here we just drop a raised window
|
||||||
// to the normal zlevel if it's maximized. we make no provision
|
// to the normal zlevel if it's maximized. we make no provision
|
||||||
// for automatically re-raising it when restored.
|
// for automatically re-raising it when restored.
|
||||||
if (modeEvent->mSizeMode == nsSizeMode_Maximized) {
|
if (modeEvent->mSizeMode == nsSizeMode_Maximized ||
|
||||||
|
modeEvent->mSizeMode == nsSizeMode_Fullscreen) {
|
||||||
PRUint32 zLevel;
|
PRUint32 zLevel;
|
||||||
eventWindow->GetZLevel(&zLevel);
|
eventWindow->GetZLevel(&zLevel);
|
||||||
if (zLevel > nsIXULWindow::normalZ)
|
if (zLevel > nsIXULWindow::normalZ)
|
||||||
|
|
|
@ -95,9 +95,10 @@
|
||||||
|
|
||||||
#include "nsWebShellWindow.h" // get rid of this one, too...
|
#include "nsWebShellWindow.h" // get rid of this one, too...
|
||||||
|
|
||||||
#define SIZEMODE_NORMAL NS_LITERAL_STRING("normal")
|
#define SIZEMODE_NORMAL NS_LITERAL_STRING("normal")
|
||||||
#define SIZEMODE_MAXIMIZED NS_LITERAL_STRING("maximized")
|
#define SIZEMODE_MAXIMIZED NS_LITERAL_STRING("maximized")
|
||||||
#define SIZEMODE_MINIMIZED NS_LITERAL_STRING("minimized")
|
#define SIZEMODE_MINIMIZED NS_LITERAL_STRING("minimized")
|
||||||
|
#define SIZEMODE_FULLSCREEN NS_LITERAL_STRING("fullscreen")
|
||||||
|
|
||||||
#define WINDOWTYPE_ATTRIBUTE NS_LITERAL_STRING("windowtype")
|
#define WINDOWTYPE_ATTRIBUTE NS_LITERAL_STRING("windowtype")
|
||||||
|
|
||||||
|
@ -255,7 +256,7 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(PRUint32 aLevel)
|
||||||
PRInt32 sizeMode;
|
PRInt32 sizeMode;
|
||||||
if (mWindow) {
|
if (mWindow) {
|
||||||
mWindow->GetSizeMode(&sizeMode);
|
mWindow->GetSizeMode(&sizeMode);
|
||||||
if (sizeMode == nsSizeMode_Maximized)
|
if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -275,30 +276,7 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(PRUint32 aLevel)
|
||||||
SavePersistentAttributes();
|
SavePersistentAttributes();
|
||||||
|
|
||||||
// finally, send a notification DOM event
|
// finally, send a notification DOM event
|
||||||
nsCOMPtr<nsIContentViewer> cv;
|
DispatchCustomEvent(NS_LITERAL_STRING("windowZLevel"));
|
||||||
mDocShell->GetContentViewer(getter_AddRefs(cv));
|
|
||||||
nsCOMPtr<nsIDocumentViewer> dv(do_QueryInterface(cv));
|
|
||||||
if (dv) {
|
|
||||||
nsCOMPtr<nsIDocument> doc;
|
|
||||||
dv->GetDocument(getter_AddRefs(doc));
|
|
||||||
nsCOMPtr<nsIDOMDocumentEvent> docEvent(do_QueryInterface(doc));
|
|
||||||
if (docEvent) {
|
|
||||||
nsCOMPtr<nsIDOMEvent> event;
|
|
||||||
docEvent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
|
|
||||||
if (event) {
|
|
||||||
event->InitEvent(NS_LITERAL_STRING("windowZLevel"), PR_TRUE, PR_FALSE);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
|
|
||||||
privateEvent->SetTrusted(PR_TRUE);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(doc));
|
|
||||||
if (targ) {
|
|
||||||
PRBool defaultActionEnabled;
|
|
||||||
targ->DispatchEvent(event, &defaultActionEnabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1202,17 +1180,33 @@ PRBool nsXULWindow::LoadMiscPersistentAttributesFromXUL()
|
||||||
if (stateString.Equals(SIZEMODE_MINIMIZED))
|
if (stateString.Equals(SIZEMODE_MINIMIZED))
|
||||||
sizeMode = nsSizeMode_Minimized;
|
sizeMode = nsSizeMode_Minimized;
|
||||||
*/
|
*/
|
||||||
if (stateString.Equals(SIZEMODE_MAXIMIZED)) {
|
if (stateString.Equals(SIZEMODE_MAXIMIZED) || stateString.Equals(SIZEMODE_FULLSCREEN)) {
|
||||||
/* Honor request to maximize only if the window is sizable.
|
/* Honor request to maximize only if the window is sizable.
|
||||||
An unsizable, unmaximizable, yet maximized window confuses
|
An unsizable, unmaximizable, yet maximized window confuses
|
||||||
Windows OS and is something of a travesty, anyway. */
|
Windows OS and is something of a travesty, anyway. */
|
||||||
if (mChromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
if (mChromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
||||||
mIntrinsicallySized = PR_FALSE;
|
mIntrinsicallySized = PR_FALSE;
|
||||||
sizeMode = nsSizeMode_Maximized;
|
|
||||||
|
if (stateString.Equals(SIZEMODE_MAXIMIZED))
|
||||||
|
sizeMode = nsSizeMode_Maximized;
|
||||||
|
else
|
||||||
|
sizeMode = nsSizeMode_Fullscreen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dispatch fullscreen event
|
||||||
|
if (sizeMode == nsSizeMode_Fullscreen) {
|
||||||
|
if (!DispatchCustomEvent(NS_LITERAL_STRING("fullscreen"), PR_TRUE, PR_FALSE)) {
|
||||||
|
// fullscreen event prevented the default, set the window to
|
||||||
|
// maximized instead of fullscreen.
|
||||||
|
sizeMode = nsSizeMode_Maximized;
|
||||||
|
mWindow->SetSizeMode(sizeMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// the widget had better be able to deal with not becoming visible yet
|
// the widget had better be able to deal with not becoming visible yet
|
||||||
mWindow->SetSizeMode(sizeMode);
|
mWindow->SetSizeMode(sizeMode);
|
||||||
|
|
||||||
gotState = PR_TRUE;
|
gotState = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1522,6 +1516,8 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
|
||||||
persistString.Find("sizemode") >= 0) {
|
persistString.Find("sizemode") >= 0) {
|
||||||
if (sizeMode == nsSizeMode_Maximized)
|
if (sizeMode == nsSizeMode_Maximized)
|
||||||
sizeString.Assign(SIZEMODE_MAXIMIZED);
|
sizeString.Assign(SIZEMODE_MAXIMIZED);
|
||||||
|
else if (sizeMode == nsSizeMode_Fullscreen)
|
||||||
|
sizeString.Assign(SIZEMODE_FULLSCREEN);
|
||||||
else
|
else
|
||||||
sizeString.Assign(SIZEMODE_NORMAL);
|
sizeString.Assign(SIZEMODE_NORMAL);
|
||||||
docShellElement->SetAttribute(MODE_ATTRIBUTE, sizeString);
|
docShellElement->SetAttribute(MODE_ATTRIBUTE, sizeString);
|
||||||
|
@ -2139,6 +2135,48 @@ PRInt32 nsXULWindow::AppUnitsPerDevPixel()
|
||||||
return mAppPerDev;
|
return mAppPerDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PRBool nsXULWindow::DispatchCustomEvent(const nsAString& eventName, PRBool cancelable, PRBool toDocument)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIContentViewer> cv;
|
||||||
|
mDocShell->GetContentViewer(getter_AddRefs(cv));
|
||||||
|
nsCOMPtr<nsIDocumentViewer> dv(do_QueryInterface(cv));
|
||||||
|
if (dv) {
|
||||||
|
nsCOMPtr<nsIDocument> doc;
|
||||||
|
dv->GetDocument(getter_AddRefs(doc));
|
||||||
|
nsCOMPtr<nsIDOMDocumentEvent> docEvent(do_QueryInterface(doc));
|
||||||
|
if (docEvent) {
|
||||||
|
nsCOMPtr<nsIDOMEvent> event;
|
||||||
|
docEvent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
|
||||||
|
if (event) {
|
||||||
|
event->InitEvent(eventName, PR_TRUE, cancelable);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
|
||||||
|
privateEvent->SetTrusted(PR_TRUE);
|
||||||
|
|
||||||
|
if (toDocument) {
|
||||||
|
nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(doc));
|
||||||
|
if (targ) {
|
||||||
|
PRBool defaultActionEnabled;
|
||||||
|
targ->DispatchEvent(event, &defaultActionEnabled);
|
||||||
|
return defaultActionEnabled;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nsCOMPtr<nsIDOMWindowInternal> ourWindow;
|
||||||
|
GetWindowDOMWindow(getter_AddRefs(ourWindow));
|
||||||
|
nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(ourWindow));
|
||||||
|
if (targ) {
|
||||||
|
PRBool defaultActionEnabled;
|
||||||
|
targ->DispatchEvent(event, &defaultActionEnabled);
|
||||||
|
return defaultActionEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//*** nsContentShellInfo: Object Management
|
//*** nsContentShellInfo: Object Management
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
|
@ -150,6 +150,7 @@ protected:
|
||||||
PRBool GetContentScrollbarVisibility();
|
PRBool GetContentScrollbarVisibility();
|
||||||
void PersistentAttributesDirty(PRUint32 aDirtyFlags);
|
void PersistentAttributesDirty(PRUint32 aDirtyFlags);
|
||||||
PRInt32 AppUnitsPerDevPixel();
|
PRInt32 AppUnitsPerDevPixel();
|
||||||
|
PRBool DispatchCustomEvent(const nsAString& eventName, PRBool cancelable = PR_FALSE, PRBool toDocument = PR_TRUE);
|
||||||
|
|
||||||
nsChromeTreeOwner* mChromeTreeOwner;
|
nsChromeTreeOwner* mChromeTreeOwner;
|
||||||
nsContentTreeOwner* mContentTreeOwner;
|
nsContentTreeOwner* mContentTreeOwner;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче