Flutter Windows Embedder
flutter::WindowsProcTable Class Reference

#include <windows_proc_table.h>

Classes

struct  WINDOWCOMPOSITIONATTRIBDATA
 

Public Types

enum  WINDOWCOMPOSITIONATTRIB { WCA_ACCENT_POLICY = 19 }
 

Public Member Functions

 WindowsProcTable ()
 
virtual ~WindowsProcTable ()
 
virtual BOOL GetPointerType (UINT32 pointer_id, POINTER_INPUT_TYPE *pointer_type) const
 
virtual LRESULT GetThreadPreferredUILanguages (DWORD flags, PULONG count, PZZWSTR languages, PULONG length) const
 
virtual bool GetHighContrastEnabled () const
 
virtual bool DwmIsCompositionEnabled () const
 
virtual HRESULT DwmFlush () const
 
virtual HCURSOR LoadCursor (HINSTANCE instance, LPCWSTR cursor_name) const
 
virtual HCURSOR SetCursor (HCURSOR cursor) const
 
virtual BOOL EnableNonClientDpiScaling (HWND hwnd) const
 
virtual BOOL SetWindowCompositionAttribute (HWND hwnd, WINDOWCOMPOSITIONATTRIBDATA *data) const
 
virtual HRESULT DwmExtendFrameIntoClientArea (HWND hwnd, const MARGINS *pMarInset) const
 
virtual HRESULT DwmSetWindowAttribute (HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute) const
 
virtual BOOL AdjustWindowRectExForDpi (LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle, UINT dpi) const
 

Detailed Description

Definition at line 18 of file windows_proc_table.h.

Member Enumeration Documentation

◆ WINDOWCOMPOSITIONATTRIB

Enumerator
WCA_ACCENT_POLICY 

Definition at line 20 of file windows_proc_table.h.

Constructor & Destructor Documentation

◆ WindowsProcTable()

flutter::WindowsProcTable::WindowsProcTable ( )

Definition at line 12 of file windows_proc_table.cc.

12  {
13  user32_ = fml::NativeLibrary::Create("user32.dll");
14  get_pointer_type_ =
15  user32_->ResolveFunction<GetPointerType_*>("GetPointerType");
16  enable_non_client_dpi_scaling_ =
17  user32_->ResolveFunction<EnableNonClientDpiScaling_*>(
18  "EnableNonClientDpiScaling");
19  set_window_composition_attribute_ =
20  user32_->ResolveFunction<SetWindowCompositionAttribute_*>(
21  "SetWindowCompositionAttribute");
22  adjust_window_rect_ext_for_dpi_ =
23  user32_->ResolveFunction<AdjustWindowRectExForDpi_*>(
24  "AdjustWindowRectExForDpi");
25 }

◆ ~WindowsProcTable()

flutter::WindowsProcTable::~WindowsProcTable ( )
virtual

Definition at line 27 of file windows_proc_table.cc.

27  {
28  user32_ = nullptr;
29 }

Member Function Documentation

◆ AdjustWindowRectExForDpi()

BOOL flutter::WindowsProcTable::AdjustWindowRectExForDpi ( LPRECT  lpRect,
DWORD  dwStyle,
BOOL  bMenu,
DWORD  dwExStyle,
UINT  dpi 
) const
virtual

Definition at line 110 of file windows_proc_table.cc.

114  {
115  if (!adjust_window_rect_ext_for_dpi_.has_value()) {
116  return FALSE;
117  }
118 
119  return adjust_window_rect_ext_for_dpi_.value()(lpRect, dwStyle, bMenu,
120  dwExStyle, dpi);
121 }

◆ DwmExtendFrameIntoClientArea()

HRESULT flutter::WindowsProcTable::DwmExtendFrameIntoClientArea ( HWND  hwnd,
const MARGINS *  pMarInset 
) const
virtual

Definition at line 97 of file windows_proc_table.cc.

99  {
100  return ::DwmExtendFrameIntoClientArea(hwnd, pMarInset);
101 }

◆ DwmFlush()

