[Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Collaborate on tools, libraries, and applications beyond the IDE

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

[Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by trevordevore » Mon Oct 15, 2018 3:01 pm

Hi all,

Recently I've been investigating Hi-DPI related issues in the LC Windows implementation. I thought about pestering the LC team (or paying them) to prioritize these fixes, but then I realized it was October and I came up with a different idea. In the spirit of Hacktoberfest I thought it would be nice to try and organize a community effort around some improvements that could be made to Hi-DPI support on Windows.

For those who aren't familiar with Hacktoberfest you can read more about it at the url below. [Side note: submitting PRs for LC documentation updates is a great way to earn a T-shirt.

https://hacktoberfest.digitalocean.com

-------------------------—
Background
—-—-—-—-—-—-—-

LiveCode added support for Hi-DPI monitors almost 5 years ago. This is when they added properties such as usePixelScaling, screenPixelScale, screenPixelScales, etc. At the time, Windows had support for System DPI Awareness. After LC added support Windows changed the APIs to support different resolutions on each monitor. This is referred to as PerMonitor API Awareness. This was in Windows 8.1. The APIs were further improved in Windows 10. LiveCode needs to be updated to support these newer APIs.

I'm aware of the following limitations and bugs around Hi-DPI support on Windows:

1. The `screenPixelScales` reports the pixelScale of the primary monitor for all attached monitors. For example, if you have a Windows 10 computer with two monitors attached and the primary monitor is set to displays at 100% (1.0 pixelScale) and a second monitor at 200% (2.0 pixelScale) then the `screenPixelScales` returns `1.0\n1.0` when it should return `1.0\n2.0`.

https://quality.livecode.com/show_bug.cgi?id=19542

2. minWidth/minHeight/maxWidth/maxHeight are not handled properly on monitors with a pixelScale > 1.0.

https://quality.livecode.com/show_bug.cgi?id=14314

--------------------—-—-
Fixing these issues in the LC Community
-------------------------—

I think we can muster the LC Community troops and figure out how to fix these issues. I spent some time the other day doing some research in an attempt to figure out what needs to be done. I’ve been looking through the source code and reviewing the Windows API docs on the web in order to better understand the API changes required for switching from System DPI Awareness to PerMonitor API Awareness in LiveCode.

I’ve looked at the [[ HiDPI ]] commits on GitHub and these two seem the most pertinent. They contain the changes to the source code when the pixel scale properties were added and the changes made specifically for Windows implementation.

https://github.com/livecode/livecode/co ... d2046824d4
https://github.com/livecode/livecode/co ... f704abc575

This docs page on Microsoft's site is a nice introduction DPI Awareness:

https://docs.microsoft.com/en-us/window ... -awareness

Here are some notes I made in my research:

- I think that responding to the WM_DPICHANGED message to update windows when DPI for a monitor changes should be pretty straightforward. I think the MCDispatch::reopen_stack_windows() function in dispatch.cpp would handle that as it is what is called when setting the pixelscale.
- I’m not sure about the switch from GetDpiForMonitor() to GetDpiForWindow(). I would hope that if the LiveCode w32-manifest-template-dpiaware.xml manifest were updated to include the <dpiAwareness>PerMonitor</dpiAwareness> node that GetDpiForMonitor() would return the proper pixel_scale in w32dce.cpp > DescribeMonitorsCallback. If so then screenPixelScales may just start working.

--------------------—-—-
What is needed?
-------------------------—

In order to pull this off we would need some developers who are set up to compile LC 9 on Windows and who are familiar with working with the Windows APIs (C++). We also need people willing to test and review proposed code changes and make sure we aren't missing anything.

I can provide a private Slack channel with audio/video/screen sharing capabilities for a small group. I have some unused guests on my company account that I can access for the duration of this project. I am not set up to compile LC on Windows at this time.

Please respond to this thread if you are interested and have one or more of the skills necessary to try and pull this off. I'm sure we could ask the LC engineers for tips if we get stuck anywhere along the way.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

capellan
Posts: 515
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by capellan » Sat Oct 20, 2018 4:12 am

I could use two simultaneous monitor in Windows 7.
Could this help?

Al

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by trevordevore » Sun Oct 21, 2018 5:06 am

Thanks for the offer @capellan. Windows 7 uses the older APIs and so LiveCode works as expected. Your setup could be used to confirm that the fix doesn't break the old behavior. I haven't head from any programmers, however, so there hasn't been any progress yet.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

SparkOut
Posts: 1802
Joined: Sun Sep 23, 2007 4:58 pm

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by SparkOut » Sun Oct 21, 2018 8:49 am

I would love to help, but don't have the required hardware, skillset, git, nor time.

But I do appreciate the effort and hope it comes to fruition of a good result.

bwmilby
Posts: 212
Joined: Wed Jun 07, 2017 5:37 am
Location: New Orleans, LA
Contact:

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by bwmilby » Sun Oct 21, 2018 10:21 pm

I don’t have the LC build environment for Windows (do have Mac and Linux). I don’t know enough about what is needed on Win, but if available for free I wouldn’t mind setting it up. I briefly had a HiDPI laptop, but it was replaced with something much lower res so I would only have limited testing ability.
Brian Milby

Script Tracker https://github.com/bwmilby/lc-misc/tree/master/ScriptTracker

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by trevordevore » Sun Oct 21, 2018 11:18 pm

@bwmilby - The only information I know of for getting set up for Windows is this one:

https://github.com/livecode/livecode/bl ... ild-win.md

I don't know how up to date it is though. Here is a link to visual studio 2015:
https://visualstudio.microsoft.com/vs/older-downloads/

The answer on the following Stack Overflow page has a direct link to the community version ISO. I don't know if it is any different than the links on the page above:

https://stackoverflow.com/questions/442 ... 5-not-2017

If you are able to get a build system set up then I could create a test stack that would test the necessary features. It would require a system with Windows 8.1 or higher, 2 monitors, and the ability to set the text/app zoom to a value > 100%. If you don't have that setup but can compile the IDE engine so that I could drop it an existing Windows install then I could do all testing on my end.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

sphere
Posts: 700
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by sphere » Mon Oct 22, 2018 12:15 pm

I don't know exactly how Github works too,but this is a good place to start:
https://egghead.io/courses/how-to-contr ... -on-github
:D :o :) :shock: 8) :lol:

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3245
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by bn » Mon Oct 22, 2018 2:50 pm

I don't know if this is related:

https://github.com/livecode/livecode/pull/6753

however if you want to see the code GitHub throws an error. At least Alex is doing something to Windows HiRes problem.

Kind regards

Bernd

Alex is working on bug
https://quality.livecode.com/show_bug.cgi?id=19704

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 907
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: [Hacktoberfest] Improving Hi-DPI support on Windows as a Community

Post by trevordevore » Mon Oct 22, 2018 3:42 pm

Thanks for the heads up Bernd. That bug appears to be a duplicate of https://quality.livecode.com/show_bug.cgi?id=14314. The PR should also fix maxWidth/maxHeight so I mentioned that in the bug report.

GitHub is having issues with metadata associated with repos right now so the website is not behaving.

https://blog.github.com/2018-10-21-octo ... nt-report/
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

Post Reply

Return to “Community Projects”