Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
flutter::FlutterWindowsView Class Reference

#include <flutter_windows_view.h>

Inheritance diagram for flutter::FlutterWindowsView:
flutter::WindowBindingHandlerDelegate flutter::testing::MockFlutterWindowsView flutter::testing::MockFlutterWindowsView flutter::testing::MockFlutterWindowsView flutter::testing::MockFlutterWindowsView flutter::testing::MockFlutterWindowsView

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::WindowSurfacesurface () const
 
virtual HWND GetWindowHandle () const
 
FlutterWindowsEngineGetEngine () 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 SetSizedToContent (bool sized_to_content)
 
bool IsSizedToContent () const
 
void OnWindowRepaint () override
 
void OnPointerMove (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, uint32_t rotation, uint32_t pressure, int modifiers_state) override
 
void OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, uint32_t rotation, uint32_t pressure) override
 
void OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons) 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::AXFragmentRootDelegateWinGetAxFragmentRootDelegate () override
 
virtual void UpdateSemanticsEnabled (bool enabled)
 
std::weak_ptr< AccessibilityBridgeWindowsaccessibility_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< AccessibilityBridgeWindowsCreateAccessibilityBridge ()
 

Friends

class ViewModifier
 

Additional Inherited Members

- Public Types inherited from flutter::WindowBindingHandlerDelegate
using KeyEventCallback = std::function< void(bool)>
 

Detailed Description

Definition at line 48 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}
FlutterEngine engine
Definition main.cc:84

◆ ~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.
137
138 if (surface_) {
139 DestroyWindowSurface(*engine_, std::move(surface_));
140 }
141}
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)

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 281 of file flutter_windows_view.h.

281 {
282 return accessibility_bridge_;
283 }

◆ AlertNode()

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

Definition at line 897 of file flutter_windows_view.cc.

897 {
898 return binding_handler_->GetAlert();
899}

◆ AnnounceAlert()

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

Definition at line 876 of file flutter_windows_view.cc.

876 {
877 auto alert_delegate = binding_handler_->GetAlertDelegate();
878 if (!alert_delegate) {
879 return;
880 }
881 alert_delegate->SetText(fml::WideStringToUtf16(text));
882 ui::AXPlatformNodeWin* alert_node = binding_handler_->GetAlert();
884}
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
std::u16string text
std::u16string WideStringToUtf16(const std::wstring_view str)

References ax::mojom::kAlert, NotifyWinEventWrapper(), text, and fml::WideStringToUtf16().

◆ ClearSoftwareBitmap()

bool flutter::FlutterWindowsView::ClearSoftwareBitmap ( )
virtual

Definition at line 782 of file flutter_windows_view.cc.

782 {
783 return binding_handler_->OnBitmapSurfaceCleared();
784}

◆ CreateAccessibilityBridge()

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

Definition at line 902 of file flutter_windows_view.cc.

902 {
903 return std::make_shared<AccessibilityBridgeWindows>(this);
904}

Referenced by UpdateSemanticsEnabled().

◆ CreateRenderSurface()

void flutter::FlutterWindowsView::CreateRenderSurface ( )

Definition at line 807 of file flutter_windows_view.cc.

807 {
808 FML_DCHECK(surface_ == nullptr);
809
810 if (engine_->egl_manager()) {
811 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
812 surface_ = engine_->egl_manager()->CreateWindowSurface(
813 GetWindowHandle(), bounds.width, bounds.height);
814
815 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
816
817 resize_target_width_ = bounds.width;
818 resize_target_height_ = bounds.height;
819 }
820}
virtual std::unique_ptr< WindowSurface > CreateWindowSurface(HWND hwnd, size_t width, size_t height)
Definition manager.cc:283
#define FML_DCHECK(condition)
Definition logging.h:122

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

◆ CreateWindowMetricsEvent()

FlutterWindowMetricsEvent flutter::FlutterWindowsView::CreateWindowMetricsEvent ( ) const

Definition at line 432 of file flutter_windows_view.cc.

