micheljung / fxstage

22 stars 4 forks source link

Two screens with different ui scaling messes up the window #5

Closed 1-alex98 closed 3 years ago

1-alex98 commented 3 years ago

1st screen = FHD + 150% scale 2nd screen = FHD + 100% scale

  1. Programm opens on 1st screen
  2. Is moved to second screen
  3. The whole top bar is broken (can not be clicked)
1-alex98 commented 3 years ago

OS: windows

1-alex98 commented 3 years ago

https://github.com/micheljung/fxstage/blob/3e065c47a2f7f68ea812fa044d96f6b0adcc47df/src/main/java/ch/micheljung/fxwindow/DecorationWindowProcedure.java#L160

1-alex98 commented 3 years ago

This line and other should probably not assume window is on the primary screen

1-alex98 commented 3 years ago

If I put both on 150% it is fine as well

1-alex98 commented 3 years ago

ok this problem is way more complex then i thought. There are screen coordinates and virtual coordinates used by java fx. Converting them on your own is nearly impossible.

Imagine the left screen is 150% that just makes the fsecond screen start at 1280 in virtual space but 1920 in screen coorinates... These kind of things are hell. I foun no funtion to convert them properly.

So how about just asking java fx where the mouse is and the window is instead of windoofs then we get the transforme coordinates and it works flawlessly.