| 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, bool is_sized_to_content, const BoxConstraints &box_constraints, FlutterWindowsViewSizingDelegate *sizing_delegate=nullptr, 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 ()
virtual void | AnnounceAlert (const std::wstring &text)
void | OnHighContrastChanged () override
bool | OnEmptyFrameGenerated ()
bool | OnFrameGenerated (size_t width, size_t height)
virtual void | OnFramePresented ()
void | SetFirstFrameCallback (fml::closure callback)
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, uint32_t rotation, uint32_t pressure, int modifiers_state) override
void | OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button, uint32_t rotation, uint32_t pressure) 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 47 of file flutter_windows_view.h.

## Constructor & Destructor Documentation

## ◆ FlutterWindowsView()

flutter::FlutterWindowsView::FlutterWindowsView | ( | FlutterViewId | view_id,
|  | FlutterWindowsEngine * | engine,
|  | std::unique_ptr< WindowBindingHandler > | window_binding,
|  | bool | is_sized_to_content,
|  | const BoxConstraints & | box_constraints,
|  | FlutterWindowsViewSizingDelegate * | sizing_delegate = `nullptr`,
|  | std::shared_ptr< WindowsProcTable > | windows_proc_table = `nullptr`
| ) |  |

Definition at line 110 of file flutter_windows_view.cc.

118 : view_id_(view_id),
119 engine_(engine),
120 is_sized_to_content_(is_sized_to_content),
121 box_constraints_(box_constraints),
122 sizing_delegate_(sizing_delegate),
123 windows_proc_table_(std::move(windows_proc_table)) {
124 if (windows_proc_table_ == nullptr) {
125 windows_proc_table_ = std::make_shared<WindowsProcTable>();
126 }
127
128 // Take the binding handler, and give it a pointer back to self.
129 binding_handler_ = std::move(window_binding);
130 binding_handler_->SetView(this);
131 }
flutter::FlutterWindowsView::view_id
FlutterViewId view_id() const
Definition: flutter_windows_view.cc:795

## ◆ ~FlutterWindowsView()

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

Definition at line 133 of file flutter_windows_view.cc.

133 {
134 // The view owns the child window.
135 // Notify the engine the view's child window will no longer be visible.
136 engine_->OnWindowStateEvent(GetWindowHandle(), WindowStateEvent::kHide);
137
138 if (surface_) {
139 DestroyWindowSurface(*engine_, std::move(surface_));
140 }
141 }
flutter::FlutterWindowsEngine::OnWindowStateEvent
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)
Definition: flutter_windows_engine.cc:1069
flutter::FlutterWindowsView::GetWindowHandle
virtual HWND GetWindowHandle() const
Definition: flutter_windows_view.cc:864
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 265 of file flutter_windows_view.h.

265 {
266 return accessibility_bridge_;
267 }

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

## ◆ AlertNode()

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

Definition at line 893 of file flutter_windows_view.cc.

893 {
894 return binding_handler_->GetAlert();
895 }

## ◆ AnnounceAlert()

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

Definition at line 872 of file flutter_windows_view.cc.

872 {
873 auto alert_delegate = binding_handler_->GetAlertDelegate();
874 if (!alert_delegate) {
875 return;
876 }
877 alert_delegate->SetText(fml::WideStringToUtf16(text));
878 ui::AXPlatformNodeWin* alert_node = binding_handler_->GetAlert();
879 NotifyWinEventWrapper(alert_node, ax::mojom::Event::kAlert);
880 }
flutter::FlutterWindowsView::NotifyWinEventWrapper
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
Definition: flutter_windows_view.cc:882
text
std::u16string text
Definition: keyboard_unittests.cc:332

References NotifyWinEventWrapper(), and text.

## ◆ ClearSoftwareBitmap()

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

Definition at line 778 of file flutter_windows_view.cc.

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

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

## ◆ CreateAccessibilityBridge()

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

Definition at line 898 of file flutter_windows_view.cc.

898 {
899 return std::make_shared<AccessibilityBridgeWindows>(this);
900 }

Referenced by UpdateSemanticsEnabled().

## ◆ CreateRenderSurface()

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

Definition at line 803 of file flutter_windows_view.cc.

803 {
804 FML_DCHECK(surface_ == nullptr);
805
806 if (engine_->egl_manager()) {
807 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
808 surface_ = engine_->egl_manager()->CreateWindowSurface(
809 GetWindowHandle(), bounds.width, bounds.height);
810
811 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
812
813 resize_target_width_ = bounds.width;
814 resize_target_height_ = bounds.height;
815 }
816 }
flutter::FlutterWindowsEngine::egl_manager
egl::Manager * egl_manager() const
Definition: flutter_windows_engine.h:183
flutter::egl::Manager::CreateWindowSurface
virtual std::unique_ptr< WindowSurface > CreateWindowSurface(HWND hwnd, size_t width, size_t height)
Definition: manager.cc:283

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 428 of file flutter_windows_view.cc.

428 {
429 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
430 double pixel_ratio = binding_handler_->GetDpiScale();
431 FlutterEngineDisplayId display_id = binding_handler_->GetDisplayId();
432
433 FlutterWindowMetricsEvent event = {};
434 event.struct_size = sizeof(event);
435 event.width = bounds.width;
436 event.height = bounds.height;
437 auto constraints = GetConstraints();
438 event.has_constraints = true;
439 event.min_width_constraint =
440 static_cast<size_t>(constraints.smallest().width());
441 event.min_height_constraint =
442 static_cast<size_t>(constraints.smallest().height());
443 event.max_width_constraint =
444 static_cast<size_t>(constraints.biggest().width());
445 event.max_height_constraint =
446 static_cast<size_t>(constraints.biggest().height());
447 event.pixel_ratio = pixel_ratio;
448 event.display_id = display_id;
449 event.view_id = view_id_;
450
451 return event;
452 }

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

Referenced by SendInitialBounds().

## ◆ Focus()

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

Definition at line 922 of file flutter_windows_view.cc.

922 {
923 return binding_handler_->Focus();
924 }

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

## ◆ ForceRedraw()

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

Definition at line 200 of file flutter_windows_view.cc.

200 {
201 if (resize_status_ == ResizeState::kDone) {
202 // Request new frame.
203 engine_->ScheduleFrame();
204 }
205 }
flutter::FlutterWindowsEngine::ScheduleFrame
void ScheduleFrame()
Definition: flutter_windows_engine.cc:810

References flutter::FlutterWindowsEngine::ScheduleFrame().

Referenced by OnWindowRepaint().

## ◆ GetAxFragmentRootDelegate()

ui::AXFragmentRootDelegateWin * flutter::FlutterWindowsView::GetAxFragmentRootDelegate | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 889 of file flutter_windows_view.cc.

889 {
890 return accessibility_bridge_.get();
891 }

## ◆ GetEngine()

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

Definition at line 868 of file flutter_windows_view.cc.

868 {
869 return engine_;
870 }

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

## ◆ GetNativeViewAccessible()

gfx::NativeViewAccessible flutter::FlutterWindowsView::GetNativeViewAccessible | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 387 of file flutter_windows_view.cc.

387 {
388 if (!accessibility_bridge_) {
389 return nullptr;
390 }
391
392 return accessibility_bridge_->GetChildOfAXFragmentRoot();
393 }

## ◆ GetWindowHandle()

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

Definition at line 864 of file flutter_windows_view.cc.

864 {
865 return binding_handler_->GetWindowHandle();
866 }

Referenced by CreateRenderSurface(), FlutterDesktopViewGetHWND(), flutter::FlutterPlatformNodeDelegateWindows::GetBoundsRect(), flutter::FlutterPlatformNodeDelegateWindows::GetTargetForNativeAccessibilityEvent(), InternalFlutterWindows_WindowManager_GetTopLevelWindowHandle(), and ~FlutterWindowsView().

## ◆ IsImplicitView()

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

Definition at line 799 of file flutter_windows_view.cc.

799 {
800 return view_id_ == kImplicitViewId;
801 }
flutter::kImplicitViewId
constexpr FlutterViewId kImplicitViewId
Definition: flutter_windows_engine.h:56

References flutter::kImplicitViewId.

Referenced by SendInitialBounds().

## ◆ NotifyWinEventWrapper()

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

Definition at line 882 of file flutter_windows_view.cc.

883 {
884 if (node) {
885 node->NotifyAccessibilityEvent(event);
886 }
887 }

Referenced by AnnounceAlert().

## ◆ OnComposeBegin()

void flutter::FlutterWindowsView::OnComposeBegin | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 350 of file flutter_windows_view.cc.

350 {
351 SendComposeBegin();
352 }

## ◆ OnComposeChange()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 362 of file flutter_windows_view.cc.

363 {
364 SendComposeChange(text, cursor_pos);
365 }

References text.

## ◆ OnComposeCommit()

void flutter::FlutterWindowsView::OnComposeCommit | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 354 of file flutter_windows_view.cc.

354 {
355 SendComposeCommit();
356 }

## ◆ OnComposeEnd()

