Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
13namespace flutter {
14
15// Lookup table for Windows APIs that aren't available on all versions of
16// Windows, or for mocking Windows API calls.
18 public:
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
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.
66
67 std::optional<GetPointerType_*> get_pointer_type_;
68
70};
71
72} // namespace flutter
73
74#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WINDOWS_PROC_TABLE_H_
int count
virtual HRESULT DwmFlush() const
virtual BOOL GetPointerType(UINT32 pointer_id, POINTER_INPUT_TYPE *pointer_type) const
virtual bool GetHighContrastEnabled() const
virtual bool DwmIsCompositionEnabled() const
virtual LRESULT GetThreadPreferredUILanguages(DWORD flags, PULONG count, PZZWSTR languages, PULONG length) const
FlutterSemanticsFlag flags
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition macros.h:27
size_t length
int BOOL
LONG_PTR LRESULT
unsigned long DWORD