mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1752619 - Remove aTargetScreen from nsIWidget::MakeFullScreen() r=handyman,spohl,agi,emilio
Differential Revision: https://phabricator.services.mozilla.com/D137336
This commit is contained in:
parent
7be2686656
commit
2f8ba0583d
@ -4286,12 +4286,10 @@ class FullscreenTransitionTask : public Runnable {
|
||||
public:
|
||||
FullscreenTransitionTask(const FullscreenTransitionDuration& aDuration,
|
||||
nsGlobalWindowOuter* aWindow, bool aFullscreen,
|
||||
nsIWidget* aWidget, nsIScreen* aScreen,
|
||||
nsISupports* aTransitionData)
|
||||
nsIWidget* aWidget, nsISupports* aTransitionData)
|
||||
: mozilla::Runnable("FullscreenTransitionTask"),
|
||||
mWindow(aWindow),
|
||||
mWidget(aWidget),
|
||||
mScreen(aScreen),
|
||||
mTransitionData(aTransitionData),
|
||||
mDuration(aDuration),
|
||||
mStage(eBeforeToggle),
|
||||
@ -4357,7 +4355,6 @@ class FullscreenTransitionTask : public Runnable {
|
||||
|
||||
RefPtr<nsGlobalWindowOuter> mWindow;
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
nsCOMPtr<nsIScreen> mScreen;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsISupports> mTransitionData;
|
||||
|
||||
@ -4399,7 +4396,7 @@ FullscreenTransitionTask::Run() {
|
||||
}
|
||||
// Toggle the fullscreen state on the widget
|
||||
if (!mWindow->SetWidgetFullscreen(FullscreenReason::ForFullscreenAPI,
|
||||
mFullscreen, mWidget, mScreen)) {
|
||||
mFullscreen, mWidget)) {
|
||||
// Fail to setup the widget, call FinishFullscreenChange to
|
||||
// complete fullscreen change directly.
|
||||
mWindow->FinishFullscreenChange(mFullscreen);
|
||||
@ -4496,15 +4493,13 @@ static bool MakeWidgetFullscreen(nsGlobalWindowOuter* aWindow,
|
||||
getter_AddRefs(transitionData));
|
||||
}
|
||||
}
|
||||
// We pass nullptr as the screen to SetWidgetFullscreen
|
||||
// and FullscreenTransitionTask, as we do not wish to override
|
||||
// the default screen selection behavior. The screen containing
|
||||
// most of the widget will be selected.
|
||||
|
||||
if (!performTransition) {
|
||||
return aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget, nullptr);
|
||||
return aWindow->SetWidgetFullscreen(aReason, aFullscreen, widget);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRunnable> task = new FullscreenTransitionTask(
|
||||
duration, aWindow, aFullscreen, widget, nullptr, transitionData);
|
||||
duration, aWindow, aFullscreen, widget, transitionData);
|
||||
task->Run();
|
||||
return true;
|
||||
}
|
||||
@ -4621,8 +4616,7 @@ void nsGlobalWindowOuter::ForceFullScreenInWidget() {
|
||||
|
||||
bool nsGlobalWindowOuter::SetWidgetFullscreen(FullscreenReason aReason,
|
||||
bool aIsFullscreen,
|
||||
nsIWidget* aWidget,
|
||||
nsIScreen* aScreen) {
|
||||
nsIWidget* aWidget) {
|
||||
MOZ_ASSERT(this == GetInProcessTopInternal(),
|
||||
"Only topmost window should call this");
|
||||
MOZ_ASSERT(!GetFrameElementInternal(), "Content window should not call this");
|
||||
@ -4640,13 +4634,12 @@ bool nsGlobalWindowOuter::SetWidgetFullscreen(FullscreenReason aReason,
|
||||
}
|
||||
}
|
||||
}
|
||||
nsresult rv =
|
||||
aReason == FullscreenReason::ForFullscreenMode
|
||||
?
|
||||
// If we enter fullscreen for fullscreen mode, we want
|
||||
// the native system behavior.
|
||||
aWidget->MakeFullScreenWithNativeTransition(aIsFullscreen, aScreen)
|
||||
: aWidget->MakeFullScreen(aIsFullscreen, aScreen);
|
||||
nsresult rv = aReason == FullscreenReason::ForFullscreenMode
|
||||
?
|
||||
// If we enter fullscreen for fullscreen mode, we want
|
||||
// the native system behavior.
|
||||
aWidget->MakeFullScreenWithNativeTransition(aIsFullscreen)
|
||||
: aWidget->MakeFullScreen(aIsFullscreen);
|
||||
return NS_SUCCEEDED(rv);
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
||||
void MacFullscreenMenubarOverlapChanged(
|
||||
mozilla::DesktopCoord aOverlapAmount) final;
|
||||
bool SetWidgetFullscreen(FullscreenReason aReason, bool aIsFullscreen,
|
||||
nsIWidget* aWidget, nsIScreen* aScreen);
|
||||
nsIWidget* aWidget);
|
||||
bool Fullscreen() const;
|
||||
|
||||
// nsIInterfaceRequestor
|
||||
|
@ -2181,7 +2181,7 @@ nsEventStatus nsWindow::DispatchEvent(WidgetGUIEvent* aEvent) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen*) {
|
||||
nsresult nsWindow::MakeFullScreen(bool aFullScreen) {
|
||||
if (!mAndroidView) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
@ -165,8 +165,7 @@ class nsWindow final : public nsBaseWidget {
|
||||
nsEventStatus& aStatus) override;
|
||||
nsEventStatus DispatchEvent(mozilla::WidgetGUIEvent* aEvent);
|
||||
virtual already_AddRefed<nsIScreen> GetWidgetScreen() override;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen = nullptr) override;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen) override;
|
||||
void SetCursor(const Cursor& aDefaultCursor) override;
|
||||
void* GetNativeData(uint32_t aDataType) override;
|
||||
void SetNativeData(uint32_t aDataType, uintptr_t aVal) override;
|
||||
|
@ -264,9 +264,8 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
|
||||
virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage, uint16_t aDuration,
|
||||
nsISupports* aData, nsIRunnable* aCallback) override;
|
||||
virtual void CleanupFullscreenTransition() override;
|
||||
nsresult MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen = nullptr) final;
|
||||
nsresult MakeFullScreenWithNativeTransition(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen = nullptr) final;
|
||||
nsresult MakeFullScreen(bool aFullScreen) final;
|
||||
nsresult MakeFullScreenWithNativeTransition(bool aFullScreen) final;
|
||||
NSAnimation* FullscreenTransitionAnimation() const { return mFullscreenTransitionAnimation; }
|
||||
void ReleaseFullscreenTransitionAnimation() {
|
||||
MOZ_ASSERT(mFullscreenTransitionAnimation, "Should only be called when there is animation");
|
||||
|
@ -1674,12 +1674,11 @@ inline bool nsCocoaWindow::ShouldToggleNativeFullscreen(bool aFullScreen,
|
||||
return aFullScreen;
|
||||
}
|
||||
|
||||
nsresult nsCocoaWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) {
|
||||
nsresult nsCocoaWindow::MakeFullScreen(bool aFullScreen) {
|
||||
return DoMakeFullScreen(aFullScreen, AlwaysUsesNativeFullScreen());
|
||||
}
|
||||
|
||||
nsresult nsCocoaWindow::MakeFullScreenWithNativeTransition(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen) {
|
||||
nsresult nsCocoaWindow::MakeFullScreenWithNativeTransition(bool aFullScreen) {
|
||||
return DoMakeFullScreen(aFullScreen, true);
|
||||
}
|
||||
|
||||
|
@ -7024,7 +7024,7 @@ static bool IsFullscreenSupported(GtkWidget* aShell) {
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) {
|
||||
nsresult nsWindow::MakeFullScreen(bool aFullScreen) {
|
||||
LOG("nsWindow::MakeFullScreen aFullScreen %d\n", aFullScreen);
|
||||
|
||||
if (GdkIsX11Display() && !IsFullscreenSupported(mShell)) {
|
||||
|
@ -168,8 +168,7 @@ class nsWindow final : public nsBaseWidget {
|
||||
uint16_t aDuration, nsISupports* aData,
|
||||
nsIRunnable* aCallback) override;
|
||||
already_AddRefed<nsIScreen> GetWidgetScreen() override;
|
||||
nsresult MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen = nullptr) override;
|
||||
nsresult MakeFullScreen(bool aFullScreen) override;
|
||||
void HideWindowChrome(bool aShouldHide) override;
|
||||
|
||||
/**
|
||||
|
@ -351,8 +351,7 @@ void HeadlessWidget::ApplySizeModeSideEffects() {
|
||||
}
|
||||
}
|
||||
|
||||
nsresult HeadlessWidget::MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen) {
|
||||
nsresult HeadlessWidget::MakeFullScreen(bool aFullScreen) {
|
||||
// Directly update the size mode here so a later call SetSizeMode does
|
||||
// nothing.
|
||||
if (aFullScreen) {
|
||||
@ -377,11 +376,9 @@ nsresult HeadlessWidget::MakeFullScreen(bool aFullScreen,
|
||||
// will be ignored if still transitioning to fullscreen, so it must be
|
||||
// triggered on the next tick.
|
||||
RefPtr<HeadlessWidget> self(this);
|
||||
nsCOMPtr<nsIScreen> targetScreen(aTargetScreen);
|
||||
NS_DispatchToCurrentThread(NS_NewRunnableFunction(
|
||||
"HeadlessWidget::MakeFullScreen",
|
||||
[self, targetScreen, aFullScreen]() -> void {
|
||||
self->InfallibleMakeFullScreen(aFullScreen, targetScreen);
|
||||
"HeadlessWidget::MakeFullScreen", [self, aFullScreen]() -> void {
|
||||
self->InfallibleMakeFullScreen(aFullScreen);
|
||||
}));
|
||||
|
||||
return NS_OK;
|
||||
|
@ -70,8 +70,7 @@ class HeadlessWidget : public nsBaseWidget {
|
||||
virtual void Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint) override;
|
||||
virtual void SetSizeMode(nsSizeMode aMode) override;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen = nullptr) override;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen) override;
|
||||
virtual void Enable(bool aState) override;
|
||||
virtual bool IsEnabled() const override;
|
||||
virtual void SetFocus(Raise, mozilla::dom::CallerType aCallerType) override;
|
||||
|
@ -751,8 +751,7 @@ void nsBaseWidget::PerformFullscreenTransition(FullscreenTransitionStage aStage,
|
||||
// Put the window into full-screen mode
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aScreen) {
|
||||
void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen) {
|
||||
HideWindowChrome(aFullScreen);
|
||||
|
||||
if (aFullScreen) {
|
||||
@ -762,10 +761,7 @@ void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen,
|
||||
*mOriginalBounds = GetScreenBounds();
|
||||
|
||||
// Move to top-left corner of screen and size to the screen dimensions
|
||||
nsCOMPtr<nsIScreen> screen = aScreen;
|
||||
if (!screen) {
|
||||
screen = GetWidgetScreen();
|
||||
}
|
||||
nsCOMPtr<nsIScreen> screen = GetWidgetScreen();
|
||||
if (screen) {
|
||||
int32_t left, top, width, height;
|
||||
if (NS_SUCCEEDED(
|
||||
@ -785,8 +781,8 @@ void nsBaseWidget::InfallibleMakeFullScreen(bool aFullScreen,
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsBaseWidget::MakeFullScreen(bool aFullScreen, nsIScreen* aScreen) {
|
||||
InfallibleMakeFullScreen(aFullScreen, aScreen);
|
||||
nsresult nsBaseWidget::MakeFullScreen(bool aFullScreen) {
|
||||
InfallibleMakeFullScreen(aFullScreen);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -208,9 +208,8 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
||||
nsIRunnable* aCallback) override;
|
||||
void CleanupFullscreenTransition() override {}
|
||||
already_AddRefed<nsIScreen> GetWidgetScreen() override;
|
||||
nsresult MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aScreen = nullptr) override;
|
||||
void InfallibleMakeFullScreen(bool aFullScreen, nsIScreen* aScreen = nullptr);
|
||||
nsresult MakeFullScreen(bool aFullScreen) override;
|
||||
void InfallibleMakeFullScreen(bool aFullScreen);
|
||||
|
||||
WindowRenderer* GetWindowRenderer() override;
|
||||
|
||||
|
@ -1167,17 +1167,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.
|
||||
*
|
||||
* @return NS_OK if the widget is setup properly for fullscreen and
|
||||
* FullscreenChanged callback has been or will be called. If other
|
||||
* value is returned, the caller should continue the change itself.
|
||||
*/
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aTargetScreen = nullptr) = 0;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen) = 0;
|
||||
|
||||
/**
|
||||
* Same as MakeFullScreen, except that, on systems which natively
|
||||
@ -1185,9 +1180,8 @@ class nsIWidget : public nsISupports {
|
||||
* requests that behavior.
|
||||
* It is currently only supported on macOS 10.7+.
|
||||
*/
|
||||
virtual nsresult MakeFullScreenWithNativeTransition(
|
||||
bool aFullScreen, nsIScreen* aTargetScreen = nullptr) {
|
||||
return MakeFullScreen(aFullScreen, aTargetScreen);
|
||||
virtual nsresult MakeFullScreenWithNativeTransition(bool aFullScreen) {
|
||||
return MakeFullScreen(aFullScreen);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2324,7 +2324,8 @@ void nsWindow::SetSizeModeInternal(nsSizeMode aMode) {
|
||||
}
|
||||
|
||||
// we activate here to ensure that the right child window is focused
|
||||
if (mIsVisible && (aMode == nsSizeMode_Maximized || aMode == nsSizeMode_Fullscreen)) {
|
||||
if (mIsVisible &&
|
||||
(aMode == nsSizeMode_Maximized || aMode == nsSizeMode_Fullscreen)) {
|
||||
DispatchFocusToTopLevelWindow(true);
|
||||
}
|
||||
}
|
||||
@ -2345,13 +2346,14 @@ void nsWindow::SetSizeMode(nsSizeMode aMode) {
|
||||
if (aMode == mSizeMode) return;
|
||||
|
||||
if (aMode == nsSizeMode_Fullscreen) {
|
||||
MakeFullScreen(true, nullptr);
|
||||
} else if ((mSizeMode == nsSizeMode_Fullscreen) && (aMode == nsSizeMode_Normal)) {
|
||||
MakeFullScreen(true);
|
||||
} else if ((mSizeMode == nsSizeMode_Fullscreen) &&
|
||||
(aMode == nsSizeMode_Normal)) {
|
||||
// If we are in fullscreen mode, minimize should work like normal and
|
||||
// return us to fullscreen mode when unminimized. Maximize isn't really
|
||||
// available and won't do anything. "Restore" should do the same thing as
|
||||
// requesting to end fullscreen.
|
||||
MakeFullScreen(false, nullptr);
|
||||
MakeFullScreen(false);
|
||||
} else {
|
||||
SetSizeModeInternal(aMode);
|
||||
}
|
||||
@ -3678,7 +3680,7 @@ void nsWindow::CleanupFullscreenTransition() {
|
||||
mTransitionWnd = nullptr;
|
||||
}
|
||||
|
||||
nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) {
|
||||
nsresult nsWindow::MakeFullScreen(bool aFullScreen) {
|
||||
if (mFullscreenMode == aFullScreen) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3714,7 +3716,7 @@ nsresult nsWindow::MakeFullScreen(bool aFullScreen, nsIScreen* aTargetScreen) {
|
||||
// Will call hide chrome, reposition window. Note this will
|
||||
// also cache dimensions for restoration, so it should only
|
||||
// be called once per fullscreen request.
|
||||
nsBaseWidget::InfallibleMakeFullScreen(aFullScreen, aTargetScreen);
|
||||
nsBaseWidget::InfallibleMakeFullScreen(aFullScreen);
|
||||
|
||||
if (mIsVisible && !aFullScreen && mSizeMode == nsSizeMode_Normal) {
|
||||
MOZ_ASSERT(mSizeMode == mOldSizeMode);
|
||||
|
@ -187,8 +187,7 @@ class nsWindow final : public nsWindowBase {
|
||||
nsISupports* aData,
|
||||
nsIRunnable* aCallback) override;
|
||||
virtual void CleanupFullscreenTransition() override;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen,
|
||||
nsIScreen* aScreen = nullptr) override;
|
||||
virtual nsresult MakeFullScreen(bool aFullScreen) override;
|
||||
virtual void HideWindowChrome(bool aShouldHide) override;
|
||||
virtual void Invalidate(bool aEraseBackground = false,
|
||||
bool aUpdateNCArea = false,
|
||||
|
Loading…
Reference in New Issue
Block a user