void flutter::FlutterWindowsView::OnComposeEnd | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 358 of file flutter_windows_view.cc.

358 {
359 SendComposeEnd();
360 }

## ◆ OnCursorRectUpdated()

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

Definition at line 395 of file flutter_windows_view.cc.

395 {
396 binding_handler_->OnCursorRectUpdated(rect);
397 }

## ◆ OnDwmCompositionChanged()

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

Definition at line 914 of file flutter_windows_view.cc.

914 {
915 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
916 }

## ◆ OnEmptyFrameGenerated()

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

Definition at line 143 of file flutter_windows_view.cc.

143 {
144 // Called on the raster thread.
145 std::unique_lock<std::mutex> lock(resize_mutex_);
146
147 if (surface_ == nullptr || !surface_->IsValid()) {
148 return false;
149 }
150
151 if (resize_status_ != ResizeState::kResizeStarted) {
152 return true;
153 }
154
155 if (!ResizeRenderSurface(resize_target_height_, resize_target_width_)) {
156 return false;
157 }
158
159 // Platform thread is blocked for the entire duration until the
160 // resize_status_ is set to kDone by |OnFramePresented|.
161 resize_status_ = ResizeState::kFrameGenerated;
162 return true;
163 }

## ◆ OnFocus()

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

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

Typically called by currently configured WindowBindingHandler.

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 345 of file flutter_windows_view.cc.

346 {
347 SendFocus(focus_state, direction);
348 }

## ◆ OnFrameGenerated()

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

Definition at line 165 of file flutter_windows_view.cc.

165 {
166 // Called on the raster thread.
167 std::unique_lock<std::mutex> lock(resize_mutex_);
168
169 if (IsSizedToContent()) {
170 if (!ResizeRenderSurface(width, height)) {
171 return false;
172 }
173
174 sizing_delegate_->DidUpdateViewSize(width, height);
175 return true;
176 }
177
178 if (surface_ == nullptr || !surface_->IsValid()) {
179 return false;
180 }
181
182 if (resize_status_ != ResizeState::kResizeStarted) {
183 return true;
184 }
185
186 if (resize_target_width_ != width || resize_target_height_ != height) {
187 return false;
188 }
189
190 if (!ResizeRenderSurface(resize_target_width_, resize_target_height_)) {
191 return false;
192 }
193
194 // Platform thread is blocked for the entire duration until the
195 // resize_status_ is set to kDone by |OnFramePresented|.
196 resize_status_ = ResizeState::kFrameGenerated;
197 return true;
198 }
flutter::FlutterWindowsViewSizingDelegate::DidUpdateViewSize
virtual void DidUpdateViewSize(int32_t width, int32_t height)=0

References flutter::FlutterWindowsViewSizingDelegate::DidUpdateViewSize().

Referenced by flutter::CompositorOpenGL::Present(), and flutter::testing::TEST_F().

## ◆ OnFramePresented()

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

Definition at line 743 of file flutter_windows_view.cc.

743 {
744 // Called on the engine's raster thread.
745 FireFirstFrameCallbackIfSet();
746
747 std::unique_lock<std::mutex> lock(resize_mutex_);
748
749 switch (resize_status_) {
750 case ResizeState::kResizeStarted:
751 // The caller must first call |OnFrameGenerated| or
752 // |OnEmptyFrameGenerated| before calling this method. This
753 // indicates one of the following:
754 //
755 // 1. The caller did not call these methods.
756 // 2. The caller ignored these methods' result.
757 // 3. The platform thread started a resize after the caller called these
758 // methods. We might have presented a frame of the wrong size to the
759 // view.
760 return;
761 case ResizeState::kFrameGenerated: {
762 // A frame was generated for a pending resize.
763 resize_status_ = ResizeState::kDone;
764 // Unblock the platform thread.
765 engine_->task_runner()->PostTask([this] {});
766
767 lock.unlock();
768
769 // Blocking the raster thread until DWM flushes alleviates glitches where
770 // previous size surface is stretched over current size view.
771 windows_proc_table_->DwmFlush();
772 }
773 case ResizeState::kDone:
774 return;
775 }
776 }
flutter::FlutterWindowsEngine::task_runner
TaskRunner * task_runner()
Definition: flutter_windows_engine.h:173
flutter::TaskRunner::PostTask
void PostTask(TaskClosure task)
Definition: task_runner.cc:89

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

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

## ◆ OnHighContrastChanged()

void flutter::FlutterWindowsView::OnHighContrastChanged | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 860 of file flutter_windows_view.cc.

860 {
861 engine_->UpdateHighContrastMode();
862 }
flutter::FlutterWindowsEngine::UpdateHighContrastMode
void UpdateHighContrastMode()
Definition: flutter_windows_engine.cc:1025

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
| ) |  |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 335 of file flutter_windows_view.cc.

341 {
342 SendKey(key, scancode, action, character, extended, was_down, callback);
343 }
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,
|  | uint32_t | rotation,
|  | uint32_t | pressure
| ) |  |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 277 of file flutter_windows_view.cc.

284 {
285 if (flutter_button != 0) {
286 auto state = GetOrCreatePointerState(device_kind, device_id);
287 state->buttons |= flutter_button;
288 state->rotation = rotation;
289 state->pressure = pressure;
290 SendPointerDown(x, y, state);
291 }
292 }

## ◆ OnPointerLeave()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 307 of file flutter_windows_view.cc.

310 {
311 SendPointerLeave(x, y, GetOrCreatePointerState(device_kind, device_id));
312 }

## ◆ OnPointerMove()

void flutter::FlutterWindowsView::OnPointerMove | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | uint32_t | rotation,
|  | uint32_t | pressure,
|  | int | modifiers_state
| ) |  |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 263 of file flutter_windows_view.cc.

269 {
270 engine_->keyboard_key_handler()->SyncModifiersIfNeeded(modifiers_state);
271 auto state = GetOrCreatePointerState(device_kind, device_id);
272 state->rotation = rotation;
273 state->pressure = pressure;
274 SendPointerMove(x, y, state);
275 }
flutter::FlutterWindowsEngine::keyboard_key_handler
KeyboardHandlerBase * keyboard_key_handler()
Definition: flutter_windows_engine.h:203
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 | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 327 of file flutter_windows_view.cc.

327 {
328 SendPointerPanZoomEnd(device_id);
329 }

## ◆ OnPointerPanZoomStart()

void flutter::FlutterWindowsView::OnPointerPanZoomStart | ( | int32_t | device_id | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 314 of file flutter_windows_view.cc.

314 {
315 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
316 SendPointerPanZoomStart(device_id, point.x, point.y);
317 }

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
| ) |  |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 319 of file flutter_windows_view.cc.

323 {
324 SendPointerPanZoomUpdate(device_id, pan_x, pan_y, scale, rotation);
325 }

## ◆ OnPointerUp()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 294 of file flutter_windows_view.cc.

299 {
300 if (flutter_button != 0) {
301 auto state = GetOrCreatePointerState(device_kind, device_id);
302 state->buttons &= ~flutter_button;
303 SendPointerUp(x, y, state);
304 }
305 }

## ◆ OnResetImeComposing()

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

Definition at line 399 of file flutter_windows_view.cc.

399 {
400 binding_handler_->OnResetImeComposing();
401 }

## ◆ 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
| ) |  |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 367 of file flutter_windows_view.cc.

373 {
374 SendScroll(x, y, delta_x, delta_y, scroll_offset_multiplier, device_kind,
375 device_id);
376 }

## ◆ OnScrollInertiaCancel()

