mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 819725 pt 1 - make widget move & resize methods take floating-point parameters, to allow passing fractional coordinates without rounding. r=roc
This commit is contained in:
parent
2e8615df8f
commit
aa8404a74a
@ -406,8 +406,8 @@ nsWindow::ConstrainPosition(bool aAllowSlop,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Move(int32_t aX,
|
||||
int32_t aY)
|
||||
nsWindow::Move(double aX,
|
||||
double aY)
|
||||
{
|
||||
if (IsTopLevel())
|
||||
return NS_OK;
|
||||
@ -420,8 +420,8 @@ nsWindow::Move(int32_t aX,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
nsWindow::Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return Resize(mBounds.x,
|
||||
@ -432,20 +432,20 @@ nsWindow::Resize(int32_t aWidth,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
nsWindow::Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
ALOG("nsWindow[%p]::Resize [%d %d %d %d] (repaint %d)", (void*)this, aX, aY, aWidth, aHeight, aRepaint);
|
||||
ALOG("nsWindow[%p]::Resize [%f %f %f %f] (repaint %d)", (void*)this, aX, aY, aWidth, aHeight, aRepaint);
|
||||
|
||||
bool needSizeDispatch = aWidth != mBounds.width || aHeight != mBounds.height;
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.x = NSToIntRound(aX);
|
||||
mBounds.y = NSToIntRound(aY);
|
||||
mBounds.width = NSToIntRound(aWidth);
|
||||
mBounds.height = NSToIntRound(aHeight);
|
||||
|
||||
if (needSizeDispatch)
|
||||
OnSizeChanged(gfxIntSize(aWidth, aHeight));
|
||||
|
@ -79,15 +79,15 @@ public:
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
int32_t *aY);
|
||||
NS_IMETHOD Move(int32_t aX,
|
||||
int32_t aY);
|
||||
NS_IMETHOD Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
NS_IMETHOD Move(double aX,
|
||||
double aY);
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD SetZIndex(int32_t aZIndex);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||
|
@ -379,9 +379,10 @@ public:
|
||||
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX, int32_t *aY);
|
||||
NS_IMETHOD Move(int32_t aX, int32_t aY);
|
||||
NS_IMETHOD Resize(int32_t aWidth,int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX, int32_t aY,int32_t aWidth,int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD Move(double aX, double aY);
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint);
|
||||
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
virtual bool IsEnabled() const;
|
||||
|
@ -796,15 +796,18 @@ NS_IMETHODIMP nsChildView::ConstrainPosition(bool aAllowSlop,
|
||||
}
|
||||
|
||||
// Move this component, aX and aY are in the parent widget coordinate system
|
||||
NS_IMETHODIMP nsChildView::Move(int32_t aX, int32_t aY)
|
||||
NS_IMETHODIMP nsChildView::Move(double aX, double aY)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
if (!mView || (mBounds.x == aX && mBounds.y == aY))
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
|
||||
if (!mView || (mBounds.x == x && mBounds.y == y))
|
||||
return NS_OK;
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
|
||||
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||
|
||||
@ -819,15 +822,18 @@ NS_IMETHODIMP nsChildView::Move(int32_t aX, int32_t aY)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_IMETHODIMP nsChildView::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
if (!mView || (mBounds.width == aWidth && mBounds.height == aHeight))
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
|
||||
if (!mView || (mBounds.width == width && mBounds.height == height))
|
||||
return NS_OK;
|
||||
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.width = width;
|
||||
mBounds.height = height;
|
||||
|
||||
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||
|
||||
@ -842,22 +848,28 @@ NS_IMETHODIMP nsChildView::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChildView::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_IMETHODIMP nsChildView::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
BOOL isMoving = (mBounds.x != aX || mBounds.y != aY);
|
||||
BOOL isResizing = (mBounds.width != aWidth || mBounds.height != aHeight);
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
|
||||
BOOL isMoving = (mBounds.x != x || mBounds.y != y);
|
||||
BOOL isResizing = (mBounds.width != width || mBounds.height != height);
|
||||
if (!mView || (!isMoving && !isResizing))
|
||||
return NS_OK;
|
||||
|
||||
if (isMoving) {
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
}
|
||||
if (isResizing) {
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.width = width;
|
||||
mBounds.height = height;
|
||||
}
|
||||
|
||||
[mView setFrame:DevPixelsToCocoaPoints(mBounds)];
|
||||
|
@ -226,15 +226,15 @@ public:
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX, int32_t *aY);
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
||||
NS_IMETHOD Move(int32_t aX, int32_t aY);
|
||||
NS_IMETHOD Move(double aX, double aY);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||
nsIWidget *aWidget, bool aActivate);
|
||||
NS_IMETHOD SetSizeMode(int32_t aMode);
|
||||
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
||||
void EnteredFullScreen(bool aFullScreen);
|
||||
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
||||
NS_IMETHOD Resize(int32_t aWidth,int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||
void ReportMoveEvent();
|
||||
@ -325,7 +325,7 @@ protected:
|
||||
void CleanUpWindowFilter();
|
||||
void UpdateBounds();
|
||||
|
||||
nsresult DoResize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
nsresult DoResize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint, bool aConstrainToCurrentScreen);
|
||||
|
||||
virtual already_AddRefed<nsIWidget>
|
||||
|
@ -1125,7 +1125,7 @@ void nsCocoaWindow::SetSizeConstraints(const SizeConstraints& aConstraints)
|
||||
}
|
||||
|
||||
// Coordinates are global display pixels
|
||||
NS_IMETHODIMP nsCocoaWindow::Move(int32_t aX, int32_t aY)
|
||||
NS_IMETHODIMP nsCocoaWindow::Move(double aX, double aY)
|
||||
{
|
||||
if (!mWindow) {
|
||||
return NS_OK;
|
||||
@ -1135,7 +1135,7 @@ NS_IMETHODIMP nsCocoaWindow::Move(int32_t aX, int32_t aY)
|
||||
// it to Cocoa ones (origin bottom-left).
|
||||
NSPoint coord = {
|
||||
static_cast<float>(aX),
|
||||
static_cast<float>(nsCocoaUtils::FlippedScreenY(aY))
|
||||
static_cast<float>(nsCocoaUtils::FlippedScreenY(NSToIntRound(aY)))
|
||||
};
|
||||
|
||||
NSRect frame = [mWindow frame];
|
||||
@ -1308,8 +1308,8 @@ NS_METHOD nsCocoaWindow::MakeFullScreen(bool aFullScreen)
|
||||
}
|
||||
|
||||
// Coordinates are global display pixels
|
||||
nsresult nsCocoaWindow::DoResize(int32_t aX, int32_t aY,
|
||||
int32_t aWidth, int32_t aHeight,
|
||||
nsresult nsCocoaWindow::DoResize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint,
|
||||
bool aConstrainToCurrentScreen)
|
||||
{
|
||||
@ -1322,13 +1322,13 @@ nsresult nsCocoaWindow::DoResize(int32_t aX, int32_t aY,
|
||||
// ConstrainSize operates in device pixels, so we need to convert using
|
||||
// the backing scale factor here
|
||||
CGFloat scale = BackingScaleFactor();
|
||||
aWidth *= scale;
|
||||
aHeight *= scale;
|
||||
ConstrainSize(&aWidth, &aHeight);
|
||||
aWidth = NSToIntRound(aWidth / scale);
|
||||
aHeight = NSToIntRound(aHeight / scale);
|
||||
int32_t width = NSToIntRound(aWidth * scale);
|
||||
int32_t height = NSToIntRound(aHeight * scale);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
nsIntRect newBounds(aX, aY, aWidth, aHeight);
|
||||
nsIntRect newBounds(aX, aY,
|
||||
NSToIntRound(width / scale),
|
||||
NSToIntRound(height / scale));
|
||||
|
||||
// constrain to the screen that contains the largest area of the new rect
|
||||
FitRectToVisibleAreaForScreen(newBounds, aConstrainToCurrentScreen ?
|
||||
@ -1358,19 +1358,18 @@ nsresult nsCocoaWindow::DoResize(int32_t aX, int32_t aY,
|
||||
}
|
||||
|
||||
// Coordinates are global display pixels
|
||||
NS_IMETHODIMP nsCocoaWindow::Resize(int32_t aX, int32_t aY,
|
||||
int32_t aWidth, int32_t aHeight,
|
||||
NS_IMETHODIMP nsCocoaWindow::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return DoResize(aX, aY, aWidth, aHeight, aRepaint, false);
|
||||
}
|
||||
|
||||
// Coordinates are global display pixels
|
||||
NS_IMETHODIMP nsCocoaWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_IMETHODIMP nsCocoaWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
double invScale = 1.0 / GetDefaultScale();
|
||||
return DoResize(NSToIntRound(mBounds.x * invScale),
|
||||
NSToIntRound(mBounds.y * invScale),
|
||||
return DoResize(mBounds.x * invScale, mBounds.y * invScale,
|
||||
aWidth, aHeight, aRepaint, true);
|
||||
}
|
||||
|
||||
|
@ -373,30 +373,31 @@ nsWindow::ConstrainPosition(bool aAllowSlop,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Move(int32_t aX,
|
||||
int32_t aY)
|
||||
nsWindow::Move(double aX,
|
||||
double aY)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint)
|
||||
nsWindow::Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
return Resize(0, 0, aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint)
|
||||
nsWindow::Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
mBounds = nsIntRect(aX, aY, aWidth, aHeight);
|
||||
mBounds = nsIntRect(NSToIntRound(aX), NSToIntRound(aY),
|
||||
NSToIntRound(aWidth), NSToIntRound(aHeight));
|
||||
if (mWidgetListener)
|
||||
mWidgetListener->WindowResized(this, aWidth, aHeight);
|
||||
mWidgetListener->WindowResized(this, mBounds.width, mBounds.height);
|
||||
|
||||
if (aRepaint && gWindowToRedraw)
|
||||
gWindowToRedraw->Invalidate(sVirtualBounds);
|
||||
|
@ -61,15 +61,15 @@ public:
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
int32_t *aY);
|
||||
NS_IMETHOD Move(int32_t aX,
|
||||
int32_t aY);
|
||||
NS_IMETHOD Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
NS_IMETHOD Move(double aX,
|
||||
double aY);
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Enable(bool aState);
|
||||
virtual bool IsEnabled() const;
|
||||
|
@ -1012,15 +1012,17 @@ nsWindow::Show(bool aState)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
ConstrainSize(&aWidth, &aHeight);
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
// For top-level windows, aWidth and aHeight should possibly be
|
||||
// interpreted as frame bounds, but NativeResize treats these as window
|
||||
// bounds (Bug 581866).
|
||||
|
||||
mBounds.SizeTo(aWidth, aHeight);
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
if (!mCreated)
|
||||
return NS_OK;
|
||||
@ -1070,7 +1072,7 @@ nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
NativeResize(aWidth, aHeight, aRepaint);
|
||||
NativeResize(width, height, aRepaint);
|
||||
}
|
||||
else {
|
||||
mNeedsResize = true;
|
||||
@ -1081,21 +1083,25 @@ nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
|
||||
// send a resize notification if this is a toplevel
|
||||
if (mIsTopLevel || mListenForResizes) {
|
||||
DispatchResized(aWidth, aHeight);
|
||||
DispatchResized(width, height);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
bool aRepaint)
|
||||
nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
ConstrainSize(&aWidth, &aHeight);
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.SizeTo(aWidth, aHeight);
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
mBounds.SizeTo(width, height);
|
||||
|
||||
mNeedsMove = true;
|
||||
|
||||
@ -1111,7 +1117,7 @@ nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
// Are the bounds sane?
|
||||
if (AreBoundsSane()) {
|
||||
// Yep? Resize the window
|
||||
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
NativeResize(x, y, width, height, aRepaint);
|
||||
// Does it need to be shown because it was previously insane?
|
||||
if (mNeedsShow)
|
||||
NativeShow(true);
|
||||
@ -1136,7 +1142,7 @@ nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
NativeResize(x, y, width, height, aRepaint);
|
||||
}
|
||||
else {
|
||||
mNeedsResize = true;
|
||||
@ -1146,7 +1152,7 @@ nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
NotifyRollupGeometryChange();
|
||||
|
||||
if (mIsTopLevel || mListenForResizes) {
|
||||
DispatchResized(aWidth, aHeight);
|
||||
DispatchResized(width, height);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1169,11 +1175,14 @@ nsWindow::IsEnabled() const
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Move(int32_t aX, int32_t aY)
|
||||
nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
LOG(("nsWindow::Move [%p] %d %d\n", (void *)this,
|
||||
LOG(("nsWindow::Move [%p] %f %f\n", (void *)this,
|
||||
aX, aY));
|
||||
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
|
||||
if (mWindowType == eWindowType_toplevel ||
|
||||
mWindowType == eWindowType_dialog) {
|
||||
SetSizeMode(nsSizeMode_Normal);
|
||||
@ -1182,14 +1191,14 @@ nsWindow::Move(int32_t aX, int32_t aY)
|
||||
// Since a popup window's x/y coordinates are in relation to to
|
||||
// the parent, the parent might have moved so we always move a
|
||||
// popup window.
|
||||
if (aX == mBounds.x && aY == mBounds.y &&
|
||||
if (x == mBounds.x && y == mBounds.y &&
|
||||
mWindowType != eWindowType_popup)
|
||||
return NS_OK;
|
||||
|
||||
// XXX Should we do some AreBoundsSane check here?
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
|
||||
if (!mCreated)
|
||||
return NS_OK;
|
||||
@ -1197,10 +1206,10 @@ nsWindow::Move(int32_t aX, int32_t aY)
|
||||
mNeedsMove = false;
|
||||
|
||||
if (mIsTopLevel) {
|
||||
gtk_window_move(GTK_WINDOW(mShell), aX, aY);
|
||||
gtk_window_move(GTK_WINDOW(mShell), x, y);
|
||||
}
|
||||
else if (mGdkWindow) {
|
||||
gdk_window_move(mGdkWindow, aX, aY);
|
||||
gdk_window_move(mGdkWindow, x, y);
|
||||
}
|
||||
|
||||
NotifyRollupGeometryChange();
|
||||
|
@ -106,17 +106,17 @@ public:
|
||||
int32_t *aX,
|
||||
int32_t *aY);
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
||||
NS_IMETHOD Move(int32_t aX,
|
||||
int32_t aY);
|
||||
NS_IMETHOD Move(double aX,
|
||||
double aY);
|
||||
NS_IMETHOD Show (bool aState);
|
||||
NS_IMETHOD Resize (int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize (int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize (double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize (double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
virtual bool IsEnabled() const;
|
||||
|
||||
|
||||
|
@ -92,8 +92,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
#endif
|
||||
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0xdb9b0931, 0xebf9, 0x4e0d, \
|
||||
{ 0xb2, 0x0a, 0xf7, 0x5f, 0xcb, 0x17, 0xe6, 0xe1 } }
|
||||
{ 0x476D5716, 0xE225, 0x4497, \
|
||||
{ 0x80, 0x41, 0x92, 0xF8, 0x67, 0x59, 0xC4, 0x38 } }
|
||||
|
||||
/*
|
||||
* Window shadow styles
|
||||
@ -697,8 +697,14 @@ class nsIWidget : public nsISupports {
|
||||
* case with mixed hi-dpi and lo-dpi displays). This applies to all the
|
||||
* following Move and Resize widget APIs.
|
||||
*
|
||||
* Currently, only Mac OS X implements a display-/device-pixel distinction;
|
||||
* this may change in future, however.
|
||||
* The display-/device-pixel distinction becomes important for (at least)
|
||||
* Mac OS X with Hi-DPI (retina) displays, and Windows when the UI scale
|
||||
* factor is set to other than 100%.
|
||||
*
|
||||
* The Move and Resize methods take floating-point parameters, rather than
|
||||
* integer ones. This is important when manipulating top-level widgets,
|
||||
* where the coordinate system may not be an integral multiple of the
|
||||
* device-pixel space.
|
||||
**/
|
||||
|
||||
/**
|
||||
@ -711,7 +717,7 @@ class nsIWidget : public nsISupports {
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD Move(int32_t aX, int32_t aY) = 0;
|
||||
NS_IMETHOD Move(double aX, double aY) = 0;
|
||||
|
||||
/**
|
||||
* Reposition this widget so that the client area has the given offset.
|
||||
@ -726,7 +732,7 @@ class nsIWidget : public nsISupports {
|
||||
* screen coordinates)
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD MoveClient(int32_t aX, int32_t aY) = 0;
|
||||
NS_IMETHOD MoveClient(double aX, double aY) = 0;
|
||||
|
||||
/**
|
||||
* Resize this widget. Any size constraints set for the window by a
|
||||
@ -737,9 +743,9 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint) = 0;
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Move or resize this widget. Any size constraints set for the window by
|
||||
@ -752,11 +758,11 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRepaint whether the widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint) = 0;
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Resize the widget so that the inner client area has the given size.
|
||||
@ -766,9 +772,9 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ResizeClient(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint) = 0;
|
||||
NS_IMETHOD ResizeClient(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Resize and reposition the widget so tht inner client area has the given
|
||||
@ -787,11 +793,11 @@ class nsIWidget : public nsISupports {
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ResizeClient(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint) = 0;
|
||||
NS_IMETHOD ResizeClient(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Sets the widget's z-index.
|
||||
|
@ -803,10 +803,10 @@ void nsWindow::NS2PM_PARENT(POINTL& ptl)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
NS_METHOD nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
if (mFrame) {
|
||||
nsresult rv = mFrame->Move(aX, aY);
|
||||
nsresult rv = mFrame->Move(NSToIntRound(aX), NSToIntRound(aY));
|
||||
NotifyRollupGeometryChange();
|
||||
return rv;
|
||||
}
|
||||
@ -816,10 +816,11 @@ NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_METHOD nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
if (mFrame) {
|
||||
nsresult rv = mFrame->Resize(aWidth, aHeight, aRepaint);
|
||||
nsresult rv = mFrame->Resize(NSToIntRound(aWidth), NSToIntRound(aHeight),
|
||||
aRepaint);
|
||||
NotifyRollupGeometryChange();
|
||||
return rv;
|
||||
}
|
||||
@ -829,11 +830,16 @@ NS_METHOD nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_METHOD nsWindow::Resize(int32_t aX, int32_t aY,
|
||||
int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_METHOD nsWindow::Resize(double aX, double aY,
|
||||
double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
|
||||
if (mFrame) {
|
||||
nsresult rv = mFrame->Resize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
nsresult rv = mFrame->Resize(x, y, width, height, aRepaint);
|
||||
NotifyRollupGeometryChange();
|
||||
return rv;
|
||||
}
|
||||
@ -845,29 +851,29 @@ NS_METHOD nsWindow::Resize(int32_t aX, int32_t aY,
|
||||
if (!mWnd ||
|
||||
mWindowType == eWindowType_child ||
|
||||
mWindowType == eWindowType_plugin) {
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
mBounds.width = width;
|
||||
mBounds.height = height;
|
||||
}
|
||||
|
||||
// To keep top-left corner in the same place, use the new height
|
||||
// to calculate the coordinates for the top & bottom left corners.
|
||||
if (mWnd) {
|
||||
POINTL ptl = { aX, aY };
|
||||
POINTL ptl = { x, y };
|
||||
NS2PM_PARENT(ptl);
|
||||
ptl.y -= aHeight - 1;
|
||||
ptl.y -= height - 1;
|
||||
|
||||
// For popups, aX already gives the correct position.
|
||||
if (mWindowType == eWindowType_popup) {
|
||||
ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - aHeight - 1 - aY;
|
||||
ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) - height - 1 - y;
|
||||
}
|
||||
else if (mParent) {
|
||||
WinMapWindowPoints(mParent->mWnd, WinQueryWindow(mWnd, QW_PARENT),
|
||||
&ptl, 1);
|
||||
}
|
||||
|
||||
if (!WinSetWindowPos(mWnd, 0, ptl.x, ptl.y, aWidth, aHeight,
|
||||
if (!WinSetWindowPos(mWnd, 0, ptl.x, ptl.y, width, height,
|
||||
SWP_MOVE | SWP_SIZE) && aRepaint) {
|
||||
WinInvalidateRect(mWnd, 0, FALSE);
|
||||
}
|
||||
|
@ -151,11 +151,11 @@ public:
|
||||
NS_IMETHOD GetBounds(nsIntRect& aRect);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect& aRect);
|
||||
virtual nsIntPoint WidgetToScreenOffset();
|
||||
NS_IMETHOD Move(int32_t aX, int32_t aY);
|
||||
NS_IMETHOD Resize(int32_t aWidth, int32_t aHeight,
|
||||
NS_IMETHOD Move(double aX, double aY);
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX, int32_t aY,
|
||||
int32_t aWidth, int32_t aHeight,
|
||||
NS_IMETHOD Resize(double aX, double aY,
|
||||
double aWidth, double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||
nsIWidget* aWidget, bool aActivate);
|
||||
|
@ -545,26 +545,29 @@ nsWindow::ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Move(int32_t aX, int32_t aY)
|
||||
nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
LOG(("nsWindow::Move [%p] %d %d\n", (void *)this,
|
||||
LOG(("nsWindow::Move [%p] %f %f\n", (void *)this,
|
||||
aX, aY));
|
||||
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
|
||||
if (mIsTopLevel) {
|
||||
SetSizeMode(nsSizeMode_Normal);
|
||||
}
|
||||
|
||||
if (aX == mBounds.x && aY == mBounds.y)
|
||||
if (x == mBounds.x && y == mBounds.y)
|
||||
return NS_OK;
|
||||
|
||||
mNeedsMove = false;
|
||||
|
||||
// update the bounds
|
||||
QPointF pos( aX, aY );
|
||||
QPointF pos( x, y );
|
||||
if (mIsTopLevel) {
|
||||
QWidget *widget = GetViewWidget();
|
||||
NS_ENSURE_TRUE(widget, NS_OK);
|
||||
widget->move(aX, aY);
|
||||
widget->move(x, y);
|
||||
}
|
||||
else if (mWidget) {
|
||||
// the position of the widget is set relative to the parent
|
||||
@ -2952,10 +2955,10 @@ nsWindow::Show(bool aState)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
nsWindow::Resize(double aWidth, int32_t double, bool aRepaint)
|
||||
{
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.width = NSToIntRound(aWidth);
|
||||
mBounds.height = NSToIntRound(aHeight);
|
||||
|
||||
if (!mWidget)
|
||||
return NS_OK;
|
||||
@ -2989,7 +2992,7 @@ nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
NativeResize(aWidth, aHeight, aRepaint);
|
||||
NativeResize(mBounds.width, mBounds.height, aRepaint);
|
||||
}
|
||||
else {
|
||||
mNeedsResize = true;
|
||||
@ -2997,9 +3000,8 @@ nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
|
||||
// synthesize a resize event if this isn't a toplevel
|
||||
if (mIsTopLevel || mListenForResizes) {
|
||||
nsIntRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
|
||||
nsEventStatus status;
|
||||
DispatchResizeEvent(rect, status);
|
||||
DispatchResizeEvent(mBounds, status);
|
||||
}
|
||||
|
||||
NotifyRollupGeometryChange();
|
||||
@ -3007,13 +3009,13 @@ nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.x = NSToIntRound(aX);
|
||||
mBounds.y = NSToIntRound(aY);
|
||||
mBounds.width = NSToIntRound(aWidth);
|
||||
mBounds.height = NSToIntRound(aHeight);
|
||||
|
||||
mPlaced = true;
|
||||
|
||||
@ -3025,7 +3027,8 @@ nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
// Are the bounds sane?
|
||||
if (AreBoundsSane()) {
|
||||
// Yep? Resize the window
|
||||
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
NativeResize(mBounds.x, mBounds.y, mBounds.width, mBounds.height,
|
||||
aRepaint);
|
||||
// Does it need to be shown because it was previously insane?
|
||||
if (mNeedsShow)
|
||||
NativeShow(true);
|
||||
@ -3049,7 +3052,8 @@ nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
// For widgets that we listen for resizes for (widgets created
|
||||
// with native parents) we apparently _always_ have to resize. I
|
||||
// dunno why, but apparently we're lame like that.
|
||||
NativeResize(aX, aY, aWidth, aHeight, aRepaint);
|
||||
NativeResize(mBounds.x, mBounds.y, mBounds.width, mBounds.height,
|
||||
aRepaint);
|
||||
}
|
||||
else {
|
||||
mNeedsResize = true;
|
||||
@ -3058,9 +3062,8 @@ nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight,
|
||||
|
||||
if (mIsTopLevel || mListenForResizes) {
|
||||
// synthesize a resize event
|
||||
nsIntRect rect(aX, aY, aWidth, aHeight);
|
||||
nsEventStatus status;
|
||||
DispatchResizeEvent(rect, status);
|
||||
DispatchResizeEvent(mBounds, status);
|
||||
}
|
||||
|
||||
if (aRepaint)
|
||||
|
@ -116,16 +116,16 @@ public:
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop,
|
||||
int32_t *aX,
|
||||
int32_t *aY);
|
||||
NS_IMETHOD Move(int32_t aX,
|
||||
int32_t aY);
|
||||
NS_IMETHOD Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Move(double aX,
|
||||
double aY);
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
||||
nsIWidget *aWidget,
|
||||
bool aActivate);
|
||||
|
@ -1322,7 +1322,7 @@ nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints)
|
||||
}
|
||||
|
||||
// Move this component
|
||||
NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
NS_METHOD nsWindow::Move(double aX, double aY)
|
||||
{
|
||||
if (mWindowType == eWindowType_toplevel ||
|
||||
mWindowType == eWindowType_dialog) {
|
||||
@ -1342,8 +1342,8 @@ NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.x = NSToIntRound(aX);
|
||||
mBounds.y = NSToIntRound(aY);
|
||||
|
||||
if (mWnd) {
|
||||
#ifdef DEBUG
|
||||
@ -1357,7 +1357,8 @@ NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
RECT workArea;
|
||||
::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0);
|
||||
// no annoying assertions. just mention the issue.
|
||||
if (aX < 0 || aX >= workArea.right || aY < 0 || aY >= workArea.bottom) {
|
||||
if (mBounds.x < 0 || mBounds.x >= workArea.right ||
|
||||
mBounds.y < 0 || mBounds.y >= workArea.bottom) {
|
||||
PR_LOG(gWindowsLog, PR_LOG_ALWAYS,
|
||||
("window moved to offscreen position\n"));
|
||||
}
|
||||
@ -1378,7 +1379,7 @@ NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
(mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(nsIntRect(0, 0, mBounds.width, mBounds.height)))) {
|
||||
flags |= SWP_NOCOPYBITS;
|
||||
}
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0, flags));
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, mBounds.x, mBounds.y, 0, 0, flags));
|
||||
|
||||
SetThemeRegion();
|
||||
}
|
||||
@ -1387,14 +1388,16 @@ NS_METHOD nsWindow::Move(int32_t aX, int32_t aY)
|
||||
}
|
||||
|
||||
// Resize this component
|
||||
NS_METHOD nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_METHOD nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0 ) , "Negative width passed to nsWindow::Resize");
|
||||
NS_ASSERTION((aHeight >=0 ), "Negative height passed to nsWindow::Resize");
|
||||
ConstrainSize(&aWidth, &aHeight);
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
// Avoid unnecessary resizing calls
|
||||
if (mBounds.width == aWidth && mBounds.height == aHeight) {
|
||||
if (mBounds.width == width && mBounds.height == height) {
|
||||
if (aRepaint) {
|
||||
Invalidate();
|
||||
}
|
||||
@ -1403,12 +1406,12 @@ NS_METHOD nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (eTransparencyTransparent == mTransparencyMode)
|
||||
ResizeTranslucentWindow(aWidth, aHeight);
|
||||
ResizeTranslucentWindow(width, height);
|
||||
#endif
|
||||
|
||||
// Set cached value for lightweight and printing
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.width = width;
|
||||
mBounds.height = height;
|
||||
|
||||
if (mWnd) {
|
||||
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOMOVE;
|
||||
@ -1418,7 +1421,7 @@ NS_METHOD nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
}
|
||||
|
||||
ClearThemeRegion();
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, width, GetHeight(height), flags));
|
||||
SetThemeRegion();
|
||||
}
|
||||
|
||||
@ -1430,15 +1433,19 @@ NS_METHOD nsWindow::Resize(int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
}
|
||||
|
||||
// Resize this component
|
||||
NS_METHOD nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool aRepaint)
|
||||
NS_METHOD nsWindow::Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0 ), "Negative width passed to nsWindow::Resize");
|
||||
NS_ASSERTION((aHeight >=0 ), "Negative height passed to nsWindow::Resize");
|
||||
ConstrainSize(&aWidth, &aHeight);
|
||||
int32_t x = NSToIntRound(aX);
|
||||
int32_t y = NSToIntRound(aY);
|
||||
int32_t width = NSToIntRound(aWidth);
|
||||
int32_t height = NSToIntRound(aHeight);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
// Avoid unnecessary resizing calls
|
||||
if (mBounds.x == aX && mBounds.y == aY &&
|
||||
mBounds.width == aWidth && mBounds.height == aHeight) {
|
||||
if (mBounds.x == x && mBounds.y == y &&
|
||||
mBounds.width == width && mBounds.height == height) {
|
||||
if (aRepaint) {
|
||||
Invalidate();
|
||||
}
|
||||
@ -1447,14 +1454,14 @@ NS_METHOD nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeig
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (eTransparencyTransparent == mTransparencyMode)
|
||||
ResizeTranslucentWindow(aWidth, aHeight);
|
||||
ResizeTranslucentWindow(width, height);
|
||||
#endif
|
||||
|
||||
// Set cached value for lightweight and printing
|
||||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
mBounds.width = width;
|
||||
mBounds.height = height;
|
||||
|
||||
if (mWnd) {
|
||||
UINT flags = SWP_NOZORDER | SWP_NOACTIVATE;
|
||||
@ -1463,7 +1470,7 @@ NS_METHOD nsWindow::Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeig
|
||||
}
|
||||
|
||||
ClearThemeRegion();
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
|
||||
VERIFY(::SetWindowPos(mWnd, NULL, x, y, width, GetHeight(height), flags));
|
||||
SetThemeRegion();
|
||||
}
|
||||
|
||||
|
@ -95,9 +95,9 @@ public:
|
||||
virtual bool IsVisible() const;
|
||||
NS_IMETHOD ConstrainPosition(bool aAllowSlop, int32_t *aX, int32_t *aY);
|
||||
virtual void SetSizeConstraints(const SizeConstraints& aConstraints);
|
||||
NS_IMETHOD Move(int32_t aX, int32_t aY);
|
||||
NS_IMETHOD Resize(int32_t aWidth, int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD Move(double aX, double aY);
|
||||
NS_IMETHOD Resize(double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD BeginResizeDrag(nsGUIEvent* aEvent, int32_t aHorizontal, int32_t aVertical);
|
||||
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget *aWidget, bool aActivate);
|
||||
NS_IMETHOD SetSizeMode(int32_t aMode);
|
||||
|
@ -179,12 +179,12 @@ PuppetWidget::Show(bool aState)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PuppetWidget::Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint)
|
||||
PuppetWidget::Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
nsIntRect oldBounds = mBounds;
|
||||
mBounds.SizeTo(nsIntSize(aWidth, aHeight));
|
||||
mBounds.SizeTo(nsIntSize(NSToIntRound(aWidth), NSToIntRound(aHeight)));
|
||||
|
||||
if (mChild) {
|
||||
return mChild->Resize(aWidth, aHeight, aRepaint);
|
||||
|
@ -73,17 +73,17 @@ public:
|
||||
{ *aX = kMaxDimension; *aY = kMaxDimension; return NS_OK; }
|
||||
|
||||
// We're always at <0, 0>, and so ignore move requests.
|
||||
NS_IMETHOD Move(int32_t aX, int32_t aY)
|
||||
NS_IMETHOD Move(double aX, double aY)
|
||||
{ return NS_OK; }
|
||||
|
||||
NS_IMETHOD Resize(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
bool aRepaint)
|
||||
NS_IMETHOD Resize(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint);
|
||||
NS_IMETHOD Resize(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
// (we're always at <0, 0>)
|
||||
{ return Resize(aWidth, aHeight, aRepaint); }
|
||||
|
||||
|
@ -990,7 +990,7 @@ NS_METHOD nsBaseWidget::SetWindowClass(const nsAString& xulWinType)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::MoveClient(int32_t aX, int32_t aY)
|
||||
NS_METHOD nsBaseWidget::MoveClient(double aX, double aY)
|
||||
{
|
||||
nsIntPoint clientOffset(GetClientOffset());
|
||||
aX -= clientOffset.x;
|
||||
@ -998,8 +998,8 @@ NS_METHOD nsBaseWidget::MoveClient(int32_t aX, int32_t aY)
|
||||
return Move(aX, aY);
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::ResizeClient(int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
NS_METHOD nsBaseWidget::ResizeClient(double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
|
||||
@ -1013,10 +1013,10 @@ NS_METHOD nsBaseWidget::ResizeClient(int32_t aWidth,
|
||||
return Resize(aWidth, aHeight, aRepaint);
|
||||
}
|
||||
|
||||
NS_METHOD nsBaseWidget::ResizeClient(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aWidth,
|
||||
int32_t aHeight,
|
||||
NS_METHOD nsBaseWidget::ResizeClient(double aX,
|
||||
double aY,
|
||||
double aWidth,
|
||||
double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
NS_ASSERTION((aWidth >=0) , "Negative width passed to ResizeClient");
|
||||
|
@ -116,9 +116,9 @@ public:
|
||||
virtual gfxASurface* GetThebesSurface();
|
||||
NS_IMETHOD SetModal(bool aModal);
|
||||
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
|
||||
NS_IMETHOD MoveClient(int32_t aX, int32_t aY);
|
||||
NS_IMETHOD ResizeClient(int32_t aWidth, int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD ResizeClient(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight, bool aRepaint);
|
||||
NS_IMETHOD MoveClient(double aX, double aY);
|
||||
NS_IMETHOD ResizeClient(double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint);
|
||||
NS_IMETHOD GetBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetClientBounds(nsIntRect &aRect);
|
||||
NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
|
||||
|
Loading…
Reference in New Issue
Block a user