mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1239855 - Fix for widget positioning/sizing on hidpi displays under Gtk. r=emk
This commit is contained in:
parent
06e58001b4
commit
c83d5c5d67
@ -1086,10 +1086,9 @@ nsWindow::Show(bool aState)
|
||||
NS_IMETHODIMP
|
||||
nsWindow::Resize(double aWidth, double aHeight, bool aRepaint)
|
||||
{
|
||||
CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
|
||||
: CSSToLayoutDeviceScale(1.0);
|
||||
int32_t width = NSToIntRound(scale.scale * aWidth);
|
||||
int32_t height = NSToIntRound(scale.scale * aHeight);
|
||||
double scale = BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
|
||||
int32_t width = NSToIntRound(scale * aWidth);
|
||||
int32_t height = NSToIntRound(scale * aHeight);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
// For top-level windows, aWidth and aHeight should possibly be
|
||||
@ -1118,14 +1117,13 @@ NS_IMETHODIMP
|
||||
nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
||||
bool aRepaint)
|
||||
{
|
||||
CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
|
||||
: CSSToLayoutDeviceScale(1.0);
|
||||
int32_t width = NSToIntRound(scale.scale * aWidth);
|
||||
int32_t height = NSToIntRound(scale.scale * aHeight);
|
||||
double scale = BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
|
||||
int32_t width = NSToIntRound(scale * aWidth);
|
||||
int32_t height = NSToIntRound(scale * aHeight);
|
||||
ConstrainSize(&width, &height);
|
||||
|
||||
int32_t x = NSToIntRound(scale.scale * aX);
|
||||
int32_t y = NSToIntRound(scale.scale * aY);
|
||||
int32_t x = NSToIntRound(scale * aX);
|
||||
int32_t y = NSToIntRound(scale * aY);
|
||||
mBounds.x = x;
|
||||
mBounds.y = y;
|
||||
mBounds.SizeTo(width, height);
|
||||
@ -1184,10 +1182,9 @@ nsWindow::Move(double aX, double aY)
|
||||
LOG(("nsWindow::Move [%p] %f %f\n", (void *)this,
|
||||
aX, aY));
|
||||
|
||||
CSSToLayoutDeviceScale scale = BoundsUseDesktopPixels() ? GetDefaultScale()
|
||||
: CSSToLayoutDeviceScale(1.0);
|
||||
int32_t x = NSToIntRound(aX * scale.scale);
|
||||
int32_t y = NSToIntRound(aY * scale.scale);
|
||||
double scale = BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
|
||||
int32_t x = NSToIntRound(aX * scale);
|
||||
int32_t y = NSToIntRound(aY * scale);
|
||||
|
||||
if (mWindowType == eWindowType_toplevel ||
|
||||
mWindowType == eWindowType_dialog) {
|
||||
|
@ -104,6 +104,11 @@ public:
|
||||
virtual nsIWidget *GetParent() override;
|
||||
virtual float GetDPI() override;
|
||||
virtual double GetDefaultScaleInternal() override;
|
||||
// Under Gtk, we manage windows using device pixels so no scaling is needed:
|
||||
mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() final
|
||||
{
|
||||
return mozilla::DesktopToLayoutDeviceScale(1.0);
|
||||
}
|
||||
virtual nsresult SetParent(nsIWidget* aNewParent) override;
|
||||
NS_IMETHOD SetModal(bool aModal) override;
|
||||
virtual bool IsVisible() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user