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)
 
FLUTTER_EXPORT void FlutterDesktopViewControllerDestroy (FlutterDesktopViewControllerRef controller)
 
FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopViewControllerGetEngine (FlutterDesktopViewControllerRef controller)
 
FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopViewControllerGetView (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 FlutterDesktopPluginRegistrarRef FlutterDesktopEngineGetPluginRegistrar (FlutterDesktopEngineRef engine, const char *plugin_name)
 
FLUTTER_EXPORT FlutterDesktopMessengerRef FlutterDesktopEngineGetMessenger (FlutterDesktopEngineRef engine)
 
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 30 of file flutter_windows.h.

◆ FlutterDesktopViewControllerRef

◆ FlutterDesktopViewRef

typedef struct FlutterDesktopView* FlutterDesktopViewRef

Definition at line 26 of file flutter_windows.h.

◆ FlutterDesktopWindowProcCallback

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

Definition at line 167 of file flutter_windows.h.

Function Documentation

◆ FlutterDesktopEngineCreate()

FLUTTER_EXPORT FlutterDesktopEngineRef FlutterDesktopEngineCreate ( const FlutterDesktopEngineProperties engine_properties)

Definition at line 81 of file stub_flutter_windows_api.cc.

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

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

82  {
84  return s_stub_implementation->EngineCreate(engine_properties);
85  }
86  return nullptr;
87 }
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 124 of file stub_flutter_windows_api.cc.

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

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

125  {
126  // The stub ignores this, so just return an arbitrary non-zero value.
127  return reinterpret_cast<FlutterDesktopMessengerRef>(2);
128 }

◆ FlutterDesktopEngineGetPluginRegistrar()

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

Definition at line 117 of file stub_flutter_windows_api.cc.

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

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

119  {
120  // The stub ignores this, so just return an arbitrary non-zero value.
121  return reinterpret_cast<FlutterDesktopPluginRegistrarRef>(1);
122 }

◆ FlutterDesktopEngineProcessMessages()

FLUTTER_EXPORT uint64_t FlutterDesktopEngineProcessMessages ( FlutterDesktopEngineRef  engine)

◆ FlutterDesktopEngineReloadSystemFonts()

FLUTTER_EXPORT void FlutterDesktopEngineReloadSystemFonts ( FlutterDesktopEngineRef  engine)

◆ FlutterDesktopEngineRun()

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

Definition at line 96 of file stub_flutter_windows_api.cc.

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

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

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

◆ FlutterDesktopGetDpiForHWND()

FLUTTER_EXPORT UINT FlutterDesktopGetDpiForHWND ( HWND  hwnd)

Definition at line 182 of file flutter_windows.cc.

References flutter::GetDpiForHWND().

182  {
183  return flutter::GetDpiForHWND(hwnd);
184 }
UINT GetDpiForHWND(HWND hwnd)

◆ FlutterDesktopGetDpiForMonitor()

FLUTTER_EXPORT UINT FlutterDesktopGetDpiForMonitor ( HMONITOR  monitor)

Definition at line 186 of file flutter_windows.cc.

References flutter::GetDpiForMonitor().

186  {
187  return flutter::GetDpiForMonitor(monitor);
188 }
UINT GetDpiForMonitor(HMONITOR monitor)

◆ FlutterDesktopPluginRegistrarGetView()

FLUTTER_EXPORT FlutterDesktopViewRef FlutterDesktopPluginRegistrarGetView ( FlutterDesktopPluginRegistrarRef  registrar)

Definition at line 137 of file stub_flutter_windows_api.cc.

References FlutterDesktopPluginRegistrar::engine, and HandleForView().

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

138  {
139  // The stub ignores this, so just return an arbitrary non-zero value.
140  return reinterpret_cast<FlutterDesktopViewRef>(1);
141 }
struct FlutterDesktopView * FlutterDesktopViewRef

◆ FlutterDesktopPluginRegistrarRegisterTopLevelWindowProcDelegate()

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

Definition at line 143 of file stub_flutter_windows_api.cc.

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

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

146  {
147  if (s_stub_implementation) {
148  return s_stub_implementation
150  user_data);
151  }
152 }
G_BEGIN_DECLS FlMethodCall gpointer 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 154 of file stub_flutter_windows_api.cc.

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

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

156  {
157  if (s_stub_implementation) {
158  return s_stub_implementation
160  }
161 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation
virtual void PluginRegistrarUnregisterTopLevelWindowProcDelegate(FlutterDesktopWindowProcCallback delegate)

◆ FlutterDesktopResyncOutputStreams()

FLUTTER_EXPORT void FlutterDesktopResyncOutputStreams ( )

Definition at line 190 of file flutter_windows.cc.

190  {
191  FILE* unused;
192  if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
193  _dup2(_fileno(stdout), 1);
194  }
195  if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
196  _dup2(_fileno(stdout), 2);
197  }
198  std::ios::sync_with_stdio();
199 }

◆ FlutterDesktopViewControllerCreate()

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

Definition at line 38 of file stub_flutter_windows_api.cc.

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

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

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

◆ FlutterDesktopViewControllerDestroy()

FLUTTER_EXPORT void FlutterDesktopViewControllerDestroy ( FlutterDesktopViewControllerRef  controller)

◆ 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 67 of file stub_flutter_windows_api.cc.

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

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

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

◆ FlutterDesktopViewGetHWND()

FLUTTER_EXPORT HWND FlutterDesktopViewGetHWND ( FlutterDesktopViewRef  view)

Definition at line 130 of file stub_flutter_windows_api.cc.

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

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

130  {
131  if (s_stub_implementation) {
133  }
134  return reinterpret_cast<HWND>(-1);
135 }
static flutter::testing::StubFlutterWindowsApi * s_stub_implementation