Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua + WinForms + High DPI #2604

Closed
Isotarge opened this issue Feb 1, 2021 · 10 comments
Closed

Lua + WinForms + High DPI #2604

Isotarge opened this issue Feb 1, 2021 · 10 comments
Labels
re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) Repro: Fixed/added in 2.6.2 Request: Feature/Enhancement For feature requests or possible improvements

Comments

@Isotarge
Copy link
Contributor

Isotarge commented Feb 1, 2021

ScriptHawk users are starting to complain about the window Lua creates being too small on their 4K screens, with important text being cut off.

106403526-c5678d00-63f4-11eb-881a-f3ff9b36e337

The bug report on ScriptHawk repo is here Isotarge/ScriptHawk#14

We have a root value called ScriptHawk.UI.button_height which scales almost everything on the form dynamically but bumping this value up for high DPI screens still has a number of issues.

8301f9513213795a6608fa8c6617c775

As far as I know, there's currently no way to detect the DPI of the screen that we're running on from Lua.

Would it be feasible for BizHawk to transparently scale up the numbers that get passed to the Lua WinForms bindings based on DPI? Alternatively, could we turn on some flag in the form so that Windows does it for us?

@YoshiRulz
Copy link
Member

@YoshiRulz YoshiRulz added Request: Feature/Enhancement For feature requests or possible improvements re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) labels Feb 1, 2021
@Isotarge
Copy link
Contributor Author

Isotarge commented Feb 2, 2021

No luck unfortunately, I tried prodding that enum with all the possible values and the forms are identical, granted I am simulating a high DPI screen with the 200% scaling option in Windows (I don't have a 4K screen to test with).
ScriptHawk My Machine 200percent scale bugged

@ScHlAuChii
Copy link

I ran into a similar problem in 2.6 on my 4K monitor:
Bizhawk-4K-Bug

No Record Button - but you can still record by selecting it with the cursor even if its invisible!

YoshiRulz added a commit that referenced this issue Mar 19, 2021
@YoshiRulz
Copy link
Member

@Isotarge New branch for you to try: fix-2604 (and the pipeline).

@YoshiRulz YoshiRulz added the Repro: Patch pending Potentially fixed in dev build, see readme for download label Mar 19, 2021
@Isotarge
Copy link
Contributor Author

Seems very promising at 200% Windows Scaling setting on my 1440p monitor. Still some minor issues with checkbox labels but that might be on ScriptHawk's end? I'm not 100% sure, would have to look into it. @retrobenny would you be willing to test this build for us on your 4K screen?
dk641440pscripthawkfix

@retrobenny
Copy link

I will try to remember to get the build and check how it behaves on my 4K screen some time soon,I already had just turned off my PC and its late into the early morning now before I saw this,I was messing with DK64 physics fixing on 60fps (in PJ64) with promising results and stayed on late.

@retrobenny
Copy link

retrobenny commented Mar 20, 2021

...how do I even grab the build on gitlab? >_>

All I get in the zip is an xml file.

Edit; Oh,I had to do something non-obvious and click into the rounded button part for build in pipeline instead of from jobs.

@retrobenny
Copy link

Seems to be working fine with DK64!

Bizhawk Scripthawk DK64

@YoshiRulz YoshiRulz added Repro: Fixed/added in 2.6.2 and removed Repro: Patch pending Potentially fixed in dev build, see readme for download labels Mar 20, 2021
@YoshiRulz
Copy link
Member

Oh,I had to do something non-obvious and click into the rounded button part for build in pipeline instead of from jobs.

My bad, I forgot the package step is only for master.


Not sure why checkboxes would be behaving differently. IIRC the box part is drawn inside the padding, so it should use Height, which is what the Lua lib sets. I've merged the change anyway.

@Deakula
Copy link

Deakula commented Sep 5, 2023

As far as I can tell, this issue is still present in version 2.9.1

I have a 3 monitor setup in Windows 11. Two of those monitors are set to a resolution of 1920x1080, and the main monitor is set to a resolution of 3840x2160. Regardless of the Windows scale setting for the two 1920x1080 monitors, I observe 3 different behaviors when opening BizHawk on my main 4K monitor:

  1. When BizHawk is opened on the 4K monitor and Windows scaling is set to 100%, BizHawk, tools such as TAStudio, and all Lua forms display as expected (albeit too small to be usable with a large 4K display at 100% scaling).
    Scale 100
    TAStudio 100

  2. When the Windows scaling of the 4K monitor is changed to anything but 100% (eg. 200%) after BizHawk was already opened with Windows scaling set to 100%, BizHawk, tools such as TAStudio, and all Lua forms continue to display correctly (albeit improperly scaled up causing some elements to appear blurry). This is expected behavior as many apps need to be restarted to properly respond to a scale change in Windows.
    Scale 200 after 100
    TAStudio 200 after 100

  3. When BizHawk is opened on the 4K monitor while the scaling is set to anything but 100% (eg. 200%), some BizHawk GUI text (eg. FPS), tools such as TAStudio, and all Lua forms are not displayed correctly. Lua forms in particular have incorrect proportions for drawn elements, and elements such as buttons and labels get squished and have their text cut off. In tools like TAStudio, some portions of the UI are also cut off.
    Scale 200
    TAStudio 200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: Lua API/scripting Relating to EmuHawk's Lua API (not the Lua Console) Repro: Fixed/added in 2.6.2 Request: Feature/Enhancement For feature requests or possible improvements
Projects
None yet
Development

No branches or pull requests

5 participants