Flutter Engine
flutter_windows.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <windows.h>
#include "flutter_export.h"
#include "flutter_messenger.h"
#include "flutter_plugin_registrar.h"

Go to the source code of this file.

Classes

struct  FlutterDesktopEngineProperties
 

Typedefs

typedef struct FlutterDesktopViewControllerStateFlutterDesktopViewControllerRef
 
typedef struct FlutterDesktopView * FlutterDesktopViewRef
 
typedef struct FlutterDesktopEngine * FlutterDesktopEngineRef
 
typedef bool(* FlutterDesktopWindowProcCallback) (HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)
 

Functions

FLUTTER_EXPORT FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate (int width, int height, FlutterDesktopEngineRef engine)
 WINUWP. More...
 
FLUTTER_EXPORT void FlutterDesktopViewControllerDestroy (FlutterDesktopViewControllerRef controller)
 
FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine (FlutterDesktopViewControllerRef controller)
 
FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopViewControllerGetView (FlutterDesktopViewControllerRef controller)
 
FLUTTER_EXPORT void FlutterDesktopViewControllerForceRedraw (FlutterDesktopViewControllerRef controller)
 
FLUTTER_EXPORT bool FlutterDesktopViewControllerHandleTopLevelWindowProc (FlutterDesktopViewControllerRef controller, HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
 
FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopEngineCreate (const FlutterDesktopEngineProperties *engine_properties)
 
FLUTTER_EXPORT bool FlutterDesktopEngineDestroy (FlutterDesktopEngineRef engine)
 
FLUTTER_EXPORT bool FlutterDesktopEngineRun (FlutterDesktopEngineRef engine, const char *entry_point)
 
FLUTTER_EXPORT uint64_t FlutterDesktopEngineProcessMessages (FlutterDesktopEngineRef engine)
 
FLUTTER_EXPORT void FlutterDesktopEngineReloadSystemFonts (FlutterDesktopEngineRef engine)
 
FLUTTER_EXPORT void FlutterDesktopEngineReloadPlatformBrightness (FlutterDesktopEngineRef engine)
 
FLUTTER_EXPORT FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar (FlutterDesktopEngineRef engine, const char *plugin_name)
 
FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger (FlutterDesktopEngineRef engine)
 
FLUTTER_EXPORT FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar (FlutterDesktopTextureRegistrarRef texture_registrar)
 
FLUTTER_EXPORT HWND FlutterDesktopViewGetHWND (FlutterDesktopViewRef view)
 
FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView (FlutterDesktopPluginRegistrarRef registrar)
 
FLUTTER_EXPORT void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate, void *user_data)
 
FLUTTER_EXPORT void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate (FlutterDesktopPluginRegistrarRef registrar, FlutterDesktopWindowProcCallback delegate)
 
FLUTTER_EXPORT UINT FlutterDesktopGetDpiForHWND (HWND hwnd)
 
FLUTTER_EXPORT UINT FlutterDesktopGetDpiForMonitor (HMONITOR monitor)
 
FLUTTER_EXPORT void FlutterDesktopResyncOutputStreams ()
 

Typedef Documentation

◆ FlutterDesktopEngineRef

typedef struct FlutterDesktopEngine* FlutterDesktopEngineRef

Definition at line 35 of file flutter_windows.h.

◆ FlutterDesktopViewControllerRef

◆ FlutterDesktopViewRef

typedef struct FlutterDesktopView* FlutterDesktopViewRef

Definition at line 31 of file flutter_windows.h.

◆ FlutterDesktopWindowProcCallback

typedef bool(* FlutterDesktopWindowProcCallback) (HWND, UINT, WPARAM, LPARAM, void *, LRESULT *result)

Definition at line 219 of file flutter_windows.h.

Function Documentation

◆ FlutterDesktopEngineCreate()

FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopEngineCreate ( const FlutterDesktopEngineProperties engine_properties)

Definition at line 84 of file stub_flutter_windows_api.cc.

References engine, flutter::testing::StubFlutterWindowsApi::EngineCreate(), and HandleForEngine().

Referenced by flutter::FlutterEngine::FlutterEngine().

85  {
87  return s_stub_implementation->EngineCreate(*engine_properties);
88  }
89  return nullptr;
90 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
virtual FlutterDesktopEngineRef EngineCreate(const FlutterDesktopEngineProperties &engine_properties)

◆ FlutterDesktopEngineDestroy()

FLUTTER_EXPORT bool FlutterDesktopEngineDestroy ( FlutterDesktopEngineRef  engine)

◆ FlutterDesktopEngineGetMessenger()

FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger ( FlutterDesktopEngineRef  engine)

Definition at line 134 of file stub_flutter_windows_api.cc.

