sn4k3 / UVtools

MSLA/DLP, file analysis, calibration, repair, conversion and manipulation
GNU Affero General Public License v3.0
1.15k stars 103 forks source link

[Bug] Dialog windows behave erratically with a multiple monitor setup #829

Closed p0916 closed 5 months ago

p0916 commented 6 months ago

System

UVtools v4.1.0 X64
Operative system: Microsoft Windows 10.0.22621 X64
Processor: AMD Ryzen 7 7700X 8-Core Processor             
Processor cores: 16
Memory RAM: 13.79 / 31.75 GB
Runtime: win10-x64
Framework: .NET 6.0.26
AvaloniaUI: 11.0.7
OpenCV: 4.8.1

Sreens, resolution, working area, usable area:
1: 2560 x 1440 @ 100% (Primary)
    WA: 2560 x 1440    UA: 2560 x 1440
2: 1920 x 1080 @ 100%
    WA: 1920 x 1080    UA: 1920 x 1080
3: 1440 x 2560 @ 100% (On this)
    WA: 1440 x 2560    UA: 1440 x 2560

Path:       C:\Program Files\UVtools\
Executable: C:\Program Files\UVtools\UVtools.exe
Loaded file: conesv2_elegG2.ctb [Version: 0] [Class: CTBEncryptedFile]

Printer and Slicer

No response

Description of the bug

I have a 3 monitor setup. I tried to use uvtools on a secondary monitor. Every dialog window will only open on the monitor marked in windows as the main display, despite being open in a different monitor. It will also open the dialog window maximized to the size of the monitor that uvtools is actually open in.

How to reproduce

  1. Move UVtools to a secondary monitor in portrait mode
  2. Open a dialog window.

Shows my monitor setup and the behavior when I open "Exposure Time Finder" with uvtools on my secondary monitor. I can not scroll down past "Object Configuration" because the dialog window is opened to a maximum size of my secondary monitor since that is the monitor uvtools is actually in uvtools1

Shows the actual size the "Exposure Time Finder" dialog box is trying to be displayed in my main display uvtools2

uvtools should open dialog boxes relative to its current location

Files

No response

github-actions[bot] commented 6 months ago

This is your first time submitting an issue with UVtools 🥳Please review your issue and ensure that the submit template was followed, the information is complete, and not related to any other open issue. It will be reviewed shortly. Debugging is very important and make the program better. Thanks for contributing and making the software better! 🙌

sn4k3 commented 6 months ago

I have only two monitors with different resolution, and I can't reproduce this. Moving UVtools to secondary monitor and open a tool window results in correct behavior: Tool window open center in same monitor as UVtools main window.

image

Every window is set to spawn at center of its parent(Main window), so what happen with you is unexpected. However, this is out of UVtools scope, the UI Framework (Avalonia) is who manage the spawns, start positions, scales, etc. While is possible to move the window by code, that is not what we want. As you can reproduce the bug, I recommend you open the issue here: https://github.com/AvaloniaUI/Avalonia/issues

One thing you can try: Do not maximize the main window, keep it smaller than your monitor resolution, open a tool, does it produce same effect?

For UVtools open in the last used monitor you need to change settings:

image

If still have problems, you can unlock windows to able to resize them, and that will fix the cut content when you resize them:

image

p0916 commented 6 months ago

Thank you for the quick reply! No matter the settings I change in uvtools, the dialog boxes will only open in which ever monitor is set to "main display" within windows. uvtools, itself, will also not open in the last position it was closed if it was closed outside of the main display. This seems to be a windows and/or Avalonia issue.

My apologies as I was unaware of Avalonia and this appears to be an external bug not directly related to uvtools. I appreciate the help!

sn4k3 commented 6 months ago

Avalonia main window always open on primary monitor or from where it got triggered (If you create a shortcut on that monitor it should spawn on that monitor). UVtools then reposition the main window based on last coordinates (If you have those checkboxes on). After quitting it save window last coordinates and restore on next startup. It work on my setup so I guess the problem is in that configuration. Can you try to position all screens landscape and side by side (Just in windows settings) and try?

https://github.com/sn4k3/UVtools/blob/8d852a9a02f992d3bf3b188b0bff9bbd1881f8b7/UVtools.UI/Windows/ToolWindow.axaml#L15C9-L15C44

WindowStartupLocation="CenterOwner"

However the tool window should spawn in center of its parent, so I really think it wroth to open the issue on their side. Because it open in other monitor, the tool window gets the size and scale of that monitor. Thats why you need to check the resize option and resize it after all to fix it wrong auto-size.