| Flutter Windows Embedder |

windows_proc_table.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/shell/platform/windows/windows_proc_table.h"
6
7 #include <WinUser.h>
8 #include <dwmapi.h>
9
10 namespace flutter {
11
12 WindowsProcTable::WindowsProcTable() {
13 user32_ = fml::NativeLibrary::Create("user32.dll");
14 get_pointer_type_ =
15 user32_->ResolveFunction<GetPointerType_*>("GetPointerType");
16 }
17
18 WindowsProcTable::~WindowsProcTable() {
19 user32_ = nullptr;
20 }
21
22 BOOL WindowsProcTable::GetPointerType(UINT32 pointer_id,
23 POINTER_INPUT_TYPE* pointer_type) const {
24 if (!get_pointer_type_.has_value()) {
25 return FALSE;
26 }
27
28 return get_pointer_type_.value()(pointer_id, pointer_type);
29 }
30
31 LRESULT WindowsProcTable::GetThreadPreferredUILanguages(DWORD flags,
32 PULONG count,
33 PZZWSTR languages,
34 PULONG length) const {
35 return ::GetThreadPreferredUILanguages(flags, count, languages, length);
36 }
37
38 bool WindowsProcTable::GetHighContrastEnabled() const {
39 HIGHCONTRAST high_contrast = {.cbSize = sizeof(HIGHCONTRAST)};
40 if (!::SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST),
41 &high_contrast, 0)) {
42 return false;
43 }
44
45 return high_contrast.dwFlags & HCF_HIGHCONTRASTON;
46 }
47
48 bool WindowsProcTable::DwmIsCompositionEnabled() const {
49 BOOL composition_enabled;
50 if (SUCCEEDED(::DwmIsCompositionEnabled(&composition_enabled))) {
51 return composition_enabled;
52 }
53
54 return true;
55 }
56
57 HRESULT WindowsProcTable::DwmFlush() const {
58 return ::DwmFlush();
59 }
60
61 } // namespace flutter
flutter::WindowsProcTable::DwmFlush
virtual HRESULT DwmFlush() const
Definition: windows_proc_table.cc:57
flutter::WindowsProcTable::~WindowsProcTable
virtual ~WindowsProcTable()
Definition: windows_proc_table.cc:18
windows_proc_table.h
flutter::WindowsProcTable::GetPointerType
virtual BOOL GetPointerType(UINT32 pointer_id, POINTER_INPUT_TYPE *pointer_type) const
Definition: windows_proc_table.cc:22
flutter::WindowsProcTable::WindowsProcTable
WindowsProcTable()
Definition: windows_proc_table.cc:12
flutter::WindowsProcTable::DwmIsCompositionEnabled
virtual bool DwmIsCompositionEnabled() const
Definition: windows_proc_table.cc:48
flutter
Definition: accessibility_bridge_windows.cc:11
flutter::WindowsProcTable::GetThreadPreferredUILanguages
virtual LRESULT GetThreadPreferredUILanguages(DWORD flags, PULONG count, PZZWSTR languages, PULONG length) const
Definition: windows_proc_table.cc:31
flutter::WindowsProcTable::GetHighContrastEnabled
virtual bool GetHighContrastEnabled() const
Definition: windows_proc_table.cc:38