References EngineFromHandle(), and flutter::FlutterWindowsEngine::messenger().

Referenced by flutter::FlutterEngine::FlutterEngine().

135  {
136  // The stub ignores this, so just return an arbitrary non-zero value.
137  return reinterpret_cast<FlutterDesktopMessengerRef>(2);
138 }

◆ FlutterDesktopEngineGetPluginRegistrar()

FLUTTER_EXPORT FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar ( FlutterDesktopEngineRef  engine,
const char *  plugin_name 
)

Definition at line 127 of file stub_flutter_windows_api.cc.

References EngineFromHandle(), and flutter::FlutterWindowsEngine::GetRegistrar().

Referenced by flutter::FlutterEngine::ReloadPlatformBrightness().

129  {
130  // The stub ignores this, so just return an arbitrary non-zero value.
131  return reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
132 }

◆ FlutterDesktopEngineGetTextureRegistrar()

FLUTTER_EXPORT FlutterDesktopTextureRegistrarRef FlutterDesktopEngineGetTextureRegistrar ( FlutterDesktopTextureRegistrarRef  texture_registrar)

◆ FlutterDesktopEngineProcessMessages()

FLUTTER_EXPORT uint64_t FlutterDesktopEngineProcessMessages ( FlutterDesktopEngineRef  engine)

Definition at line 107 of file stub_flutter_windows_api.cc.

References flutter::testing::StubFlutterWindowsApi::EngineProcessMessages().

Referenced by flutter::FlutterEngine::ProcessMessages().

107  {
108  if (s_stub_implementation) {
110  }
111  return 0;
112 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation

◆ FlutterDesktopEngineReloadPlatformBrightness()

◆ FlutterDesktopEngineReloadSystemFonts()

FLUTTER_EXPORT void FlutterDesktopEngineReloadSystemFonts ( FlutterDesktopEngineRef  engine)

◆ FlutterDesktopEngineRun()

FLUTTER_EXPORT bool FlutterDesktopEngineRun ( FlutterDesktopEngineRef  engine,
const char *  entry_point 
)

Definition at line 99 of file stub_flutter_windows_api.cc.

References EngineFromHandle(), flutter::testing::StubFlutterWindowsApi::EngineRun(), and flutter::FlutterWindowsEngine::RunWithEntrypoint().

Referenced by flutter::FlutterEngine::Run().

100  {
101  if (s_stub_implementation) {
102  return s_stub_implementation->EngineRun(entry_point);
103  }
104  return true;
105 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
virtual bool EngineRun(const char *entry_point)

◆ FlutterDesktopGetDpiForHWND()

FLUTTER_EXPORT UINT FlutterDesktopGetDpiForHWND ( HWND  hwnd)

Definition at line 88 of file flutter_windows_win32.cc.

References flutter::GetDpiForHWND().

88  {
89  return flutter::GetDpiForHWND(hwnd);
90 }
UINT GetDpiForHWND(HWND hwnd)

◆ FlutterDesktopGetDpiForMonitor()

FLUTTER_EXPORT UINT FlutterDesktopGetDpiForMonitor ( HMONITOR  monitor)

Definition at line 92 of file flutter_windows_win32.cc.

References flutter::GetDpiForMonitor().

92  {
93  return flutter::GetDpiForMonitor(monitor);
94 }
UINT GetDpiForMonitor(HMONITOR monitor)

◆ FlutterDesktopPluginRegistrarGetView()

FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView ( FlutterDesktopPluginRegistrarRef  registrar)

Definition at line 153 of file stub_flutter_windows_api.cc.

References FlutterDesktopPluginRegistrar::engine, and HandleForView().

Referenced by flutter::PluginRegistrarWindows::PluginRegistrarWindows().

154  {
155  // The stub ignores this, so just return an arbitrary non-zero value.
156  return reinterpret_cast<FlutterDesktopViewRef>(1);
157 }
struct FlutterDesktopView * FlutterDesktopViewRef

◆ FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate()

FLUTTER_EXPORT void FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate ( FlutterDesktopPluginRegistrarRef  registrar,
FlutterDesktopWindowProcCallback  delegate,
void *  user_data 
)

Definition at line 159 of file stub_flutter_windows_api.cc.

References FlutterDesktopPluginRegistrar::engine, and flutter::testing::StubFlutterWindowsApi::PluginRegistrarRegisterTopLevelWindowProcDelegate().

Referenced by flutter::PluginRegistrarWindows::RegisterTopLevelWindowProcDelegate().

162  {
163  if (s_stub_implementation) {
164  return s_stub_implementation
166  user_data);
167  }
168 }
void * user_data
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
virtual void PluginRegistrarRegisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate, void *user_data)

◆ FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate()