432 {
433 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
434 double pixel_ratio = binding_handler_->GetDpiScale();
435 FlutterEngineDisplayId display_id = binding_handler_->GetDisplayId();
436
437 FlutterWindowMetricsEvent event = {};
438 event.struct_size = sizeof(event);
439 event.width = bounds.width;
440 event.height = bounds.height;
441 auto constraints = GetConstraints();
442 event.has_constraints = true;
443 event.min_width_constraint =
444 static_cast<size_t>(constraints.smallest().width());
445 event.min_height_constraint =
446 static_cast<size_t>(constraints.smallest().height());
447 event.max_width_constraint =
448 static_cast<size_t>(constraints.biggest().width());
449 event.max_height_constraint =
450 static_cast<size_t>(constraints.biggest().height());
451 event.pixel_ratio = pixel_ratio;
452 event.display_id = display_id;
453 event.view_id = view_id_;
454
455 return event;
456}
uint64_t FlutterEngineDisplayId
Definition embedder.h:1050
size_t struct_size
The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
Definition embedder.h:1054

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

Referenced by SendInitialBounds(), and SetSizedToContent().

◆ Focus()

bool flutter::FlutterWindowsView::Focus ( )
virtual

Definition at line 926 of file flutter_windows_view.cc.

926 {
927 return binding_handler_->Focus();
928}

◆ 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}

References flutter::FlutterWindowsEngine::ScheduleFrame().

Referenced by OnWindowRepaint().

◆ GetAxFragmentRootDelegate()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 893 of file flutter_windows_view.cc.

893 {
894 return accessibility_bridge_.get();
895}

◆ GetEngine()

◆ GetNativeViewAccessible()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 391 of file flutter_windows_view.cc.

391 {
392 if (!accessibility_bridge_) {
393 return nullptr;
394 }
395
396 return accessibility_bridge_->GetChildOfAXFragmentRoot();
397}

◆ GetWindowHandle()

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

◆ IsImplicitView()

bool flutter::FlutterWindowsView::IsImplicitView ( ) const

Definition at line 803 of file flutter_windows_view.cc.

803 {
804 return view_id_ == kImplicitViewId;
805}
constexpr FlutterViewId kImplicitViewId

References flutter::kImplicitViewId.

Referenced by SendInitialBounds().

◆ IsSizedToContent()

bool flutter::FlutterWindowsView::IsSizedToContent ( ) const

Definition at line 937 of file flutter_windows_view.cc.

937 {
938 return is_sized_to_content_;
939}

Referenced by OnFrameGenerated(), and OnWindowSizeChanged().

◆ NotifyWinEventWrapper()

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

Definition at line 886 of file flutter_windows_view.cc.

887 {
888 if (node) {
889 node->NotifyAccessibilityEvent(event);
890 }
891}

Referenced by AnnounceAlert().

◆ OnComposeBegin()

void flutter::FlutterWindowsView::OnComposeBegin ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 354 of file flutter_windows_view.cc.

354 {
355 SendComposeBegin();
356}

◆ OnComposeChange()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 366 of file flutter_windows_view.cc.

367 {
368 SendComposeChange(text, cursor_pos);
369}

References text.

◆ OnComposeCommit()

void flutter::FlutterWindowsView::OnComposeCommit ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 358 of file flutter_windows_view.cc.

358 {
359 SendComposeCommit();
360}

◆ OnComposeEnd()

void flutter::FlutterWindowsView::OnComposeEnd ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 362 of file flutter_windows_view.cc.

362 {
363 SendComposeEnd();
364}

◆ OnCursorRectUpdated()

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

Definition at line 399 of file flutter_windows_view.cc.

399 {
400 binding_handler_->OnCursorRectUpdated(rect);
401}

◆ OnDwmCompositionChanged()

void flutter::FlutterWindowsView::OnDwmCompositionChanged ( )

Definition at line 918 of file flutter_windows_view.cc.

918 {
919 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
920}

◆ 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_width_, resize_target_height_)) {
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 
)
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 349 of file flutter_windows_view.cc.

350 {
351 SendFocus(focus_state, direction);
352}

◆ 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}
virtual void DidUpdateViewSize(int32_t width, int32_t height)=0
int32_t height
int32_t width

