Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6a7be82

Browse filesBrowse files
authored
Merge pull request #23068 from anntzer/lwc
Slight refactor of _c_internal_utils to linewrap it better.
2 parents 9a07458 + 3c0ae5f commit 6a7be82
Copy full SHA for 6a7be82

File tree

Expand file treeCollapse file tree

1 file changed

+11
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-10
lines changed

‎src/_c_internal_utils.c

Copy file name to clipboardExpand all lines: src/_c_internal_utils.c
+11-10Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,17 @@ mpl_SetProcessDpiAwareness_max(PyObject* module)
153153
SetProcessDpiAwarenessContext_t SetProcessDpiAwarenessContextPtr =
154154
(SetProcessDpiAwarenessContext_t)GetProcAddress(
155155
user32, "SetProcessDpiAwarenessContext");
156-
if (IsValidDpiAwarenessContextPtr != NULL && SetProcessDpiAwarenessContextPtr != NULL) {
157-
if (IsValidDpiAwarenessContextPtr(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)) {
158-
// Added in Creators Update of Windows 10.
159-
SetProcessDpiAwarenessContextPtr(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
160-
} else if (IsValidDpiAwarenessContextPtr(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE)) {
161-
// Added in Windows 10.
162-
SetProcessDpiAwarenessContextPtr(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
163-
} else if (IsValidDpiAwarenessContextPtr(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE)) {
164-
// Added in Windows 10.
165-
SetProcessDpiAwarenessContextPtr(DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
156+
DPI_AWARENESS_CONTEXT ctxs[3] = {
157+
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, // Win10 Creators Update
158+
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE, // Win10
159+
DPI_AWARENESS_CONTEXT_SYSTEM_AWARE}; // Win10
160+
if (IsValidDpiAwarenessContextPtr != NULL
161+
&& SetProcessDpiAwarenessContextPtr != NULL) {
162+
for (int i = 0; i < sizeof(ctxs) / sizeof(DPI_AWARENESS_CONTEXT); ++i) {
163+
if (IsValidDpiAwarenessContextPtr(ctxs[i])) {
164+
SetProcessDpiAwarenessContextPtr(ctxs[i]);
165+
break;
166+
}
166167
}
167168
} else {
168169
// Added in Windows Vista.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.