void flutter::FlutterWindowsView::OnScrollInertiaCancel | ( | int32_t | device_id | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 378 of file flutter_windows_view.cc.

378 {
379 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
380 SendScrollInertiaCancel(device_id, point.x, point.y);
381 }

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

## ◆ OnText()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 331 of file flutter_windows_view.cc.

331 {
332 SendText(text);
333 }

References text.

## ◆ OnUpdateSemanticsEnabled()

void flutter::FlutterWindowsView::OnUpdateSemanticsEnabled | ( | bool | enabled | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 383 of file flutter_windows_view.cc.

383 {
384 engine_->UpdateSemanticsEnabled(enabled);
385 }
flutter::FlutterWindowsEngine::UpdateSemanticsEnabled
void UpdateSemanticsEnabled(bool enabled)
Definition: flutter_windows_engine.cc:990

References flutter::FlutterWindowsEngine::UpdateSemanticsEnabled().

Referenced by flutter::testing::TEST_F().

## ◆ OnWindowRepaint()

void flutter::FlutterWindowsView::OnWindowRepaint | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 259 of file flutter_windows_view.cc.

259 {
260 ForceRedraw();
261 }
flutter::FlutterWindowsView::ForceRedraw
void ForceRedraw()
Definition: flutter_windows_view.cc:200

References ForceRedraw().

## ◆ OnWindowSizeChanged()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 208 of file flutter_windows_view.cc.

208 {
209 if (IsSizedToContent()) {
210 // No resize synchronization needed for views sized to content.
211 return true;
212 }
213
214 if (!engine_->egl_manager()) {
215 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
216 return true;
217 }
218
219 if (!surface_ || !surface_->IsValid()) {
220 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
221 return true;
222 }
223
224 // We're using OpenGL rendering. Resizing the surface must happen on the
225 // raster thread.
226 bool surface_will_update =
227 SurfaceWillUpdate(surface_->width(), surface_->height(), width, height);
228 if (!surface_will_update) {
229 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
230 return true;
231 }
232
233 {
234 std::unique_lock<std::mutex> lock(resize_mutex_);
235 resize_status_ = ResizeState::kResizeStarted;
236 resize_target_width_ = width;
237 resize_target_height_ = height;
238 }
239
240 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
241
242 std::chrono::time_point<std::chrono::steady_clock> start_time =
243 std::chrono::steady_clock::now();
244
245 while (true) {
246 if (std::chrono::steady_clock::now() > start_time + kWindowResizeTimeout) {
247 return false;
248 }
249 std::unique_lock<std::mutex> lock(resize_mutex_);
250 if (resize_status_ == ResizeState::kDone) {
251 break;
252 }
253 lock.unlock();
254 engine_->task_runner()->PollOnce(kWindowResizeTimeout);
255 }
256 return true;
257 }
flutter::TaskRunner::PollOnce
void PollOnce(std::chrono::milliseconds timeout)
Definition: task_runner.cc:96

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

## ◆ OnWindowStateEvent()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 918 of file flutter_windows_view.cc.

918 {
919 engine_->OnWindowStateEvent(hwnd, event);
920 }

References flutter::FlutterWindowsEngine::OnWindowStateEvent().

## ◆ PresentSoftwareBitmap()

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

Definition at line 782 of file flutter_windows_view.cc.

784 {
785 bool result =
786 binding_handler_->OnBitmapSurfaceUpdated(allocation, row_bytes, height);
787 if (result) {
788 // The software compositor does not call OnFramePresented, so fire the
789 // first frame callback here.
790 FireFirstFrameCallbackIfSet();
791 }
792 return result;
793 }

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

## ◆ SendInitialBounds()

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

Definition at line 454 of file flutter_windows_view.cc.

454 {
455 // Non-implicit views' initial window metrics are sent when the view is added
456 // to the engine.
457 if (!IsImplicitView()) {
458 return;
459 }
460
461 engine_->SendWindowMetricsEvent(CreateWindowMetricsEvent());
462 }
flutter::FlutterWindowsEngine::SendWindowMetricsEvent
void SendWindowMetricsEvent(const FlutterWindowMetricsEvent &event)
Definition: flutter_windows_engine.cc:723
flutter::FlutterWindowsView::IsImplicitView
bool IsImplicitView() const
Definition: flutter_windows_view.cc:799
flutter::FlutterWindowsView::CreateWindowMetricsEvent
FlutterWindowMetricsEvent CreateWindowMetricsEvent() const
Definition: flutter_windows_view.cc:428

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

## ◆ SetFirstFrameCallback()

void flutter::FlutterWindowsView::SetFirstFrameCallback | ( | fml::closure | callback | ) |

Definition at line 729 of file flutter_windows_view.cc.

729 {
730 std::scoped_lock lock(first_frame_callback_mutex_);
731 first_frame_callback_ = std::move(callback);
732 }

References callback.

## ◆ surface()

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

Definition at line 856 of file flutter_windows_view.cc.

856 {
857 return surface_.get();
858 }

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

## ◆ UpdateSemanticsEnabled()

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

Definition at line 902 of file flutter_windows_view.cc.

902 {
903 if (semantics_enabled_ != enabled) {
904 semantics_enabled_ = enabled;
905
906 if (!semantics_enabled_ && accessibility_bridge_) {
907 accessibility_bridge_.reset();
908 } else if (semantics_enabled_ && !accessibility_bridge_) {
909 accessibility_bridge_ = CreateAccessibilityBridge();
910 }
911 }
912 }
flutter::FlutterWindowsView::CreateAccessibilityBridge
virtual std::shared_ptr< AccessibilityBridgeWindows > CreateAccessibilityBridge()
Definition: flutter_windows_view.cc:898

References CreateAccessibilityBridge().

## ◆ view_id()

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

Definition at line 795 of file flutter_windows_view.cc.

795 {
796 return view_id_;
797 }

Referenced by flutter::AccessibilityBridgeWindows::DispatchAccessibilityAction(), and flutter::WindowManager::HandleMessage().

## Friends And Related Function Documentation

## ◆ ViewModifier

friend class ViewModifier
| friend

Definition at line 286 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