References flutter::FlutterWindowsViewSizingDelegate::DidUpdateViewSize(), height, IsSizedToContent(), and width.

◆ OnFramePresented()

void flutter::FlutterWindowsView::OnFramePresented ( )
virtual

Definition at line 747 of file flutter_windows_view.cc.

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

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

◆ OnHighContrastChanged()

void flutter::FlutterWindowsView::OnHighContrastChanged ( )
overridevirtual

◆ OnKey()

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

◆ OnPointerDown()

void flutter::FlutterWindowsView::OnPointerDown ( double  x,
double  y,
FlutterPointerDeviceKind  device_kind,
int32_t  device_id,
uint64_t  buttons,
uint32_t  rotation,
uint32_t  pressure 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 282 of file flutter_windows_view.cc.

288 {
289 if (buttons != 0) {
290 auto state = GetOrCreatePointerState(device_kind, device_id);
291 state->buttons |= buttons;
292 state->rotation = rotation;
293 state->pressure = pressure;
294 SendPointerDown(x, y, state);
295 }
296}
int32_t x
double y

References x, and y.

◆ OnPointerLeave()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 311 of file flutter_windows_view.cc.

314 {
315 SendPointerLeave(x, y, GetOrCreatePointerState(device_kind, device_id));
316}

References x, and y.

◆ OnPointerMove()

void flutter::FlutterWindowsView::OnPointerMove ( double  x,
double  y,
FlutterPointerDeviceKind  device_kind,
int32_t  device_id,
uint64_t  buttons,
uint32_t  rotation,
uint32_t  pressure,
int  modifiers_state 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 266 of file flutter_windows_view.cc.

273 {
274 engine_->keyboard_key_handler()->SyncModifiersIfNeeded(modifiers_state);
275 auto state = GetOrCreatePointerState(device_kind, device_id);
276 state->buttons = buttons;
277 state->rotation = rotation;
278 state->pressure = pressure;
279 SendPointerMove(x, y, state);
280}
KeyboardHandlerBase * keyboard_key_handler()
virtual void SyncModifiersIfNeeded(int modifiers_state)=0

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

◆ OnPointerPanZoomEnd()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 331 of file flutter_windows_view.cc.

331 {
332 SendPointerPanZoomEnd(device_id);
333}

◆ OnPointerPanZoomStart()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 318 of file flutter_windows_view.cc.

318 {
319 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
320 SendPointerPanZoomStart(device_id, point.x, point.y);
321}

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

327 {
328 SendPointerPanZoomUpdate(device_id, pan_x, pan_y, scale, rotation);
329}

◆ OnPointerUp()

void flutter::FlutterWindowsView::OnPointerUp ( double  x,
double  y,
FlutterPointerDeviceKind  device_kind,
int32_t  device_id,
uint64_t  buttons 
)
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 298 of file flutter_windows_view.cc.

302 {
303 auto state = GetOrCreatePointerState(device_kind, device_id);
304 const uint64_t released_buttons = buttons == 0 ? state->buttons : buttons;
305 if (released_buttons != 0) {
306 state->buttons &= ~released_buttons;
307 SendPointerUp(x, y, state);
308 }
309}

References x, and y.

◆ OnResetImeComposing()

void flutter::FlutterWindowsView::OnResetImeComposing ( )
virtual

Definition at line 403 of file flutter_windows_view.cc.

403 {
404 binding_handler_->OnResetImeComposing();
405}

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

377 {
378 SendScroll(x, y, delta_x, delta_y, scroll_offset_multiplier, device_kind,
379 device_id);
380}

References x, and y.

◆ OnScrollInertiaCancel()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 382 of file flutter_windows_view.cc.

382 {
383 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
384 SendScrollInertiaCancel(device_id, point.x, point.y);
385}

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

◆ OnText()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 335 of file flutter_windows_view.cc.

335 {
336 SendText(text);
337}

References text.

◆ OnUpdateSemanticsEnabled()

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

◆ OnWindowRepaint()

void flutter::FlutterWindowsView::OnWindowRepaint ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 262 of file flutter_windows_view.cc.

References ForceRedraw().

◆ OnWindowSizeChanged()

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

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 // Still send metrics so the engine renders at the correct viewport size
212 // (e.g. after the child window is resized to the host's client area).
213 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
214 return true;
215 }
216
217 if (!engine_->egl_manager()) {
218 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
219 return true;
220 }
221
222 if (!surface_ || !surface_->IsValid()) {
223 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
224 return true;
225 }
226
227 // We're using OpenGL rendering. Resizing the surface must happen on the
228 // raster thread.
229 bool surface_will_update =
230 SurfaceWillUpdate(surface_->width(), surface_->height(), width, height);
231 if (!surface_will_update) {
232 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
233 return true;
234 }
235
236 {
237 std::unique_lock<std::mutex> lock(resize_mutex_);
238 resize_status_ = ResizeState::kResizeStarted;
239 resize_target_width_ = width;
240 resize_target_height_ = height;
241 }
242
243 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
244
245 std::chrono::time_point<std::chrono::steady_clock> start_time =
246 std::chrono::steady_clock::now();
247
248 while (true) {
249 if (std::chrono::steady_clock::now() > start_time + kWindowResizeTimeout) {
250 return false;
251 }
252 std::unique_lock<std::mutex> lock(resize_mutex_);
253 if (resize_status_ == ResizeState::kDone) {
254 break;
255 }
256 lock.unlock();
257 engine_->task_runner()->PollOnce(kWindowResizeTimeout);
258 }
259 return true;
260}
void PollOnce(std::chrono::milliseconds timeout)

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

