зеркало из https://github.com/mozilla/pjs.git
Bug 429954 - Windows that open already maximized will un-maximize to a teeny-tiny window in upper left.
Disallow zooming of windows that already have the zoomed size but have never been zoomed, because otherwise bad things happen to the window size. Moreover, reflect the window's zoom state in its size mode as nsSizeMode_Maximized. r=josh --HG-- extra : rebase_source : 46b161efcc60cefc9d9eb019d48f595c26eed6af
This commit is contained in:
Родитель
a43cb60f2d
Коммит
cc05a289b9
|
@ -103,6 +103,7 @@ typedef struct _nsCocoaWindowList {
|
|||
// NS_DEACTIVATE to Gecko for toplevel widgets. Starts out
|
||||
// PR_FALSE.
|
||||
PRBool mToplevelActiveState;
|
||||
BOOL mHasEverBeenZoomed;
|
||||
}
|
||||
+ (void)paintMenubarForWindow:(NSWindow*)aWindow;
|
||||
- (id)initWithGeckoWindow:(nsCocoaWindow*)geckoWind;
|
||||
|
@ -238,8 +239,7 @@ public:
|
|||
virtual void SetShowsToolbarButton(PRBool aShow);
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
|
||||
|
||||
// dispatch an NS_SIZEMODE event on miniaturize or deminiaturize
|
||||
void DispatchSizeModeEvent(nsSizeMode aSizeMode);
|
||||
void DispatchSizeModeEvent();
|
||||
|
||||
virtual gfxASurface* GetThebesSurface();
|
||||
|
||||
|
|
|
@ -1272,10 +1272,11 @@ nsCocoaWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
|
|||
}
|
||||
|
||||
void
|
||||
nsCocoaWindow::DispatchSizeModeEvent(nsSizeMode aSizeMode)
|
||||
nsCocoaWindow::DispatchSizeModeEvent()
|
||||
{
|
||||
nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
|
||||
event.mSizeMode = aSizeMode;
|
||||
event.mSizeMode = [mWindow isMiniaturized] ? nsSizeMode_Minimized :
|
||||
[mWindow isZoomed] ? nsSizeMode_Maximized : nsSizeMode_Normal;
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
@ -1583,6 +1584,7 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut)
|
|||
[super init];
|
||||
mGeckoWindow = geckoWind;
|
||||
mToplevelActiveState = PR_FALSE;
|
||||
mHasEverBeenZoomed = PR_FALSE;
|
||||
return self;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
|
@ -1600,6 +1602,8 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut)
|
|||
if (!mGeckoWindow || mGeckoWindow->IsResizing())
|
||||
return;
|
||||
|
||||
// Resizing might have changed our zoom state.
|
||||
mGeckoWindow->DispatchSizeModeEvent();
|
||||
mGeckoWindow->ReportSizeEvent();
|
||||
}
|
||||
|
||||
|
@ -1700,13 +1704,22 @@ nsCocoaWindow::UnifiedShading(void* aInfo, const float* aIn, float* aOut)
|
|||
- (void)windowDidMiniaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if (mGeckoWindow)
|
||||
mGeckoWindow->DispatchSizeModeEvent(nsSizeMode_Minimized);
|
||||
mGeckoWindow->DispatchSizeModeEvent();
|
||||
}
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if (mGeckoWindow)
|
||||
mGeckoWindow->DispatchSizeModeEvent(nsSizeMode_Normal);
|
||||
mGeckoWindow->DispatchSizeModeEvent();
|
||||
}
|
||||
|
||||
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)proposedFrame
|
||||
{
|
||||
if (!mHasEverBeenZoomed && [window isZoomed])
|
||||
return NO; // See bug 429954.
|
||||
|
||||
mHasEverBeenZoomed = YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)sendFocusEvent:(PRUint32)eventType
|
||||
|
|
Загрузка…
Ссылка в новой задаче