You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have noticed some issues opening owned windows in mixed DPI environments on Windows OS. When a window is shown without an owner, the DPI and size of the window are scaled appropriately no matter which screen the window is opened on. When a window is shown as a child to another window, however, the DPI or size may be incorrect.
Environment Configuration
The following environment was used for testing:
Windows 11 23H2 (OS Build 22635.4655)
Avalonia 11.2.3 (testing with 11.0.x and 11.1.x also noted with each issue)
Primary monitor is 100% DPI
Secondary monitor is 150% DPI
Unfortunately, I have not been able to test on other platforms to know if this is unique to Windows.
Avalonia Problems
❌ Window of Unspecified Size Has Incorrect Scale When Shown On Different Monitor than Owner
If the owning application is positioned on the secondary (high DPI) monitor and it opens a window on the primary (100% DPI) monitor, the content of the window is scaled correctly, but the title bar is rendered too large (high DPI scale, same as owner). This issue was present on Avalonia 11.0.x to 11.2.x (tested 11.0.0, 11.0.13, 11.2.0, 11.1.5, 11.2.0, and 11.2.3).
// With owner on secondary monitorvarowner=(Window)TopLevel.GetTopLevel(this);varchild=newWindow(){// Position window on primary monitorPosition=owner.Screens.Primary.Bounds.Position};child.Show(owner);
Similarly, if the owning application is positioned on the primary (100% DPI) monitor and it opens a window on the secondary (high DPI) monitor, the content of the window is scaled correctly, but the title bar is rendered too small (100% scale, same as owner). Note this issue appears to have been introduced with Avalonia 11.2.0 as it was not present with Avalonia 11.0 (tested 11.0.0 and 11.0.13) or 11.1 (tested 11.1.0 and 11.1.5).
// With owner on primary monitorvarowner=(Window)TopLevel.GetTopLevel(this);varchild=newWindow(){// Position window on secondary monitorPosition=GetSecondaryScreen().Bounds.Position};child.Show(owner);
...
Screen GetSecondaryScreen()=> TopLevel.GetTopLevel(this).Screens.All.First(x =>x.Scaling>1.0);
In both scenarios, attempting to drag/move or drag/resize the window will result in the title bar updating to the correct scale.
❌ Window of Specific Size Displayed At Extra Large Size When Shown On High DPI Monitor with Owner on 100% DPI Monitor
If the owning application is positioned on the primary (100% DPI) monitor and it opens a child window to be located on the secondary (high DPI) monitor, the Width and Height of that window are adjusted multiple times resulting in the window display at a size close to if the window had been upscaled twice.
// With owner on primary monitorvarowner=(Window)TopLevel.GetTopLevel(this);varchild=newWindow(){// Position 300x300 window on secondary monitorWidth=300,Height=300,Position=GetSecondaryScreen().Bounds.Position};child.Show(owner);
...
Screen GetSecondaryScreen()=> TopLevel.GetTopLevel(this).Screens.All.First(x =>x.Scaling>1.0);
Attempting to display this 300x300 window in my environment with a 150% DPI secondary monitor has varying results in recent Avalonia versions:
Avalonia 11.2 (tested 11.2.0 and 11.2.3) results in a window whose width is 735.33 and height is 712.66.
Avalonia 11.1 (tested 11.1.0 and 11.1.5) works "close enough" with width of 300.67 and height of 300, although it should be noted that opening a window without an owner results in a perfect 300x300 window.
Avalonia 11.0 (tested 11.0.0 and 11.0.13) essentially ignores the 300x300 size and displays at 1905x986 (which is the same size of a window opened on this monitor when no explicit size is given).
❌ Window of Specific Size Displayed At Slightly Incorrect Size When Shown On 100% DPI Monitor with Owner on High DPI Monitor
If the owning application is positioned on the secondary (high DPI) monitor and it opens a child window to be located on the primary (100% DPI) monitor, the Width and Height of that window are slightly off.
// With owner on secondary monitorvarowner=(Window)TopLevel.GetTopLevel(this);varchild=newWindow(){// Position 300x300 window on primary monitorWidth=300,Height=300,Position=owner.Screens.Primary.Bounds.Position};child.Show(owner);
Attempting to display this 300x300 window in my environment with a 150% DPI secondary monitor has varying results i recent Avalonia versions:
Avalonia 11.2 (tested 11.2.0 and 11.2.3) results in a window whose width is 317 and height is 294.
Avalonia 11.1 (tested 11.1.0 and 11.2.5) works as expected with 300x300 window.
Avalonia 11.0 (tested 11.0.0 and 11.0.13) works as expected with 300x300 window.
To Reproduce
See sample code above
Expected behavior
No response
Avalonia version
11.2.3
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
We have noticed some issues opening owned windows in mixed DPI environments on Windows OS. When a window is shown without an owner, the DPI and size of the window are scaled appropriately no matter which screen the window is opened on. When a window is shown as a child to another window, however, the DPI or size may be incorrect.
Environment Configuration
The following environment was used for testing:
Unfortunately, I have not been able to test on other platforms to know if this is unique to Windows.
Avalonia Problems
❌ Window of Unspecified Size Has Incorrect Scale When Shown On Different Monitor than Owner
If the owning application is positioned on the secondary (high DPI) monitor and it opens a window on the primary (100% DPI) monitor, the content of the window is scaled correctly, but the title bar is rendered too large (high DPI scale, same as owner). This issue was present on Avalonia 11.0.x to 11.2.x (tested 11.0.0, 11.0.13, 11.2.0, 11.1.5, 11.2.0, and 11.2.3).
Similarly, if the owning application is positioned on the primary (100% DPI) monitor and it opens a window on the secondary (high DPI) monitor, the content of the window is scaled correctly, but the title bar is rendered too small (100% scale, same as owner). Note this issue appears to have been introduced with Avalonia 11.2.0 as it was not present with Avalonia 11.0 (tested 11.0.0 and 11.0.13) or 11.1 (tested 11.1.0 and 11.1.5).
In both scenarios, attempting to drag/move or drag/resize the window will result in the title bar updating to the correct scale.
❌ Window of Specific Size Displayed At Extra Large Size When Shown On High DPI Monitor with Owner on 100% DPI Monitor
If the owning application is positioned on the primary (100% DPI) monitor and it opens a child window to be located on the secondary (high DPI) monitor, the Width and Height of that window are adjusted multiple times resulting in the window display at a size close to if the window had been upscaled twice.
Attempting to display this
300x300
window in my environment with a 150% DPI secondary monitor has varying results in recent Avalonia versions:735.33
and height is712.66
.300.67
and height of300
, although it should be noted that opening a window without an owner results in a perfect300x300
window.300x300
size and displays at1905x986
(which is the same size of a window opened on this monitor when no explicit size is given).❌ Window of Specific Size Displayed At Slightly Incorrect Size When Shown On 100% DPI Monitor with Owner on High DPI Monitor
If the owning application is positioned on the secondary (high DPI) monitor and it opens a child window to be located on the primary (100% DPI) monitor, the Width and Height of that window are slightly off.
Attempting to display this
300x300
window in my environment with a 150% DPI secondary monitor has varying results i recent Avalonia versions:317
and height is294
.300x300
window.300x300
window.To Reproduce
See sample code above
Expected behavior
No response
Avalonia version
11.2.3
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: