| Flutter Windows Embedder |

windows_proc_table.h
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 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOWS_PROC_TABLE_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOWS_PROC_TABLE_H_
7
8 #include <optional>
9
10 #include "flutter/fml/macros.h"
11 #include "flutter/fml/native_library.h"
12
13 namespace flutter {
14
15 // Lookup table for Windows APIs that aren't available on all versions of
16 // Windows, or for mocking Windows API calls.
17 class WindowsProcTable {
18 public:
19 WindowsProcTable();
20 virtual ~WindowsProcTable();
21
22 // Retrieves the pointer type for a specified pointer.
23 //
24 // Used to react differently to touch or pen inputs. Returns false on failure.
25 // Available on Windows 8 and newer, otherwise returns false.
26 virtual BOOL GetPointerType(UINT32 pointer_id,
27 POINTER_INPUT_TYPE* pointer_type) const;
28
29 // Get the preferred languages for the thread, and optionally the process,
30 // and system, in that order, depending on the flags.
31 //
32 // See:
33 // https://learn.microsoft.com/windows/win32/api/winnls/nf-winnls-getthreadpreferreduilanguages
34 virtual LRESULT GetThreadPreferredUILanguages(DWORD flags,
35 PULONG count,
36 PZZWSTR languages,
37 PULONG length) const;
38
39 // Get whether high contrast is enabled.
40 //
41 // Available on Windows 8 and newer, otherwise returns false.
42 //
43 // See:
44 // https://learn.microsoft.com/windows/win32/winauto/high-contrast-parameter
45 virtual bool GetHighContrastEnabled() const;
46
47 // Get whether the system compositor, DWM, is enabled.
48 //
49 // See:
50 // https://learn.microsoft.com/windows/win32/api/dwmapi/nf-dwmapi-dwmiscompositionenabled
51 virtual bool DwmIsCompositionEnabled() const;
52
53 // Issues a flush call that blocks the caller until all of the outstanding
54 // surface updates have been made.
55 //
56 // See:
57 // https://learn.microsoft.com/windows/win32/api/dwmapi/nf-dwmapi-dwmflush
58 virtual HRESULT DwmFlush() const;
59
60 private:
61 using GetPointerType_ = BOOL __stdcall(UINT32 pointerId,
62 POINTER_INPUT_TYPE* pointerType);
63
64 // The User32.dll library, used to resolve functions at runtime.
65 fml::RefPtr<fml::NativeLibrary> user32_;
66
67 std::optional<GetPointerType_*> get_pointer_type_;
68
69 FML_DISALLOW_COPY_AND_ASSIGN(WindowsProcTable);
70 };
71
72 } // namespace flutter
73
74 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOWS_PROC_TABLE_H_
flutter::WindowsProcTable::DwmFlush
virtual HRESULT DwmFlush() const
Definition: windows_proc_table.cc:57
flutter::WindowsProcTable::~WindowsProcTable
virtual ~WindowsProcTable()
Definition: windows_proc_table.cc:18
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
Definition: windows_proc_table.h:17
flutter::WindowsProcTable::GetHighContrastEnabled
virtual bool GetHighContrastEnabled() const
Definition: windows_proc_table.cc:38