FLUTTER_EXPORT void FlutterDesktopPluginRegistrarUnregisterTopLevelWindowProcDelegate ( FlutterDesktopPluginRegistrarRef  registrar,
FlutterDesktopWindowProcCallback  delegate 
)

Definition at line 170 of file stub_flutter_windows_api.cc.

References FlutterDesktopPluginRegistrar::engine, and flutter::testing::StubFlutterWindowsApi::PluginRegistrarUnregisterTopLevelWindowProcDelegate().

Referenced by flutter::PluginRegistrarWindows::UnregisterTopLevelWindowProcDelegate().

172  {
173  if (s_stub_implementation) {
174  return s_stub_implementation
176  }
177 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
virtual void PluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)

◆ FlutterDesktopResyncOutputStreams()

FLUTTER_EXPORT void FlutterDesktopResyncOutputStreams ( )

Definition at line 156 of file flutter_windows.cc.

156  {
157  FILE* unused;
158  if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
159  _dup2(_fileno(stdout), 1);
160  }
161  if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
162  _dup2(_fileno(stdout), 2);
163  }
164  std::ios::sync_with_stdio();
165 }

◆ FlutterDesktopViewControllerCreate()

FLUTTER_EXPORT FlutterDesktopViewControllerRef FlutterDesktopViewControllerCreate ( int  width,
int  height,
FlutterDesktopEngineRef  engine 
)

WINUWP.

Definition at line 38 of file stub_flutter_windows_api.cc.

References EngineFromHandle(), height, state, flutter::testing::StubFlutterWindowsApi::ViewControllerCreate(), and width.

Referenced by flutter::FlutterViewController::FlutterViewController().

41  {
44  }
45  return nullptr;
46 }
int32_t width
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
int32_t height
virtual FlutterDesktopViewControllerRef ViewControllerCreate(int width, int height, FlutterDesktopEngineRef engine)

◆ FlutterDesktopViewControllerDestroy()

FLUTTER_EXPORT void FlutterDesktopViewControllerDestroy ( FlutterDesktopViewControllerRef  controller)

◆ FlutterDesktopViewControllerForceRedraw()

FLUTTER_EXPORT void FlutterDesktopViewControllerForceRedraw ( FlutterDesktopViewControllerRef  controller)

Definition at line 67 of file stub_flutter_windows_api.cc.

References FlutterDesktopViewControllerState::view.

68  {}

◆ FlutterDesktopViewControllerGetEngine()

FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine ( FlutterDesktopViewControllerRef  controller)

Definition at line 55 of file stub_flutter_windows_api.cc.

References HandleForEngine(), and FlutterDesktopViewControllerState::view.

56  {
57  // The stub ignores this, so just return an arbitrary non-zero value.
58  return reinterpret_cast<FlutterDesktopEngineRef>(1);
59 }

◆ FlutterDesktopViewControllerGetView()

FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopViewControllerGetView ( FlutterDesktopViewControllerRef  controller)

Definition at line 61 of file stub_flutter_windows_api.cc.

References HandleForView(), and FlutterDesktopViewControllerState::view.

Referenced by flutter::FlutterViewController::FlutterViewController().

62  {
63  // The stub ignores this, so just return an arbitrary non-zero value.
64  return reinterpret_cast<FlutterDesktopViewRef>(1);
65 }
struct FlutterDesktopView * FlutterDesktopViewRef

◆ FlutterDesktopViewControllerHandleTopLevelWindowProc()

FLUTTER_EXPORT bool FlutterDesktopViewControllerHandleTopLevelWindowProc ( FlutterDesktopViewControllerRef  controller,
HWND  hwnd,
UINT  message,
WPARAM  wparam,
LPARAM  lparam,
LRESULT result 
)

Definition at line 70 of file stub_flutter_windows_api.cc.

References FlutterDesktopViewControllerState::view, and flutter::testing::StubFlutterWindowsApi::ViewControllerHandleTopLevelWindowProc().

Referenced by flutter::FlutterViewController::HandleTopLevelWindowProc().

76  {
79  hwnd, message, wparam, lparam, result);
80  }
81  return false;
82 }
virtual bool ViewControllerHandleTopLevelWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result)
GAsyncResult * result
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation

◆ FlutterDesktopViewGetHWND()

FLUTTER_EXPORT HWND FlutterDesktopViewGetHWND ( FlutterDesktopViewRef  view)

Definition at line 146 of file stub_flutter_windows_api.cc.

References flutter::FlutterWindowsView::GetPlatformWindow(), ViewFromHandle(), and flutter::testing::StubFlutterWindowsApi::ViewGetHWND().

Referenced by flutter::FlutterView::GetNativeWindow().

146  {
147  if (s_stub_implementation) {
149  }
150  return reinterpret_cast<HWND>(-1);
151 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation