mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1296993 (part 2) - Streamline nsIWidget::Set{,Fake}Modal. r=mstange.
This patch does the following. - Removes the return value, because none of the call sites check it. - Removes the empty implementations from several nsIWidget instances, because they can use the nsBaseWidget one. --HG-- extra : rebase_source : b8a0d9a49b31929dd06af9e61fc57f484af7671d
This commit is contained in:
parent
ff02e25e13
commit
672f94a22d
@ -1736,14 +1736,6 @@ nsWindow::Show(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::SetModal(bool aState)
|
||||
{
|
||||
ALOG("nsWindow[%p]::SetModal %d ignored", (void*)this, aState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsWindow::IsVisible() const
|
||||
{
|
||||
|
@ -140,7 +140,6 @@ public:
|
||||
virtual float GetDPI() override;
|
||||
virtual double GetDefaultScaleInternal() override;
|
||||
NS_IMETHOD Show(bool aState) override;
|
||||
NS_IMETHOD SetModal(bool aModal) override;
|
||||
virtual bool IsVisible() const override;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
|
@ -241,8 +241,8 @@ public:
|
||||
virtual nsIWidget* GetSheetWindowParent(void) override;
|
||||
NS_IMETHOD Enable(bool aState) override;
|
||||
virtual bool IsEnabled() const override;
|
||||
NS_IMETHOD SetModal(bool aState) override;
|
||||
NS_IMETHOD SetFakeModal(bool aState) override;
|
||||
virtual void SetModal(bool aState) override;
|
||||
virtual void SetFakeModal(bool aState) override;
|
||||
virtual bool IsVisible() const override;
|
||||
NS_IMETHOD SetFocus(bool aState=false) override;
|
||||
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
||||
|
@ -641,10 +641,13 @@ bool nsCocoaWindow::IsVisible() const
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
void
|
||||
nsCocoaWindow::SetModal(bool aState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
if (!mWindow)
|
||||
return NS_OK;
|
||||
return;
|
||||
|
||||
// This is used during startup (outside the event loop) when creating
|
||||
// the add-ons compatibility checking dialog and the profile manager UI;
|
||||
@ -712,13 +715,15 @@ NS_IMETHODIMP nsCocoaWindow::SetModal(bool aState)
|
||||
[mWindow setLevel:NSNormalWindowLevel];
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SetFakeModal(bool aState)
|
||||
void
|
||||
nsCocoaWindow::SetFakeModal(bool aState)
|
||||
{
|
||||
mFakeModal = aState;
|
||||
return SetModal(aState);
|
||||
SetModal(aState);
|
||||
}
|
||||
|
||||
// Hide or show this window
|
||||
|
@ -941,16 +941,15 @@ nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent,
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsWindow::SetModal(bool aModal)
|
||||
{
|
||||
LOG(("nsWindow::SetModal [%p] %d\n", (void *)this, aModal));
|
||||
if (mIsDestroyed)
|
||||
return aModal ? NS_ERROR_NOT_AVAILABLE : NS_OK;
|
||||
return;
|
||||
if (!mIsTopLevel || !mShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
gtk_window_set_modal(GTK_WINDOW(mShell), aModal ? TRUE : FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIWidget method, which means IsShown.
|
||||
|
@ -107,7 +107,7 @@ public:
|
||||
return mozilla::DesktopToLayoutDeviceScale(1.0);
|
||||
}
|
||||
virtual nsresult SetParent(nsIWidget* aNewParent) override;
|
||||
NS_IMETHOD SetModal(bool aModal) override;
|
||||
virtual void SetModal(bool aModal) override;
|
||||
virtual bool IsVisible() const override;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
|
@ -1604,11 +1604,6 @@ uint32_t nsBaseWidget::GetMaxTouchPoints() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBaseWidget::SetModal(bool aModal)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBaseWidget::GetAttention(int32_t aCycleCount) {
|
||||
return NS_OK;
|
||||
|
@ -195,7 +195,7 @@ public:
|
||||
virtual void CreateCompositor(int aWidth, int aHeight);
|
||||
virtual void PrepareWindowEffects() override {}
|
||||
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override {}
|
||||
NS_IMETHOD SetModal(bool aModal) override;
|
||||
virtual void SetModal(bool aModal) override {}
|
||||
virtual uint32_t GetMaxTouchPoints() const override;
|
||||
NS_IMETHOD SetWindowClass(const nsAString& xulWinType) override;
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) override;
|
||||
|
@ -639,18 +639,17 @@ class nsIWidget : public nsISupports
|
||||
NS_IMETHOD Show(bool aState) = 0;
|
||||
|
||||
/**
|
||||
* Make the window modal
|
||||
*
|
||||
* Make the window modal.
|
||||
*/
|
||||
NS_IMETHOD SetModal(bool aModal) = 0;
|
||||
virtual void SetModal(bool aModal) = 0;
|
||||
|
||||
/**
|
||||
* Make the non-modal window opened by modal window fake-modal, that will
|
||||
* call SetFakeModal(false) on destroy on Cocoa.
|
||||
*/
|
||||
NS_IMETHOD SetFakeModal(bool aModal)
|
||||
virtual void SetFakeModal(bool aModal)
|
||||
{
|
||||
return SetModal(aModal);
|
||||
SetModal(aModal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,6 @@ public:
|
||||
virtual bool IsEnabled() const override {
|
||||
return true;
|
||||
}
|
||||
NS_IMETHOD SetModal(bool aState) override;
|
||||
virtual bool IsVisible() const override {
|
||||
return mVisible;
|
||||
}
|
||||
|
@ -582,12 +582,6 @@ nsWindow::Show(bool aState)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::SetModal(bool aModal)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
|
Loading…
Reference in New Issue
Block a user