| Flutter Windows Embedder |

Classes | Public Member Functions | Protected Member Functions | Friends | List of all members
flutter::FlutterWindowsView Class Reference

`#include <flutter_windows_view.h>`

Inheritance diagram for flutter::FlutterWindowsView:

## Public Member Functions
| FlutterWindowsView (FlutterViewId view_id, FlutterWindowsEngine *engine, std::unique_ptr< WindowBindingHandler > window_binding, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
virtual | ~FlutterWindowsView ()
FlutterViewId | view_id () const
bool | IsImplicitView () const
void | CreateRenderSurface ()
egl::WindowSurface * | surface () const
virtual HWND | GetWindowHandle () const
FlutterWindowsEngine * | GetEngine () const
void | ForceRedraw ()
virtual bool | ClearSoftwareBitmap ()
virtual bool | PresentSoftwareBitmap (const void *allocation, size_t row_bytes, size_t height)
FlutterWindowMetricsEvent | CreateWindowMetricsEvent () const
void | SendInitialBounds ()
void | AnnounceAlert (const std::wstring &text)
void | OnHighContrastChanged () override
bool | OnEmptyFrameGenerated ()
bool | OnFrameGenerated (size_t width, size_t height)
virtual void | OnFramePresented ()
bool | OnWindowSizeChanged (size_t width, size_t height) override
void | OnWindowRepaint () override
void | OnPointerMove (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state) override
void | OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button) override
void | OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button) override
void | OnPointerLeave (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id=0) override
virtual void | OnPointerPanZoomStart (int32_t device_id) override
virtual void | OnPointerPanZoomUpdate (int32_t device_id, double pan_x, double pan_y, double scale, double rotation) override
virtual void | OnPointerPanZoomEnd (int32_t device_id) override
void | OnText (const std::u16string &) override
void | OnKey (int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
void | OnFocus (FlutterViewFocusState focus_state, FlutterViewFocusDirection direction) override
void | OnComposeBegin () override
void | OnComposeCommit () override
void | OnComposeEnd () override
void | OnComposeChange (const std::u16string &text, int cursor_pos) override
void | OnScroll (double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier, FlutterPointerDeviceKind device_kind, int32_t device_id) override
void | OnScrollInertiaCancel (int32_t device_id) override
virtual void | OnUpdateSemanticsEnabled (bool enabled) override
virtual gfx::NativeViewAccessible | GetNativeViewAccessible () override
virtual void | OnCursorRectUpdated (const Rect &rect)
virtual void | OnResetImeComposing ()
void | OnDwmCompositionChanged ()
ui::AXPlatformNodeWin * | AlertNode () const
virtual ui::AXFragmentRootDelegateWin * | GetAxFragmentRootDelegate () override
virtual void | UpdateSemanticsEnabled (bool enabled)
std::weak_ptr< AccessibilityBridgeWindows > | accessibility_bridge ()
void | OnWindowStateEvent (HWND hwnd, WindowStateEvent event) override
virtual bool | Focus ()

## Protected Member Functions
virtual void | NotifyWinEventWrapper (ui::AXPlatformNodeWin *node, ax::mojom::Event event)
virtual std::shared_ptr< AccessibilityBridgeWindows > | CreateAccessibilityBridge ()

## Friends
class | ViewModifier

## Additional Inherited Members
Public Types inherited from flutter::WindowBindingHandlerDelegate
using | KeyEventCallback = std::function< void(bool)>

## Detailed Description

Definition at line 34 of file flutter_windows_view.h.

## Constructor & Destructor Documentation

## ◆ FlutterWindowsView()

flutter::FlutterWindowsView::FlutterWindowsView | ( | FlutterViewId | view_id,
|  | FlutterWindowsEngine * | engine,
|  | std::unique_ptr< WindowBindingHandler > | window_binding,
|  | std::shared_ptr< WindowsProcTable > | windows_proc_table = `nullptr`
| ) |  |

Definition at line 104 of file flutter_windows_view.cc.

109 : view_id_(view_id),
110 engine_(engine),
111 windows_proc_table_(std::move(windows_proc_table)) {
112 if (windows_proc_table_ == nullptr) {
113 windows_proc_table_ = std::make_shared<WindowsProcTable>();
114 }
115
116 // Take the binding handler, and give it a pointer back to self.
117 binding_handler_ = std::move(window_binding);
118 binding_handler_->SetView(this);
119 }
flutter::FlutterWindowsView::view_id
FlutterViewId view_id() const
Definition: flutter_windows_view.cc:709

## ◆ ~FlutterWindowsView()

flutter::FlutterWindowsView::~FlutterWindowsView | ( |  | ) |
| virtual

Definition at line 121 of file flutter_windows_view.cc.

121 {
122 // The view owns the child window.
123 // Notify the engine the view's child window will no longer be visible.
124 engine_->OnWindowStateEvent(GetWindowHandle(), WindowStateEvent::kHide);
125
126 if (surface_) {
127 DestroyWindowSurface(*engine_, std::move(surface_));
128 }
129 }
flutter::FlutterWindowsEngine::OnWindowStateEvent
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)
Definition: flutter_windows_engine.cc:1025
flutter::FlutterWindowsView::GetWindowHandle
virtual HWND GetWindowHandle() const
Definition: flutter_windows_view.cc:778
flutter::WindowStateEvent::kHide
@ kHide

References GetWindowHandle(), flutter::kHide, and flutter::FlutterWindowsEngine::OnWindowStateEvent().

## Member Function Documentation

## ◆ accessibility_bridge()

std::weak_ptr<AccessibilityBridgeWindows> flutter::FlutterWindowsView::accessibility_bridge | ( |  | ) |
| inline

Definition at line 239 of file flutter_windows_view.h.

239 {
240 return accessibility_bridge_;
241 }

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

## ◆ AlertNode()

ui::AXPlatformNodeWin * flutter::FlutterWindowsView::AlertNode | ( |  | ) | const

Definition at line 807 of file flutter_windows_view.cc.

807 {
808 return binding_handler_->GetAlert();
809 }

## ◆ AnnounceAlert()

void flutter::FlutterWindowsView::AnnounceAlert | ( | const std::wstring & | text | ) |

Definition at line 786 of file flutter_windows_view.cc.

786 {
787 auto alert_delegate = binding_handler_->GetAlertDelegate();
788 if (!alert_delegate) {
789 return;
790 }
791 alert_delegate->SetText(fml::WideStringToUtf16(text));
792 ui::AXPlatformNodeWin* alert_node = binding_handler_->GetAlert();
793 NotifyWinEventWrapper(alert_node, ax::mojom::Event::kAlert);
794 }
flutter::FlutterWindowsView::NotifyWinEventWrapper
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
Definition: flutter_windows_view.cc:796
text
std::u16string text
Definition: keyboard_unittests.cc:332

References NotifyWinEventWrapper(), and text.

## ◆ ClearSoftwareBitmap()

bool flutter::FlutterWindowsView::ClearSoftwareBitmap | ( |  | ) |
| virtual

Definition at line 698 of file flutter_windows_view.cc.

698 {
699 return binding_handler_->OnBitmapSurfaceCleared();
700 }

Referenced by flutter::CompositorSoftware::Present().

## ◆ CreateAccessibilityBridge()

std::shared_ptr< AccessibilityBridgeWindows > flutter::FlutterWindowsView::CreateAccessibilityBridge | ( |  | ) |
| protectedvirtual

Definition at line 812 of file flutter_windows_view.cc.

812 {
813 return std::make_shared<AccessibilityBridgeWindows>(this);
814 }

Referenced by UpdateSemanticsEnabled().

## ◆ CreateRenderSurface()

void flutter::FlutterWindowsView::CreateRenderSurface | ( |  | ) |

Definition at line 717 of file flutter_windows_view.cc.

717 {
718 FML_DCHECK(surface_ == nullptr);
719
720 if (engine_->egl_manager()) {
721 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
722 surface_ = engine_->egl_manager()->CreateWindowSurface(
723 GetWindowHandle(), bounds.width, bounds.height);
724
725 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
726
727 resize_target_width_ = bounds.width;
728 resize_target_height_ = bounds.height;
729 }
730 }
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:171
flutter::egl::Manager::CreateWindowSurface
virtual std::unique_ptr< WindowSurface > CreateWindowSurface(HWND hwnd, size_t width, size_t height)
Definition: manager.cc:276

References flutter::egl::Manager::CreateWindowSurface(), flutter::FlutterWindowsEngine::egl_manager(), GetWindowHandle(), flutter::PhysicalWindowBounds::height, and flutter::PhysicalWindowBounds::width.

