Flutter Engine
flutter::FlutterWindowsView Class Reference

#include <flutter_windows_view.h>

Inheritance diagram for flutter::FlutterWindowsView:
flutter::WindowBindingHandlerDelegate

Public Member Functions

 FlutterWindowsView (std::unique_ptr< WindowBindingHandler > window_binding)
 
 ~FlutterWindowsView ()
 
void SetEngine (std::unique_ptr< FlutterWindowsEngine > engine)
 
void CreateRenderSurface ()
 
void DestroyRenderSurface ()
 
WindowsRenderTargetGetRenderTarget () const
 
FlutterWindowsEngineGetEngine ()
 
bool ClearContext ()
 
bool MakeCurrent ()
 
bool MakeResourceCurrent ()
 
bool SwapBuffers ()
 
void SendInitialBounds ()
 
void OnWindowSizeChanged (size_t width, size_t height) const override
 
void OnPointerMove (double x, double y) override
 
void OnPointerDown (double x, double y, FlutterPointerMouseButtons button) override
 
void OnPointerUp (double x, double y, FlutterPointerMouseButtons button) override
 
void OnPointerLeave () override
 
void OnText (const std::u16string &) override
 
void OnKey (int key, int scancode, int action, char32_t character) override
 
void OnScroll (double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier) override
 

Detailed Description

Definition at line 32 of file flutter_windows_view.h.

Constructor & Destructor Documentation

◆ FlutterWindowsView()

flutter::FlutterWindowsView::FlutterWindowsView ( std::unique_ptr< WindowBindingHandler window_binding)

Definition at line 11 of file flutter_windows_view.cc.

12  {
13  surface_manager_ = std::make_unique<AngleSurfaceManager>();
14 
15  // Take the binding handler, and give it a pointer back to self.
16  binding_handler_ = std::move(window_binding);
17  binding_handler_->SetView(this);
18 
19  render_target_ = std::make_unique<WindowsRenderTarget>(
20  binding_handler_->GetRenderTarget());
21 }

◆ ~FlutterWindowsView()

flutter::FlutterWindowsView::~FlutterWindowsView ( )

Definition at line 23 of file flutter_windows_view.cc.

References DestroyRenderSurface().

Member Function Documentation

◆ ClearContext()

bool flutter::FlutterWindowsView::ClearContext ( )

Definition at line 258 of file flutter_windows_view.cc.

258  {
259  return surface_manager_->ClearContext();
260 }

◆ CreateRenderSurface()

void flutter::FlutterWindowsView::CreateRenderSurface ( )

Definition at line 266 of file flutter_windows_view.cc.

References GetRenderTarget(), flutter::PhysicalWindowBounds::height, and flutter::PhysicalWindowBounds::width.

266  {
267  PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
268  surface_manager_->CreateSurface(GetRenderTarget(), bounds.width,
269  bounds.height);
270 }
WindowsRenderTarget * GetRenderTarget() const

◆ DestroyRenderSurface()

void flutter::FlutterWindowsView::DestroyRenderSurface ( )

Definition at line 272 of file flutter_windows_view.cc.

Referenced by ~FlutterWindowsView().

272  {
273  if (surface_manager_) {
274  surface_manager_->DestroySurface();
275  }
276 }

◆ GetEngine()

FlutterWindowsEngine * flutter::FlutterWindowsView::GetEngine ( )

Definition at line 282 of file flutter_windows_view.cc.

282  {
283  return engine_.get();
284 }

◆ GetRenderTarget()

WindowsRenderTarget * flutter::FlutterWindowsView::GetRenderTarget ( ) const

Definition at line 278 of file flutter_windows_view.cc.

Referenced by CreateRenderSurface(), FlutterDesktopViewGetHWND(), and OnWindowSizeChanged().

278  {
279  return render_target_.get();
280 }

◆ MakeCurrent()

bool flutter::FlutterWindowsView::MakeCurrent ( )

Definition at line 250 of file flutter_windows_view.cc.

250  {
251  return surface_manager_->MakeCurrent();
252 }

◆ MakeResourceCurrent()

bool flutter::FlutterWindowsView::MakeResourceCurrent ( )

Definition at line 254 of file flutter_windows_view.cc.

254  {
255  return surface_manager_->MakeResourceCurrent();
256 }

◆ OnKey()

void flutter::FlutterWindowsView::OnKey ( int  key,
int  scancode,
int  action,
char32_t  character 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 93 of file flutter_windows_view.cc.

96  {
97  SendKey(key, scancode, action, character);
98 }
SemanticsAction action

◆ OnPointerDown()

void flutter::FlutterWindowsView::OnPointerDown ( double  x,
double  y,
FlutterPointerMouseButtons  button 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 63 of file flutter_windows_view.cc.

66  {
67  if (flutter_button != 0) {
68  uint64_t mouse_buttons = mouse_state_.buttons | flutter_button;
69  SetMouseButtons(mouse_buttons);
70  SendPointerDown(x, y);
71  }
72 }

◆ OnPointerLeave()

void flutter::FlutterWindowsView::OnPointerLeave ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 85 of file flutter_windows_view.cc.

85  {
86  SendPointerLeave();
87 }

◆ OnPointerMove()

void flutter::FlutterWindowsView::OnPointerMove ( double  x,
double  y 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 59 of file flutter_windows_view.cc.

59  {
60  SendPointerMove(x, y);
61 }

◆ OnPointerUp()

void flutter::FlutterWindowsView::OnPointerUp ( double  x,
double  y,
FlutterPointerMouseButtons  button 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 74 of file flutter_windows_view.cc.

77  {
78  if (flutter_button != 0) {
79  uint64_t mouse_buttons = mouse_state_.buttons & ~flutter_button;
80  SetMouseButtons(mouse_buttons);
81  SendPointerUp(x, y);
82  }
83 }

◆ OnScroll()

void flutter::FlutterWindowsView::OnScroll ( double  x,
double  y,
double  delta_x,
double  delta_y,
int  scroll_offset_multiplier 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 100 of file flutter_windows_view.cc.

References event, FlutterEngineSendWindowMetricsEvent(), height, FlutterWindowMetricsEvent::struct_size, and width.

104  {
105  SendScroll(x, y, delta_x, delta_y, scroll_offset_multiplier);
106 }

◆ OnText()

void flutter::FlutterWindowsView::OnText ( const std::u16string &  text)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 89 of file flutter_windows_view.cc.

89  {
90  SendText(text);
91 }

◆ OnWindowSizeChanged()

void flutter::FlutterWindowsView::OnWindowSizeChanged ( size_t  width,
size_t  height 
) const
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 53 of file flutter_windows_view.cc.

References GetRenderTarget().

54  {
55  surface_manager_->ResizeSurface(GetRenderTarget(), width, height);
56  SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
57 }
int32_t height
int32_t width
WindowsRenderTarget * GetRenderTarget() const

◆ SendInitialBounds()

void flutter::FlutterWindowsView::SendInitialBounds ( )

Definition at line 124 of file flutter_windows_view.cc.

References action, FlutterPointerEvent::device_kind, event, FlutterEngineSendPointerEvent(), flutter::PhysicalWindowBounds::height, kAdd, kDown, kFlutterPointerDeviceKindMouse, kFlutterPointerSignalKindScroll, kHover, kMove, kRemove, kUp, FlutterPointerEvent::phase, flutter::PhysicalWindowBounds::width, FlutterPointerEvent::x, and FlutterPointerEvent::y.

124  {
125  PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
126 
127  SendWindowMetrics(bounds.width, bounds.height,
128  binding_handler_->GetDpiScale());
129 }

◆ SetEngine()

void flutter::FlutterWindowsView::SetEngine ( std::unique_ptr< FlutterWindowsEngine engine)

Definition at line 27 of file flutter_windows_view.cc.

28  {
29  engine_ = std::move(engine);
30 
31  engine_->SetView(this);
32 
33  internal_plugin_registrar_ =
34  std::make_unique<flutter::PluginRegistrar>(engine_->GetRegistrar());
35 
36  // Set up the system channel handlers.
37  auto internal_plugin_messenger = internal_plugin_registrar_->messenger();
38  keyboard_hook_handlers_.push_back(
39  std::make_unique<flutter::KeyEventHandler>(internal_plugin_messenger));
40  keyboard_hook_handlers_.push_back(
41  std::make_unique<flutter::TextInputPlugin>(internal_plugin_messenger));
42  platform_handler_ = std::make_unique<flutter::PlatformHandler>(
43  internal_plugin_messenger, this);
44  cursor_handler_ = std::make_unique<flutter::CursorHandler>(
45  internal_plugin_messenger, binding_handler_.get());
46 
47  PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
48 
49  SendWindowMetrics(bounds.width, bounds.height,
50  binding_handler_->GetDpiScale());
51 }

◆ SwapBuffers()

bool flutter::FlutterWindowsView::SwapBuffers ( )

Definition at line 262 of file flutter_windows_view.cc.

262  {
263  return surface_manager_->SwapBuffers();
264 }

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