HRESULT flutter::WindowsProcTable::DwmFlush ( ) const
virtual

Definition at line 66 of file windows_proc_table.cc.

66  {
67  return ::DwmFlush();
68 }

◆ DwmIsCompositionEnabled()

bool flutter::WindowsProcTable::DwmIsCompositionEnabled ( ) const
virtual

Definition at line 57 of file windows_proc_table.cc.

57  {
58  BOOL composition_enabled;
59  if (SUCCEEDED(::DwmIsCompositionEnabled(&composition_enabled))) {
60  return composition_enabled;
61  }
62 
63  return true;
64 }
virtual bool DwmIsCompositionEnabled() const

◆ DwmSetWindowAttribute()

HRESULT flutter::WindowsProcTable::DwmSetWindowAttribute ( HWND  hwnd,
DWORD  dwAttribute,
LPCVOID  pvAttribute,
DWORD  cbAttribute 
) const
virtual

Definition at line 103 of file windows_proc_table.cc.

106  {
107  return ::DwmSetWindowAttribute(hwnd, dwAttribute, pvAttribute, cbAttribute);
108 }

◆ EnableNonClientDpiScaling()

BOOL flutter::WindowsProcTable::EnableNonClientDpiScaling ( HWND  hwnd) const
virtual

Definition at line 79 of file windows_proc_table.cc.

79  {
80  if (!enable_non_client_dpi_scaling_.has_value()) {
81  return FALSE;
82  }
83 
84  return enable_non_client_dpi_scaling_.value()(hwnd);
85 }

◆ GetHighContrastEnabled()

bool flutter::WindowsProcTable::GetHighContrastEnabled ( ) const
virtual

Definition at line 47 of file windows_proc_table.cc.

47  {
48  HIGHCONTRAST high_contrast = {.cbSize = sizeof(HIGHCONTRAST)};
49  if (!::SystemParametersInfoW(SPI_GETHIGHCONTRAST, sizeof(HIGHCONTRAST),
50  &high_contrast, 0)) {
51  return false;
52  }
53 
54  return high_contrast.dwFlags & HCF_HIGHCONTRASTON;
55 }

◆ GetPointerType()

BOOL flutter::WindowsProcTable::GetPointerType ( UINT32  pointer_id,
POINTER_INPUT_TYPE *  pointer_type 
) const
virtual

Definition at line 31 of file windows_proc_table.cc.

32  {
33  if (!get_pointer_type_.has_value()) {
34  return FALSE;
35  }
36 
37  return get_pointer_type_.value()(pointer_id, pointer_type);
38 }

◆ GetThreadPreferredUILanguages()

LRESULT flutter::WindowsProcTable::GetThreadPreferredUILanguages ( DWORD  flags,
PULONG  count,
PZZWSTR  languages,
PULONG  length 
) const
virtual

Definition at line 40 of file windows_proc_table.cc.

43  {
44  return ::GetThreadPreferredUILanguages(flags, count, languages, length);
45 }

Referenced by flutter::GetPreferredLanguagesFromMUI().

◆ LoadCursor()

HCURSOR flutter::WindowsProcTable::LoadCursor ( HINSTANCE  instance,
LPCWSTR  cursor_name 
) const
virtual

Definition at line 70 of file windows_proc_table.cc.

71  {
72  return ::LoadCursorW(instance, cursor_name);
73 }

◆ SetCursor()

HCURSOR flutter::WindowsProcTable::SetCursor ( HCURSOR  cursor) const
virtual

Definition at line 75 of file windows_proc_table.cc.

75  {
76  return ::SetCursor(cursor);
77 }

◆ SetWindowCompositionAttribute()

BOOL flutter::WindowsProcTable::SetWindowCompositionAttribute ( HWND  hwnd,
WINDOWCOMPOSITIONATTRIBDATA data 
) const
virtual

Definition at line 87 of file windows_proc_table.cc.

89  {
90  if (!set_window_composition_attribute_.has_value()) {
91  return FALSE;
92  }
93 
94  return set_window_composition_attribute_.value()(hwnd, data);
95 }

The documentation for this class was generated from the following files: