Bug 864165 - Outparamdel nsIWidget::GetSizeMode; r=tn

This commit is contained in:
Ms2ger 2013-04-26 08:49:47 +02:00
parent 957b1b9641
commit 963182b152
8 changed files with 22 additions and 47 deletions

View File

@ -11421,14 +11421,9 @@ nsGlobalChromeWindow::GetWindowState(uint16_t* aWindowState)
nsCOMPtr<nsIWidget> widget = GetMainWidget();
int32_t aMode = 0;
int32_t mode = widget ? widget->SizeMode() : 0;
if (widget) {
nsresult rv = widget->GetSizeMode(&aMode);
NS_ENSURE_SUCCESS(rv, rv);
}
switch (aMode) {
switch (mode) {
case nsSizeMode_Minimized:
*aWindowState = nsIDOMChromeWindow::STATE_MINIMIZED;
break;

View File

@ -1473,11 +1473,8 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
// window, so this is always disabled.
nsCOMPtr<nsIWidget> mainWidget;
baseWin->GetMainWidget(getter_AddRefs(mainWidget));
if (mainWidget) {
int32_t sizeMode;
mainWidget->GetSizeMode(&sizeMode);
if (sizeMode == nsSizeMode_Minimized)
return false;
if (mainWidget && mainWidget->SizeMode() == nsSizeMode_Minimized) {
return false;
}
// cannot open a popup that is a submenu of a menupopup that isn't open.

View File

@ -92,8 +92,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#endif
#define NS_IWIDGET_IID \
{ 0xdaac8d94, 0x14f3, 0x4bc4, \
{ 0xa8, 0xc, 0xf0, 0xe6, 0x46, 0x1e, 0xad, 0x40 } }
{ 0x16da2e50, 0x0fee, 0x4719, \
{ 0x93, 0x37, 0xce, 0xd4, 0xdd, 0xd2, 0x22, 0x53 } }
/*
* Window shadow styles
@ -848,7 +848,7 @@ class nsIWidget : public nsISupports {
* Return size mode (minimized, maximized, normalized).
* Returns a value from nsSizeMode (see nsGUIEvent.h)
*/
NS_IMETHOD GetSizeMode(int32_t* aMode) = 0;
virtual int32_t SizeMode() = 0;
/**
* Enable or disable this Widget

View File

@ -218,8 +218,7 @@ nsresult os2FrameWindow::Show(bool aState)
ulFlags = SWP_SHOW | SWP_ACTIVATE;
uint32_t ulStyle = WinQueryWindowULong(mFrameWnd, QWL_STYLE);
int32_t sizeMode;
mOwner->GetSizeMode(&sizeMode);
int32_t sizeMode = mOwner->SizeMode();
if (!(ulStyle & WS_VISIBLE)) {
if (sizeMode == nsSizeMode_Maximized) {
ulFlags |= SWP_MAXIMIZE;
@ -314,9 +313,7 @@ void os2FrameWindow::ActivateTopLevelWidget()
// be restored as soon as the user clicks on it. When the user
// explicitly restores it, SetSizeMode() will call this method.
if (mNeedActivation) {
int32_t sizeMode;
mOwner->GetSizeMode(&sizeMode);
if (sizeMode != nsSizeMode_Minimized) {
if (mOwner->SizeMode() != nsSizeMode_Minimized) {
mNeedActivation = false;
DEBUGFOCUS(NS_ACTIVATE);
mOwner->DispatchActivationEvent(NS_ACTIVATE);
@ -333,8 +330,7 @@ void os2FrameWindow::ActivateTopLevelWidget()
nsresult os2FrameWindow::SetSizeMode(int32_t aMode)
{
int32_t previousMode;
mOwner->GetSizeMode(&previousMode);
int32_t previousMode = mOwner->SizeMode();
// save the new state
nsresult rv = mOwner->nsBaseWidget::SetSizeMode(aMode);

View File

@ -556,17 +556,6 @@ NS_IMETHODIMP nsBaseWidget::SetSizeMode(int32_t aMode)
return NS_ERROR_ILLEGAL_VALUE;
}
//-------------------------------------------------------------------------
//
// Get the size mode (minimized, maximized, that sort of thing...)
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseWidget::GetSizeMode(int32_t* aMode)
{
*aMode = mSizeMode;
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Get the foreground color

View File

@ -84,7 +84,10 @@ public:
nsIWidget *aWidget, bool aActivate);
NS_IMETHOD SetSizeMode(int32_t aMode);
NS_IMETHOD GetSizeMode(int32_t* aMode);
virtual int32_t SizeMode() MOZ_OVERRIDE
{
return mSizeMode;
}
virtual nscolor GetForegroundColor(void);
NS_IMETHOD SetForegroundColor(const nscolor &aColor);

View File

@ -461,11 +461,9 @@ CheckForFullscreenWindow()
windowList->GetNext(getter_AddRefs(supportsWindow));
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(supportsWindow));
if (baseWin) {
int32_t sizeMode;
nsCOMPtr<nsIWidget> widget;
baseWin->GetMainWidget(getter_AddRefs(widget));
if (widget && NS_SUCCEEDED(widget->GetSizeMode(&sizeMode)) &&
sizeMode == nsSizeMode_Fullscreen) {
if (widget && widget->SizeMode() == nsSizeMode_Fullscreen) {
return true;
}
}

View File

@ -208,12 +208,10 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(uint32_t aLevel)
/* refuse to raise a maximized window above the normal browser level,
for fear it could hide newly opened browser windows */
if (aLevel > nsIXULWindow::normalZ) {
int32_t sizeMode;
if (mWindow) {
mWindow->GetSizeMode(&sizeMode);
if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen)
return NS_ERROR_FAILURE;
if (aLevel > nsIXULWindow::normalZ && mWindow) {
int32_t sizeMode = mWindow->SizeMode();
if (sizeMode == nsSizeMode_Maximized || sizeMode == nsSizeMode_Fullscreen) {
return NS_ERROR_FAILURE;
}
}
@ -1460,12 +1458,11 @@ NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
return NS_OK;
}
int32_t x, y, cx, cy;
int32_t sizeMode;
// get our size, position and mode to persist
int32_t x, y, cx, cy;
NS_ENSURE_SUCCESS(GetPositionAndSize(&x, &y, &cx, &cy), NS_ERROR_FAILURE);
mWindow->GetSizeMode(&sizeMode);
int32_t sizeMode = mWindow->SizeMode();
double scale = mWindow->GetDefaultScale();
// make our position relative to our parent, if any