## ◆ CreateWindowMetricsEvent()

FlutterWindowMetricsEvent flutter::FlutterWindowsView::CreateWindowMetricsEvent | ( |  | ) | const

Definition at line 381 of file flutter_windows_view.cc.

381 {
382 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
383 double pixel_ratio = binding_handler_->GetDpiScale();
384
385 FlutterWindowMetricsEvent event = {};
386 event.struct_size = sizeof(event);
387 event.width = bounds.width;
388 event.height = bounds.height;
389 event.pixel_ratio = pixel_ratio;
390 event.view_id = view_id_;
391
392 return event;
393 }

References flutter::PhysicalWindowBounds::height, and flutter::PhysicalWindowBounds::width.

Referenced by SendInitialBounds().

## ◆ Focus()

bool flutter::FlutterWindowsView::Focus | ( |  | ) |
| virtual

Definition at line 836 of file flutter_windows_view.cc.

836 {
837 return binding_handler_->Focus();
838 }

Referenced by flutter::FlutterWindowsEngine::OnViewFocusChangeRequest().

## ◆ ForceRedraw()

void flutter::FlutterWindowsView::ForceRedraw | ( |  | ) |

Definition at line 179 of file flutter_windows_view.cc.

179 {
180 if (resize_status_ == ResizeState::kDone) {
181 // Request new frame.
182 engine_->ScheduleFrame();
183 }
184 }
flutter::FlutterWindowsEngine::ScheduleFrame
void ScheduleFrame()
Definition: flutter_windows_engine.cc:783

References flutter::FlutterWindowsEngine::ScheduleFrame().

Referenced by OnWindowRepaint().

## ◆ GetAxFragmentRootDelegate()

ui::AXFragmentRootDelegateWin * flutter::FlutterWindowsView::GetAxFragmentRootDelegate | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 803 of file flutter_windows_view.cc.

803 {
804 return accessibility_bridge_.get();
805 }

## ◆ GetEngine()

FlutterWindowsEngine * flutter::FlutterWindowsView::GetEngine | ( |  | ) | const

Definition at line 782 of file flutter_windows_view.cc.

782 {
783 return engine_;
784 }

Referenced by flutter::AccessibilityBridgeWindows::DispatchAccessibilityAction(), and FlutterDesktopViewGetGraphicsAdapter().

## ◆ GetNativeViewAccessible()

gfx::NativeViewAccessible flutter::FlutterWindowsView::GetNativeViewAccessible | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 352 of file flutter_windows_view.cc.

352 {
353 if (!accessibility_bridge_) {
354 return nullptr;
355 }
356
357 return accessibility_bridge_->GetChildOfAXFragmentRoot();
358 }

## ◆ GetWindowHandle()

HWND flutter::FlutterWindowsView::GetWindowHandle | ( |  | ) | const
| virtual

Definition at line 778 of file flutter_windows_view.cc.

778 {
779 return binding_handler_->GetWindowHandle();
780 }

Referenced by CreateRenderSurface(), FlutterDesktopViewGetHWND(), flutter::FlutterPlatformNodeDelegateWindows::GetBoundsRect(), flutter::PlatformHandler::GetHasStrings(), flutter::PlatformHandler::GetPlainText(), flutter::FlutterPlatformNodeDelegateWindows::GetTargetForNativeAccessibilityEvent(), flutter::PlatformHandler::SetPlainText(), and ~FlutterWindowsView().

## ◆ IsImplicitView()

bool flutter::FlutterWindowsView::IsImplicitView | ( |  | ) | const

Definition at line 713 of file flutter_windows_view.cc.

713 {
714 return view_id_ == kImplicitViewId;
715 }
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:55

References flutter::kImplicitViewId.

Referenced by SendInitialBounds().

## ◆ NotifyWinEventWrapper()

void flutter::FlutterWindowsView::NotifyWinEventWrapper | ( | ui::AXPlatformNodeWin * | node,
|  | ax::mojom::Event | event
| ) |  |
| protectedvirtual

Definition at line 796 of file flutter_windows_view.cc.

797 {
798 if (node) {
799 node->NotifyAccessibilityEvent(event);
800 }
801 }

Referenced by AnnounceAlert().

## ◆ OnComposeBegin()

void flutter::FlutterWindowsView::OnComposeBegin | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 315 of file flutter_windows_view.cc.

315 {
316 SendComposeBegin();
317 }

## ◆ OnComposeChange()

void flutter::FlutterWindowsView::OnComposeChange | ( | const std::u16string & | text,
|  | int | cursor_pos
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 327 of file flutter_windows_view.cc.

328 {
329 SendComposeChange(text, cursor_pos);
330 }

References text.

## ◆ OnComposeCommit()

void flutter::FlutterWindowsView::OnComposeCommit | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 319 of file flutter_windows_view.cc.

319 {
320 SendComposeCommit();
321 }

## ◆ OnComposeEnd()

void flutter::FlutterWindowsView::OnComposeEnd | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 323 of file flutter_windows_view.cc.

323 {
324 SendComposeEnd();
325 }

## ◆ OnCursorRectUpdated()

void flutter::FlutterWindowsView::OnCursorRectUpdated | ( | const Rect & | rect | ) |
| virtual

Definition at line 360 of file flutter_windows_view.cc.

360 {
361 binding_handler_->OnCursorRectUpdated(rect);
362 }

## ◆ OnDwmCompositionChanged()

void flutter::FlutterWindowsView::OnDwmCompositionChanged | ( |  | ) |

Definition at line 828 of file flutter_windows_view.cc.

828 {
829 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
830 }

## ◆ OnEmptyFrameGenerated()

bool flutter::FlutterWindowsView::OnEmptyFrameGenerated | ( |  | ) |

Definition at line 131 of file flutter_windows_view.cc.

131 {
132 // Called on the raster thread.
133 std::unique_lock<std::mutex> lock(resize_mutex_);
134
135 if (surface_ == nullptr || !surface_->IsValid()) {
136 return false;
137 }
138
139 if (resize_status_ != ResizeState::kResizeStarted) {
140 return true;
141 }
142
143 if (!ResizeRenderSurface(resize_target_height_, resize_target_width_)) {
144 return false;
145 }
146
147 // Platform thread is blocked for the entire duration until the
148 // resize_status_ is set to kDone by |OnFramePresented|.
149 resize_status_ = ResizeState::kFrameGenerated;
150 return true;
151 }

## ◆ OnFocus()

void flutter::FlutterWindowsView::OnFocus | ( | FlutterViewFocusState | focus_state,
|  | FlutterViewFocusDirection | direction
| ) |  |
| overridevirtual

Notifies the delegate that the backing window has received or lost focus.

Typically called by currently configured WindowBindingHandler.

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 310 of file flutter_windows_view.cc.

311 {
312 SendFocus(focus_state, direction);
313 }

## ◆ OnFrameGenerated()

bool flutter::FlutterWindowsView::OnFrameGenerated | ( | size_t | width,
|  | size_t | height
| ) |  |

Definition at line 153 of file flutter_windows_view.cc.

153 {
154 // Called on the raster thread.
155 std::unique_lock<std::mutex> lock(resize_mutex_);
156
157 if (surface_ == nullptr || !surface_->IsValid()) {
158 return false;
159 }
160
161 if (resize_status_ != ResizeState::kResizeStarted) {
162 return true;
163 }
164
165 if (resize_target_width_ != width || resize_target_height_ != height) {
166 return false;
167 }
168
169 if (!ResizeRenderSurface(resize_target_width_, resize_target_height_)) {
170 return false;
171 }
172
173 // Platform thread is blocked for the entire duration until the
174 // resize_status_ is set to kDone by |OnFramePresented|.
175 resize_status_ = ResizeState::kFrameGenerated;
176 return true;
177 }

Referenced by flutter::CompositorOpenGL::Present().

## ◆ OnFramePresented()

void flutter::FlutterWindowsView::OnFramePresented | ( |  | ) |
| virtual

Definition at line 665 of file flutter_windows_view.cc.

665 {
666 // Called on the engine's raster thread.
667 std::unique_lock<std::mutex> lock(resize_mutex_);
668
669 switch (resize_status_) {
670 case ResizeState::kResizeStarted:
671 // The caller must first call |OnFrameGenerated| or
672 // |OnEmptyFrameGenerated| before calling this method. This
673 // indicates one of the following:
674 //
675 // 1. The caller did not call these methods.
676 // 2. The caller ignored these methods' result.
677 // 3. The platform thread started a resize after the caller called these
678 // methods. We might have presented a frame of the wrong size to the
679 // view.
680 return;
681 case ResizeState::kFrameGenerated: {
682 // A frame was generated for a pending resize.
683 resize_status_ = ResizeState::kDone;
684 // Unblock the platform thread.
685 engine_->task_runner()->PostTask([this] {});
686
687 lock.unlock();
688
689 // Blocking the raster thread until DWM flushes alleviates glitches where
690 // previous size surface is stretched over current size view.
691 windows_proc_table_->DwmFlush();
692 }
693 case ResizeState::kDone:
694 return;
695 }
696 }
flutter::FlutterWindowsEngine::task_runner
TaskRunner * task_runner()
Definition: flutter_windows_engine.h:161
flutter::TaskRunner::PostTask
void PostTask(TaskClosure task)
Definition: task_runner.cc:88

References flutter::TaskRunner::PostTask(), and flutter::FlutterWindowsEngine::task_runner().

Referenced by flutter::CompositorOpenGL::Present().

## ◆ OnHighContrastChanged()

void flutter::FlutterWindowsView::OnHighContrastChanged | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 774 of file flutter_windows_view.cc.

774 {
775 engine_->UpdateHighContrastMode();
776 }
flutter::FlutterWindowsEngine::UpdateHighContrastMode
void UpdateHighContrastMode()
Definition: flutter_windows_engine.cc:984

References flutter::FlutterWindowsEngine::UpdateHighContrastMode().

## ◆ OnKey()

void flutter::FlutterWindowsView::OnKey | ( | int | key,
|  | int | scancode,
|  | int | action,
|  | char32_t | character,
|  | bool | extended,
|  | bool | was_down,
|  | KeyEventCallback | callback
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 300 of file flutter_windows_view.cc.

306 {
307 SendKey(key, scancode, action, character, extended, was_down, callback);
308 }
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:52
extended
bool extended
Definition: keyboard_key_handler_unittests.cc:118
key
int key
Definition: keyboard_key_handler_unittests.cc:114
character
char32_t character
Definition: keyboard_key_handler_unittests.cc:117
action
int action
Definition: keyboard_key_handler_unittests.cc:116
scancode
int scancode
Definition: keyboard_key_handler_unittests.cc:115
was_down
bool was_down
Definition: keyboard_key_handler_unittests.cc:119

References action, callback, character, extended, key, scancode, and was_down.

## ◆ OnPointerDown()

void flutter::FlutterWindowsView::OnPointerDown | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | FlutterPointerMouseButtons | button
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 246 of file flutter_windows_view.cc.

251 {
252 if (flutter_button != 0) {
253 auto state = GetOrCreatePointerState(device_kind, device_id);
254 state->buttons |= flutter_button;
255 SendPointerDown(x, y, state);
256 }
257 }

## ◆ OnPointerLeave()

void flutter::FlutterWindowsView::OnPointerLeave | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id = `0`
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 272 of file flutter_windows_view.cc.

275 {
276 SendPointerLeave(x, y, GetOrCreatePointerState(device_kind, device_id));
277 }

## ◆ OnPointerMove()

void flutter::FlutterWindowsView::OnPointerMove | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | int | modifiers_state
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 237 of file flutter_windows_view.cc.

241 {
242 engine_->keyboard_key_handler()->SyncModifiersIfNeeded(modifiers_state);
243 SendPointerMove(x, y, GetOrCreatePointerState(device_kind, device_id));
244 }
flutter::FlutterWindowsEngine::keyboard_key_handler
KeyboardHandlerBase * keyboard_key_handler()
Definition: flutter_windows_engine.h:191
flutter::KeyboardHandlerBase::SyncModifiersIfNeeded
virtual void SyncModifiersIfNeeded(int modifiers_state)=0

References flutter::FlutterWindowsEngine::keyboard_key_handler(), and flutter::KeyboardHandlerBase::SyncModifiersIfNeeded().

## ◆ OnPointerPanZoomEnd()

void flutter::FlutterWindowsView::OnPointerPanZoomEnd | ( | int32_t | device_id | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 292 of file flutter_windows_view.cc.

292 {
293 SendPointerPanZoomEnd(device_id);
294 }

## ◆ OnPointerPanZoomStart()

void flutter::FlutterWindowsView::OnPointerPanZoomStart | ( | int32_t | device_id | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 279 of file flutter_windows_view.cc.

279 {
280 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
281 SendPointerPanZoomStart(device_id, point.x, point.y);
282 }

References flutter::PointerLocation::x, and flutter::PointerLocation::y.

## ◆ OnPointerPanZoomUpdate()

void flutter::FlutterWindowsView::OnPointerPanZoomUpdate | ( | int32_t | device_id,
|  | double | pan_x,
|  | double | pan_y,
|  | double | scale,
|  | double | rotation
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 284 of file flutter_windows_view.cc.

288 {
289 SendPointerPanZoomUpdate(device_id, pan_x, pan_y, scale, rotation);
290 }

## ◆ OnPointerUp()

void flutter::FlutterWindowsView::OnPointerUp | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | FlutterPointerMouseButtons | button
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 259 of file flutter_windows_view.cc.

264 {
265 if (flutter_button != 0) {
266 auto state = GetOrCreatePointerState(device_kind, device_id);
267 state->buttons &= ~flutter_button;
268 SendPointerUp(x, y, state);
269 }
270 }

## ◆ OnResetImeComposing()

void flutter::FlutterWindowsView::OnResetImeComposing | ( |  | ) |
| virtual

Definition at line 364 of file flutter_windows_view.cc.

364 {
365 binding_handler_->OnResetImeComposing();
366 }

## ◆ OnScroll()

void flutter::FlutterWindowsView::OnScroll | ( | double | x,
|  | double | y,
|  | double | delta_x,
|  | double | delta_y,
|  | int | scroll_offset_multiplier,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 332 of file flutter_windows_view.cc.

338 {
339 SendScroll(x, y, delta_x, delta_y, scroll_offset_multiplier, device_kind,
340 device_id);
341 }

## ◆ OnScrollInertiaCancel()

void flutter::FlutterWindowsView::OnScrollInertiaCancel | ( | int32_t | device_id | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 343 of file flutter_windows_view.cc.

343 {
344 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
345 SendScrollInertiaCancel(device_id, point.x, point.y);
346 }

References flutter::PointerLocation::x, and flutter::PointerLocation::y.

## ◆ OnText()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 296 of file flutter_windows_view.cc.

296 {
297 SendText(text);
298 }

References text.

## ◆ OnUpdateSemanticsEnabled()

void flutter::FlutterWindowsView::OnUpdateSemanticsEnabled | ( | bool | enabled | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 348 of file flutter_windows_view.cc.

348 {
349 engine_->UpdateSemanticsEnabled(enabled);
350 }
flutter::FlutterWindowsEngine::UpdateSemanticsEnabled
void UpdateSemanticsEnabled(bool enabled)
Definition: flutter_windows_engine.cc:949

References flutter::FlutterWindowsEngine::UpdateSemanticsEnabled().

## ◆ OnWindowRepaint()

void flutter::FlutterWindowsView::OnWindowRepaint | ( |  | ) |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 233 of file flutter_windows_view.cc.

233 {
234 ForceRedraw();
235 }
flutter::FlutterWindowsView::ForceRedraw
void ForceRedraw()
Definition: flutter_windows_view.cc:179

References ForceRedraw().

## ◆ OnWindowSizeChanged()

bool flutter::FlutterWindowsView::OnWindowSizeChanged | ( | size_t | width,
|  | size_t | height
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 187 of file flutter_windows_view.cc.

187 {
188 if (!engine_->egl_manager()) {
189 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
190 return true;
191 }
192
193 if (!surface_ || !surface_->IsValid()) {
194 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
195 return true;
196 }
197
198 // We're using OpenGL rendering. Resizing the surface must happen on the
199 // raster thread.
200 bool surface_will_update =
201 SurfaceWillUpdate(surface_->width(), surface_->height(), width, height);
202 if (!surface_will_update) {
203 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
204 return true;
205 }
206
207 {
208 std::unique_lock<std::mutex> lock(resize_mutex_);
209 resize_status_ = ResizeState::kResizeStarted;
210 resize_target_width_ = width;
211 resize_target_height_ = height;
212 }
213
214 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
215
216 std::chrono::time_point<std::chrono::steady_clock> start_time =
217 std::chrono::steady_clock::now();
218
219 while (true) {
220 if (std::chrono::steady_clock::now() > start_time + kWindowResizeTimeout) {
221 return false;
222 }
223 std::unique_lock<std::mutex> lock(resize_mutex_);
224 if (resize_status_ == ResizeState::kDone) {
225 break;
226 }
227 lock.unlock();
228 engine_->task_runner()->PollOnce(kWindowResizeTimeout);
229 }
230 return true;
231 }
flutter::TaskRunner::PollOnce
void PollOnce(std::chrono::milliseconds timeout)
Definition: task_runner.cc:95

References flutter::FlutterWindowsEngine::egl_manager(), flutter::TaskRunner::PollOnce(), and flutter::FlutterWindowsEngine::task_runner().

## ◆ OnWindowStateEvent()

void flutter::FlutterWindowsView::OnWindowStateEvent | ( | HWND | hwnd,
|  | WindowStateEvent | event
| ) |  |
| overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 832 of file flutter_windows_view.cc.

832 {
833 engine_->OnWindowStateEvent(hwnd, event);
834 }

References flutter::FlutterWindowsEngine::OnWindowStateEvent().

## ◆ PresentSoftwareBitmap()

bool flutter::FlutterWindowsView::PresentSoftwareBitmap | ( | const void * | allocation,
|  | size_t | row_bytes,
|  | size_t | height
| ) |  |
| virtual

Definition at line 702 of file flutter_windows_view.cc.

704 {
705 return binding_handler_->OnBitmapSurfaceUpdated(allocation, row_bytes,
706 height);
707 }

Referenced by flutter::CompositorSoftware::Present().

## ◆ SendInitialBounds()

void flutter::FlutterWindowsView::SendInitialBounds | ( |  | ) |

Definition at line 395 of file flutter_windows_view.cc.

395 {
396 // Non-implicit views' initial window metrics are sent when the view is added
397 // to the engine.
398 if (!IsImplicitView()) {
399 return;
400 }
401
402 engine_->SendWindowMetricsEvent(CreateWindowMetricsEvent());
403 }
flutter::FlutterWindowsEngine::SendWindowMetricsEvent
void SendWindowMetricsEvent(const FlutterWindowMetricsEvent &event)
Definition: flutter_windows_engine.cc:696
flutter::FlutterWindowsView::IsImplicitView
bool IsImplicitView() const
Definition: flutter_windows_view.cc:713
flutter::FlutterWindowsView::CreateWindowMetricsEvent
FlutterWindowMetricsEvent CreateWindowMetricsEvent() const
Definition: flutter_windows_view.cc:381

References CreateWindowMetricsEvent(), IsImplicitView(), and flutter::FlutterWindowsEngine::SendWindowMetricsEvent().

## ◆ surface()

egl::WindowSurface * flutter::FlutterWindowsView::surface | ( |  | ) | const

Definition at line 770 of file flutter_windows_view.cc.

770 {
771 return surface_.get();
772 }

Referenced by flutter::CompositorOpenGL::Present().

## ◆ UpdateSemanticsEnabled()

void flutter::FlutterWindowsView::UpdateSemanticsEnabled | ( | bool | enabled | ) |
| virtual

Definition at line 816 of file flutter_windows_view.cc.

816 {
817 if (semantics_enabled_ != enabled) {
818 semantics_enabled_ = enabled;
819
820 if (!semantics_enabled_ && accessibility_bridge_) {
821 accessibility_bridge_.reset();
822 } else if (semantics_enabled_ && !accessibility_bridge_) {
823 accessibility_bridge_ = CreateAccessibilityBridge();
824 }
825 }
826 }
flutter::FlutterWindowsView::CreateAccessibilityBridge
virtual std::shared_ptr< AccessibilityBridgeWindows > CreateAccessibilityBridge()
Definition: flutter_windows_view.cc:812

References CreateAccessibilityBridge().

## ◆ view_id()

FlutterViewId flutter::FlutterWindowsView::view_id | ( |  | ) | const

Definition at line 709 of file flutter_windows_view.cc.

709 {
710 return view_id_;
711 }

Referenced by flutter::AccessibilityBridgeWindows::DispatchAccessibilityAction().

## Friends And Related Function Documentation

## ◆ ViewModifier

friend class ViewModifier
| friend

Definition at line 260 of file flutter_windows_view.h.

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

- shell/platform/windows/flutter_windows_view.h
- shell/platform/windows/flutter_windows_view.cc