OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/win/win_util.h" | 5 #include "base/win/win_util.h" |
6 | 6 |
7 #include <aclapi.h> | 7 #include <aclapi.h> |
8 #include <cfgmgr32.h> | 8 #include <cfgmgr32.h> |
9 #include <powrprof.h> | 9 #include <powrprof.h> |
10 #include <shobjidl.h> // Must be before propkey. | 10 #include <shobjidl.h> // Must be before propkey. |
11 #include <initguid.h> | 11 #include <initguid.h> |
12 #include <inspectable.h> | 12 #include <inspectable.h> |
13 #include <propkey.h> | 13 #include <propkey.h> |
14 #include <propvarutil.h> | 14 #include <propvarutil.h> |
15 #include <psapi.h> | 15 #include <psapi.h> |
16 #include <roapi.h> | 16 #include <roapi.h> |
17 #include <sddl.h> | 17 #include <sddl.h> |
18 #include <setupapi.h> | 18 #include <setupapi.h> |
| 19 #include <shellscalingapi.h> |
19 #include <shlwapi.h> | 20 #include <shlwapi.h> |
20 #include <signal.h> | 21 #include <signal.h> |
21 #include <stddef.h> | 22 #include <stddef.h> |
22 #include <stdlib.h> | 23 #include <stdlib.h> |
23 #include <tchar.h> // Must be before tpcshrd.h or for any use of _T macro | 24 #include <tchar.h> // Must be before tpcshrd.h or for any use of _T macro |
24 #include <tpcshrd.h> | 25 #include <tpcshrd.h> |
25 #include <uiviewsettingsinterop.h> | 26 #include <uiviewsettingsinterop.h> |
26 #include <windows.ui.viewmanagement.h> | 27 #include <windows.ui.viewmanagement.h> |
27 #include <winstring.h> | 28 #include <winstring.h> |
28 #include <wrl/wrappers/corewrappers.h> | 29 #include <wrl/wrappers/corewrappers.h> |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 void EnableFlicks(HWND hwnd) { | 591 void EnableFlicks(HWND hwnd) { |
591 ::RemoveProp(hwnd, MICROSOFT_TABLETPENSERVICE_PROPERTY); | 592 ::RemoveProp(hwnd, MICROSOFT_TABLETPENSERVICE_PROPERTY); |
592 } | 593 } |
593 | 594 |
594 void DisableFlicks(HWND hwnd) { | 595 void DisableFlicks(HWND hwnd) { |
595 ::SetProp(hwnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, | 596 ::SetProp(hwnd, MICROSOFT_TABLETPENSERVICE_PROPERTY, |
596 reinterpret_cast<HANDLE>(TABLET_DISABLE_FLICKS | | 597 reinterpret_cast<HANDLE>(TABLET_DISABLE_FLICKS | |
597 TABLET_DISABLE_FLICKFALLBACKKEYS)); | 598 TABLET_DISABLE_FLICKFALLBACKKEYS)); |
598 } | 599 } |
599 | 600 |
| 601 bool IsProcessPerMonitorDpiAware() { |
| 602 enum class PerMonitorDpiAware { |
| 603 UNKNOWN = 0, |
| 604 PER_MONITOR_DPI_UNAWARE, |
| 605 PER_MONITOR_DPI_AWARE, |
| 606 }; |
| 607 static PerMonitorDpiAware per_monitor_dpi_aware = PerMonitorDpiAware::UNKNOWN; |
| 608 if (per_monitor_dpi_aware == PerMonitorDpiAware::UNKNOWN) { |
| 609 per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_UNAWARE; |
| 610 HMODULE shcore_dll = ::LoadLibrary(L"shcore.dll"); |
| 611 if (shcore_dll) { |
| 612 auto get_process_dpi_awareness_func = |
| 613 reinterpret_cast<decltype(::GetProcessDpiAwareness)*>( |
| 614 ::GetProcAddress(shcore_dll, "GetProcessDpiAwareness")); |
| 615 if (get_process_dpi_awareness_func) { |
| 616 PROCESS_DPI_AWARENESS awareness; |
| 617 if (SUCCEEDED(get_process_dpi_awareness_func(nullptr, &awareness)) && |
| 618 awareness == PROCESS_PER_MONITOR_DPI_AWARE) |
| 619 per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_AWARE; |
| 620 } |
| 621 } |
| 622 } |
| 623 return per_monitor_dpi_aware == PerMonitorDpiAware::PER_MONITOR_DPI_AWARE; |
| 624 } |
| 625 |
600 } // namespace win | 626 } // namespace win |
601 } // namespace base | 627 } // namespace base |
OLD | NEW |