зеркало из https://github.com/mozilla/pjs.git
remove window tweaking and the hacks for it in the stub wdef. gets rid of negative width/height on windows when moving which OSX didn't like. prevent infinite recursion in live-resize code from us calling SizeWindow() ourselves. r=saari/sr=sfraser/a=asa, bugs 83629, 85110)
This commit is contained in:
Родитель
d1e165dcbc
Коммит
8739656c5c
|
@ -65,12 +65,6 @@ pascal long BorderlessWDEF ( short inCode, WindowPtr inWindow, short inMessage,
|
||||||
long CallSystemWDEF ( short inCode, WindowPtr inWindow, short inMessage, long inParam ) ;
|
long CallSystemWDEF ( short inCode, WindowPtr inWindow, short inMessage, long inParam ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// These magic adjustments are so that the contained webshells hangs one pixel
|
|
||||||
// off the right and bottom sides of the window. This aligns the scroll bar
|
|
||||||
// correctly, and compensates for different window frame dimentions on
|
|
||||||
// Windows and Mac.
|
|
||||||
#define WINDOW_SIZE_TWEAKING
|
|
||||||
|
|
||||||
#define kWindowPositionSlop 10
|
#define kWindowPositionSlop 10
|
||||||
|
|
||||||
// ¥¥¥ TODO: these should come from the system, not be hard-coded. What if I'm running
|
// ¥¥¥ TODO: these should come from the system, not be hard-coded. What if I'm running
|
||||||
|
@ -287,6 +281,7 @@ nsMacWindow::nsMacWindow() : Inherited()
|
||||||
, mZoomOnShow(PR_FALSE)
|
, mZoomOnShow(PR_FALSE)
|
||||||
, mPhantomScrollbar(nsnull)
|
, mPhantomScrollbar(nsnull)
|
||||||
, mPhantomScrollbarData(nsnull)
|
, mPhantomScrollbarData(nsnull)
|
||||||
|
, mResizeIsFromUs(PR_FALSE)
|
||||||
{
|
{
|
||||||
mMacEventHandler.reset(new nsMacEventHandler(this));
|
mMacEventHandler.reset(new nsMacEventHandler(this));
|
||||||
WIDGET_SET_CLASSNAME("nsMacWindow");
|
WIDGET_SET_CLASSNAME("nsMacWindow");
|
||||||
|
@ -477,12 +472,6 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent,
|
||||||
Rect wRect;
|
Rect wRect;
|
||||||
nsRectToMacRect(aRect, wRect);
|
nsRectToMacRect(aRect, wRect);
|
||||||
|
|
||||||
#ifdef WINDOW_SIZE_TWEAKING
|
|
||||||
// see also the Resize method
|
|
||||||
wRect.right --;
|
|
||||||
wRect.bottom --;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (eWindowType_popup != mWindowType)
|
if (eWindowType_popup != mWindowType)
|
||||||
::OffsetRect(&wRect, hOffset, vOffset + ::GetMBarHeight());
|
::OffsetRect(&wRect, hOffset, vOffset + ::GetMBarHeight());
|
||||||
else
|
else
|
||||||
|
@ -620,7 +609,7 @@ nsMacWindow :: WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef
|
||||||
|
|
||||||
// resize the window and repaint
|
// resize the window and repaint
|
||||||
nsMacWindow* self = NS_REINTERPRET_CAST(nsMacWindow*, userData);
|
nsMacWindow* self = NS_REINTERPRET_CAST(nsMacWindow*, userData);
|
||||||
if ( self ) {
|
if ( self && !self->mResizeIsFromUs ) {
|
||||||
self->mMacEventHandler->ResizeEvent(myWind);
|
self->mMacEventHandler->ResizeEvent(myWind);
|
||||||
self->mMacEventHandler->UpdateEvent();
|
self->mMacEventHandler->UpdateEvent();
|
||||||
}
|
}
|
||||||
|
@ -1036,18 +1025,14 @@ NS_IMETHODIMP nsMacWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepai
|
||||||
|
|
||||||
Rect macRect;
|
Rect macRect;
|
||||||
::GetWindowPortBounds ( mWindowPtr, &macRect );
|
::GetWindowPortBounds ( mWindowPtr, &macRect );
|
||||||
#ifdef WINDOW_SIZE_TWEAKING
|
|
||||||
macRect.right ++;
|
|
||||||
macRect.bottom ++;
|
|
||||||
#endif
|
|
||||||
if (((macRect.right - macRect.left) != aWidth)
|
if (((macRect.right - macRect.left) != aWidth)
|
||||||
|| ((macRect.bottom - macRect.top) != aHeight))
|
|| ((macRect.bottom - macRect.top) != aHeight))
|
||||||
{
|
{
|
||||||
#ifdef WINDOW_SIZE_TWEAKING
|
// make sure that we don't infinitely recurse if live-resize is on
|
||||||
::SizeWindow(mWindowPtr, aWidth - 1, aHeight - 1, aRepaint);
|
mResizeIsFromUs = PR_TRUE;
|
||||||
#else
|
|
||||||
::SizeWindow(mWindowPtr, aWidth, aHeight, aRepaint);
|
::SizeWindow(mWindowPtr, aWidth, aHeight, aRepaint);
|
||||||
#endif
|
mResizeIsFromUs = PR_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Inherited::Resize(aWidth, aHeight, aRepaint);
|
Inherited::Resize(aWidth, aHeight, aRepaint);
|
||||||
|
@ -1226,17 +1211,6 @@ BorderlessWDEF ( short inCode, WindowPtr inWindow, short inMessage, long inParam
|
||||||
case kWindowMsgGetFeatures:
|
case kWindowMsgGetFeatures:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kWindowMsgCalculateShape:
|
|
||||||
// Make the content area bigger so that it draws over the structure region. Use
|
|
||||||
// the sytem wdef to compute the struct/content regions and then play.
|
|
||||||
long result = CallSystemWDEF(inCode, inWindow, inMessage, inParam);
|
|
||||||
::InsetRgn(((WindowPeek)inWindow)->contRgn, -1, -1);
|
|
||||||
|
|
||||||
// for some reason, the topleft corner doesn't draw correctly unless i do this.
|
|
||||||
Rect& structRect = (**((WindowPeek)inWindow)->strucRgn).rgnBBox;
|
|
||||||
structRect.top++; structRect.left++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CallSystemWDEF(inCode, inWindow, inMessage, inParam);
|
return CallSystemWDEF(inCode, inWindow, inMessage, inParam);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -134,6 +134,7 @@ protected:
|
||||||
PRBool mAcceptsActivation;
|
PRBool mAcceptsActivation;
|
||||||
PRBool mIsActive;
|
PRBool mIsActive;
|
||||||
PRBool mZoomOnShow;
|
PRBool mZoomOnShow;
|
||||||
|
PRBool mResizeIsFromUs; // we originated the resize, prevent infinite recursion
|
||||||
|
|
||||||
ControlHandle mPhantomScrollbar; // a native scrollbar for the scrollwheel
|
ControlHandle mPhantomScrollbar; // a native scrollbar for the scrollwheel
|
||||||
PhantomScrollbarData* mPhantomScrollbarData;
|
PhantomScrollbarData* mPhantomScrollbarData;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче