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

widget demo: enable Windows system DPI awareness #64

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chrstphrchvz
Copy link
Contributor

From writeup on Perlmonks: https://www.perlmonks.org/?node_id=11101747 (see also chrstphrchvz/perl-tcl-ptk#6 (comment))

Before:
image

After:
image

There are likely further refinements which could help, e.g. font size.

# Enable system DPI awareness for sharper UI on Windows
# https://www.perlmonks.org/?node_id=11101747
if ($^O eq 'MSWin32') {
require Win32::API;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it guaranteed that Win32::API is available on all Windows Perl installations? Otherwise I would prefer a more defensive approach, e.g. if ($^O eq 'MSWin32' && eval { require Win32::API; 1 }).
Also, do all Windows versions have the SetProcessDPIAware() function available? Otherwise the eval{} should be extended even further.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confess I haven't thought through the details of including this in Perl/Tk very well, so I will mark this as a draft for now.

Win32::API is included in Strawberry Perl going back to at least 5.8.9.2, and I'm not sure about ActivePerl. But it isn't a core module, and its predecessor Win32 was a core module only prior to 5.8.4. However neither should be strictly necessary as Perl/Tk uses XS.

SetProcessDPIAware() is in Vista/2008 or later. What is the minimum version Perl/Tk supports—should I assume the same as Perl 5.8 or and/or Tcl/Tk 8.4, which would include 2000/XP?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say, if the solution is simple (i.e. moving the Win32::API::More->new into the eval{}), then this is the way to go.

@chrstphrchvz chrstphrchvz marked this pull request as draft July 18, 2020 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants