Bug 1036597 - extend widget's MakeFullScreen method to take an optional nsIScreen indicating the target; r=karlt

This commit is contained in:
Vladimir Vukicevic 2014-07-09 12:29:28 -07:00
parent 14f286d34c
commit 7a528c00ee
15 changed files with 31 additions and 23 deletions

View File

@ -692,7 +692,7 @@ nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
}
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen)
nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen*)
{
mozilla::widget::android::GeckoAppShell::SetFullScreen(aFullScreen);
return NS_OK;

View File

@ -104,7 +104,7 @@ public:
NS_IMETHOD DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus);
nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
NS_IMETHOD MakeFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);

View File

@ -275,7 +275,7 @@ public:
NS_IMETHOD SetSizeMode(int32_t aMode);
NS_IMETHOD HideWindowChrome(bool aShouldHide);
void EnteredFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr);
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
NS_IMETHOD GetClientBounds(nsIntRect &aRect);

View File

@ -1280,7 +1280,7 @@ void nsCocoaWindow::EnteredFullScreen(bool aFullScreen)
DispatchSizeModeEvent();
}
NS_METHOD nsCocoaWindow::MakeFullScreen(bool aFullScreen)
NS_METHOD nsCocoaWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;

View File

@ -455,7 +455,7 @@ nsWindow::ReparentNativeWidget(nsIWidget* aNewParent)
}
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen)
nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen*)
{
if (mWindowType != eWindowType_toplevel) {
// Ignore fullscreen request for non-toplevel windows.

View File

@ -95,7 +95,7 @@ public:
}
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
NS_IMETHOD MakeFullScreen(bool aFullScreen) /*MOZ_OVERRIDE*/;
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr) /*MOZ_OVERRIDE*/;
virtual mozilla::TemporaryRef<mozilla::gfx::DrawTarget>
StartRemoteDrawing() MOZ_OVERRIDE;

View File

@ -4704,7 +4704,7 @@ nsWindow::ConvertBorderStyles(nsBorderStyle aStyle)
}
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen)
nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen)
{
LOG(("nsWindow::MakeFullScreen [%p] aFullScreen %d\n",
(void *)this, aFullScreen));

View File

@ -146,7 +146,7 @@ public:
bool aIntersectWithExisting) MOZ_OVERRIDE;
virtual bool HasPendingInputEvent();
NS_IMETHOD MakeFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr);
NS_IMETHOD HideWindowChrome(bool aShouldHide);
/**

View File

@ -738,7 +738,7 @@ NS_IMETHODIMP nsBaseWidget::HideWindowChrome(bool aShouldHide)
// Put the window into full-screen mode
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(bool aFullScreen)
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen)
{
HideWindowChrome(aFullScreen);
@ -758,12 +758,16 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScreen(bool aFullScreen)
screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
NS_ASSERTION(screenManager, "Unable to grab screenManager.");
if (screenManager) {
nsCOMPtr<nsIScreen> screen;
screenManager->ScreenForRect(mOriginalBounds->x,
mOriginalBounds->y,
mOriginalBounds->width,
mOriginalBounds->height,
getter_AddRefs(screen));
nsCOMPtr<nsIScreen> screen = aScreen;
if (!screen) {
// no screen was passed in, use the one that the window is on
screenManager->ScreenForRect(mOriginalBounds->x,
mOriginalBounds->y,
mOriginalBounds->width,
mOriginalBounds->height,
getter_AddRefs(screen));
}
if (screen) {
int32_t left, top, width, height;
if (NS_SUCCEEDED(screen->GetRectDisplayPix(&left, &top, &width, &height))) {

View File

@ -127,7 +127,7 @@ public:
virtual void SetShowsFullScreenButton(bool aShow) {}
virtual void SetWindowAnimationType(WindowAnimationType aType) {}
NS_IMETHOD HideWindowChrome(bool aShouldHide);
NS_IMETHOD MakeFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aScreen = nullptr);
virtual nsDeviceContext* GetDeviceContext();
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,

View File

@ -33,6 +33,7 @@ class nsIContent;
class ViewWrapper;
class nsIWidgetListener;
class nsIntRegion;
class nsIScreen;
namespace mozilla {
namespace dom {
@ -1405,9 +1406,12 @@ class nsIWidget : public nsISupports {
/**
* Put the toplevel window into or out of fullscreen mode.
*
* If aTargetScreen is given, attempt to go fullscreen on that screen,
* if possible. (If not, it behaves as if aTargetScreen is null.)
* If !aFullScreen, aTargetScreen is ignored.
* aTargetScreen support is currently only implemented on Windows.
*/
NS_IMETHOD MakeFullScreen(bool aFullScreen) = 0;
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr) = 0;
/**
* Invalidate a specified rect for a widget so that it will be repainted

View File

@ -732,7 +732,7 @@ nsWindow::ReparentNativeWidget(nsIWidget *aNewParent)
}
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen)
nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen*)
{
NS_ENSURE_TRUE(mWidget, NS_ERROR_FAILURE);

View File

@ -134,7 +134,7 @@ public:
}
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
NS_IMETHOD MakeFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr);
virtual mozilla::layers::LayerManager*
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,

View File

@ -2851,7 +2851,7 @@ NS_METHOD nsWindow::Invalidate(const nsIntRect & aRect)
}
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen)
nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen)
{
// taskbarInfo will be nullptr pre Windows 7 until Bug 680227 is resolved.
nsCOMPtr<nsIWinTaskbar> taskbarInfo =
@ -2881,7 +2881,7 @@ nsWindow::MakeFullScreen(bool aFullScreen)
// Will call hide chrome, reposition window. Note this will
// also cache dimensions for restoration, so it should only
// be called once per fullscreen request.
nsresult rv = nsBaseWidget::MakeFullScreen(aFullScreen);
nsresult rv = nsBaseWidget::MakeFullScreen(aFullScreen, aTargetScreen);
if (visible) {
Show(true);

View File

@ -129,7 +129,7 @@ public:
uint32_t aHotspotX, uint32_t aHotspotY);
NS_IMETHOD SetCursor(nsCursor aCursor);
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
NS_IMETHOD MakeFullScreen(bool aFullScreen);
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aScreen = nullptr);
NS_IMETHOD HideWindowChrome(bool aShouldHide);
NS_IMETHOD Invalidate(bool aEraseBackground = false,
bool aUpdateNCArea = false,