|
|
|
@ -163,7 +163,7 @@ namespace Avalonia.X11 |
|
|
|
var surfaces = new List<object> |
|
|
|
{ |
|
|
|
new X11FramebufferSurface(_x11.DeferredDisplay, _renderHandle, |
|
|
|
depth, () => Scaling) |
|
|
|
depth, () => RenderScaling) |
|
|
|
}; |
|
|
|
|
|
|
|
if (egl != null) |
|
|
|
@ -217,7 +217,7 @@ namespace Avalonia.X11 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public double Scaling => _window.Scaling; |
|
|
|
public double Scaling => _window.RenderScaling; |
|
|
|
} |
|
|
|
|
|
|
|
void UpdateMotifHints() |
|
|
|
@ -284,9 +284,9 @@ namespace Avalonia.X11 |
|
|
|
XSetWMNormalHints(_x11.Display, _handle, ref hints); |
|
|
|
} |
|
|
|
|
|
|
|
public Size ClientSize => new Size(_realSize.Width / Scaling, _realSize.Height / Scaling); |
|
|
|
public Size ClientSize => new Size(_realSize.Width / RenderScaling, _realSize.Height / RenderScaling); |
|
|
|
|
|
|
|
public double Scaling |
|
|
|
public double RenderScaling |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
@ -296,6 +296,8 @@ namespace Avalonia.X11 |
|
|
|
} |
|
|
|
private set => _scaling = value; |
|
|
|
} |
|
|
|
|
|
|
|
public double DesktopScaling => RenderScaling; |
|
|
|
|
|
|
|
public IEnumerable<object> Surfaces { get; } |
|
|
|
public Action<RawInputEventArgs> Input { get; set; } |
|
|
|
@ -538,14 +540,14 @@ namespace Avalonia.X11 |
|
|
|
{ |
|
|
|
var monitor = _platform.X11Screens.Screens.OrderBy(x => x.PixelDensity) |
|
|
|
.FirstOrDefault(m => m.Bounds.Contains(Position)); |
|
|
|
newScaling = monitor?.PixelDensity ?? Scaling; |
|
|
|
newScaling = monitor?.PixelDensity ?? RenderScaling; |
|
|
|
} |
|
|
|
|
|
|
|
if (Scaling != newScaling) |
|
|
|
if (RenderScaling != newScaling) |
|
|
|
{ |
|
|
|
var oldScaledSize = ClientSize; |
|
|
|
Scaling = newScaling; |
|
|
|
ScalingChanged?.Invoke(Scaling); |
|
|
|
RenderScaling = newScaling; |
|
|
|
ScalingChanged?.Invoke(RenderScaling); |
|
|
|
SetMinMaxSize(_scaledMinMaxSize.minSize, _scaledMinMaxSize.maxSize); |
|
|
|
if(!skipResize) |
|
|
|
Resize(oldScaledSize, true); |
|
|
|
@ -707,9 +709,9 @@ namespace Avalonia.X11 |
|
|
|
private void ScheduleInput(RawInputEventArgs args) |
|
|
|
{ |
|
|
|
if (args is RawPointerEventArgs mouse) |
|
|
|
mouse.Position = mouse.Position / Scaling; |
|
|
|
mouse.Position = mouse.Position / RenderScaling; |
|
|
|
if (args is RawDragEvent drag) |
|
|
|
drag.Location = drag.Location / Scaling; |
|
|
|
drag.Location = drag.Location / RenderScaling; |
|
|
|
|
|
|
|
_lastEvent = new InputEventContainer() {Event = args}; |
|
|
|
_inputQueue.Enqueue(_lastEvent); |
|
|
|
@ -816,11 +818,11 @@ namespace Avalonia.X11 |
|
|
|
|
|
|
|
public void Hide() => XUnmapWindow(_x11.Display, _handle); |
|
|
|
|
|
|
|
public Point PointToClient(PixelPoint point) => new Point((point.X - Position.X) / Scaling, (point.Y - Position.Y) / Scaling); |
|
|
|
public Point PointToClient(PixelPoint point) => new Point((point.X - Position.X) / RenderScaling, (point.Y - Position.Y) / RenderScaling); |
|
|
|
|
|
|
|
public PixelPoint PointToScreen(Point point) => new PixelPoint( |
|
|
|
(int)(point.X * Scaling + Position.X), |
|
|
|
(int)(point.Y * Scaling + Position.Y)); |
|
|
|
(int)(point.X * RenderScaling + Position.X), |
|
|
|
(int)(point.Y * RenderScaling + Position.Y)); |
|
|
|
|
|
|
|
public void SetSystemDecorations(SystemDecorations enabled) |
|
|
|
{ |
|
|
|
@ -840,7 +842,7 @@ namespace Avalonia.X11 |
|
|
|
Resize(size, true); |
|
|
|
} |
|
|
|
|
|
|
|
PixelSize ToPixelSize(Size size) => new PixelSize((int)(size.Width * Scaling), (int)(size.Height * Scaling)); |
|
|
|
PixelSize ToPixelSize(Size size) => new PixelSize((int)(size.Width * RenderScaling), (int)(size.Height * RenderScaling)); |
|
|
|
|
|
|
|
void Resize(Size clientSize, bool force) |
|
|
|
{ |
|
|
|
@ -1020,13 +1022,13 @@ namespace Avalonia.X11 |
|
|
|
{ |
|
|
|
_scaledMinMaxSize = (minSize, maxSize); |
|
|
|
var min = new PixelSize( |
|
|
|
(int)(minSize.Width < 1 ? 1 : minSize.Width * Scaling), |
|
|
|
(int)(minSize.Height < 1 ? 1 : minSize.Height * Scaling)); |
|
|
|
(int)(minSize.Width < 1 ? 1 : minSize.Width * RenderScaling), |
|
|
|
(int)(minSize.Height < 1 ? 1 : minSize.Height * RenderScaling)); |
|
|
|
|
|
|
|
const int maxDim = MaxWindowDimension; |
|
|
|
var max = new PixelSize( |
|
|
|
(int)(maxSize.Width > maxDim ? maxDim : Math.Max(min.Width, maxSize.Width * Scaling)), |
|
|
|
(int)(maxSize.Height > maxDim ? maxDim : Math.Max(min.Height, maxSize.Height * Scaling))); |
|
|
|
(int)(maxSize.Width > maxDim ? maxDim : Math.Max(min.Width, maxSize.Width * RenderScaling)), |
|
|
|
(int)(maxSize.Height > maxDim ? maxDim : Math.Max(min.Height, maxSize.Height * RenderScaling))); |
|
|
|
|
|
|
|
_minMaxSize = (min, max); |
|
|
|
UpdateSizeHints(null); |
|
|
|
|