Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Side by Side Diff: base/win/win_util.cc

Issue 2098993002: Prepare ScreenWin To Use Per-Monitor DPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Variable Name Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/win/win_util.h ('k') | ui/display/win/dpi.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 static enum class PerMonitorDpiAware {
603 UNKNOWN = 0,
604 PER_MONITOR_DPI_UNAWARE,
605 PER_MONITOR_DPI_AWARE,
606 } per_monitor_dpi_aware = PerMonitorDpiAware::UNKNOWN;
oshima 2016/06/27 18:58:52 nit: new line would make it easier to read.
robliao 2016/06/27 19:07:31 sgtm. Done.
607 if (per_monitor_dpi_aware == PerMonitorDpiAware::UNKNOWN) {
608 per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_UNAWARE;
609 HMODULE shcore_dll = ::LoadLibrary(L"shcore.dll");
610 if (shcore_dll) {
611 auto get_process_dpi_awareness_func =
612 reinterpret_cast<decltype(::GetProcessDpiAwareness)*>(
613 ::GetProcAddress(shcore_dll, "GetProcessDpiAwareness"));
614 if (get_process_dpi_awareness_func) {
615 PROCESS_DPI_AWARENESS awareness;
616 if (SUCCEEDED(get_process_dpi_awareness_func(nullptr, &awareness)) &&
617 awareness == PROCESS_PER_MONITOR_DPI_AWARE)
618 per_monitor_dpi_aware = PerMonitorDpiAware::PER_MONITOR_DPI_AWARE;
619 }
620 }
621 }
622 return per_monitor_dpi_aware == PerMonitorDpiAware::PER_MONITOR_DPI_AWARE;
623 }
624
600 } // namespace win 625 } // namespace win
601 } // namespace base 626 } // namespace base
OLDNEW
« no previous file with comments | « base/win/win_util.h ('k') | ui/display/win/dpi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698