◆ OnWindowStateEvent()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 922 of file flutter_windows_view.cc.

922 {
923 engine_->OnWindowStateEvent(hwnd, event);
924}

References flutter::FlutterWindowsEngine::OnWindowStateEvent().

◆ PresentSoftwareBitmap()

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

Definition at line 786 of file flutter_windows_view.cc.

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

References height.

◆ SendInitialBounds()

void flutter::FlutterWindowsView::SendInitialBounds ( )

Definition at line 458 of file flutter_windows_view.cc.

458 {
459 // Non-implicit views' initial window metrics are sent when the view is added
460 // to the engine.
461 if (!IsImplicitView()) {
462 return;
463 }
464
466}
void SendWindowMetricsEvent(const FlutterWindowMetricsEvent &event)
FlutterWindowMetricsEvent CreateWindowMetricsEvent() const

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

◆ SetFirstFrameCallback()

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

Definition at line 733 of file flutter_windows_view.cc.

733 {
734 std::scoped_lock lock(first_frame_callback_mutex_);
735 first_frame_callback_ = std::move(callback);
736}

References callback.

◆ SetSizedToContent()

void flutter::FlutterWindowsView::SetSizedToContent ( bool  sized_to_content)

Definition at line 941 of file flutter_windows_view.cc.

941 {
942 is_sized_to_content_ = sized_to_content;
944}

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

◆ surface()

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

Definition at line 860 of file flutter_windows_view.cc.

860 {
861 return surface_.get();
862}

◆ UpdateSemanticsEnabled()

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

Definition at line 906 of file flutter_windows_view.cc.

906 {
907 if (semantics_enabled_ != enabled) {
908 semantics_enabled_ = enabled;
909
910 if (!semantics_enabled_ && accessibility_bridge_) {
911 accessibility_bridge_.reset();
912 } else if (semantics_enabled_ && !accessibility_bridge_) {
913 accessibility_bridge_ = CreateAccessibilityBridge();
914 }
915 }
916}
virtual std::shared_ptr< AccessibilityBridgeWindows > CreateAccessibilityBridge()

References CreateAccessibilityBridge().

◆ view_id()

FlutterViewId flutter::FlutterWindowsView::view_id ( ) const

Definition at line 799 of file flutter_windows_view.cc.

799 {
800 return view_id_;
801}

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

Friends And Related Symbol Documentation

◆ ViewModifier

friend class ViewModifier
friend

Definition at line 302 of file flutter_windows_view.h.


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