Flutter Engine
The Flutter Engine
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:
flutter::WindowBindingHandlerDelegate 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, 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 ()
 
void AnnounceAlert (const std::wstring &text)
 
void OnHighContrastChanged () override
 
bool OnEmptyFrameGenerated ()
 
bool OnFrameGenerated (size_t width, size_t height)
 
virtual void OnFramePresented ()
 
void UpdateFlutterCursor (const std::string &cursor_name)
 
void SetFlutterCursor (HCURSOR cursor)
 
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 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 OnWindowSizeChanged (size_t width, size_t height)=0
 
virtual void OnWindowRepaint ()=0
 
virtual void OnPointerMove (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)=0
 
virtual void OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0
 
virtual void OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0
 
virtual void OnPointerLeave (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
 
virtual void OnPointerPanZoomStart (int32_t device_id)=0
 
virtual void OnPointerPanZoomUpdate (int32_t device_id, double pan_x, double pan_y, double scale, double rotation)=0
 
virtual void OnPointerPanZoomEnd (int32_t device_id)=0
 
virtual void OnText (const std::u16string &)=0
 
virtual void OnKey (int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
 
virtual void OnComposeBegin ()=0
 
virtual void OnComposeCommit ()=0
 
virtual void OnComposeEnd ()=0
 
virtual void OnComposeChange (const std::u16string &text, int cursor_pos)=0
 
virtual void OnScroll (double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier, FlutterPointerDeviceKind device_kind, int32_t device_id)=0
 
virtual void OnScrollInertiaCancel (int32_t device_id)=0
 
virtual void OnUpdateSemanticsEnabled (bool enabled)=0
 
virtual gfx::NativeViewAccessible GetNativeViewAccessible ()=0
 
virtual void OnHighContrastChanged ()=0
 
virtual ui::AXFragmentRootDelegateWinGetAxFragmentRootDelegate ()=0
 
virtual void OnWindowStateEvent (HWND hwnd, WindowStateEvent event)=0
 

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 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}
FlutterEngine engine
Definition: main.cc:68

◆ ~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.
125
126 if (surface_) {
127 DestroyWindowSurface(*engine_, std::move(surface_));
128 }
129}
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)
virtual HWND GetWindowHandle() const

Member Function Documentation

◆ accessibility_bridge()

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

Definition at line 242 of file flutter_windows_view.h.

242 {
243 return accessibility_bridge_;
244 }

◆ AlertNode()

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

Definition at line 787 of file flutter_windows_view.cc.

787 {
788 return binding_handler_->GetAlert();
789}

◆ AnnounceAlert()

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

Definition at line 766 of file flutter_windows_view.cc.

766 {
767 auto alert_delegate = binding_handler_->GetAlertDelegate();
768 if (!alert_delegate) {
769 return;
770 }
771 alert_delegate->SetText(fml::WideStringToUtf16(text));
772 ui::AXPlatformNodeWin* alert_node = binding_handler_->GetAlert();
774}
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
std::u16string text
std::u16string WideStringToUtf16(const std::wstring_view str)

◆ ClearSoftwareBitmap()

bool flutter::FlutterWindowsView::ClearSoftwareBitmap ( )
virtual

Definition at line 678 of file flutter_windows_view.cc.

678 {
679 return binding_handler_->OnBitmapSurfaceCleared();
680}

◆ CreateAccessibilityBridge()

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

Definition at line 792 of file flutter_windows_view.cc.

792 {
793 return std::make_shared<AccessibilityBridgeWindows>(this);
794}

◆ CreateRenderSurface()

void flutter::FlutterWindowsView::CreateRenderSurface ( )

Definition at line 697 of file flutter_windows_view.cc.

697 {
698 FML_DCHECK(surface_ == nullptr);
699
700 if (engine_->egl_manager()) {
701 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
702 surface_ = engine_->egl_manager()->CreateWindowSurface(
703 GetWindowHandle(), bounds.width, bounds.height);
704
705 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
706
707 resize_target_width_ = bounds.width;
708 resize_target_height_ = bounds.height;
709 }
710}
virtual std::unique_ptr< WindowSurface > CreateWindowSurface(HWND hwnd, size_t width, size_t height)
Definition: manager.cc:266
#define FML_DCHECK(condition)
Definition: logging.h:103
Optional< SkRect > bounds
Definition: SkRecords.h:189

◆ CreateWindowMetricsEvent()

FlutterWindowMetricsEvent flutter::FlutterWindowsView::CreateWindowMetricsEvent ( ) const

Definition at line 375 of file flutter_windows_view.cc.

375 {
376 PhysicalWindowBounds bounds = binding_handler_->GetPhysicalWindowBounds();
377 double pixel_ratio = binding_handler_->GetDpiScale();
378
379 FlutterWindowMetricsEvent event = {};
380 event.struct_size = sizeof(event);
381 event.width = bounds.width;
382 event.height = bounds.height;
383 event.pixel_ratio = pixel_ratio;
384 event.view_id = view_id_;
385
386 return event;
387}
FlKeyEvent * event
size_t struct_size
The size of this struct. Must be sizeof(FlutterWindowMetricsEvent).
Definition: embedder.h:843

◆ ForceRedraw()

void flutter::FlutterWindowsView::ForceRedraw ( )

Definition at line 187 of file flutter_windows_view.cc.

187 {
188 if (resize_status_ == ResizeState::kDone) {
189 // Request new frame.
190 engine_->ScheduleFrame();
191 }
192}

◆ GetAxFragmentRootDelegate()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 783 of file flutter_windows_view.cc.

783 {
784 return accessibility_bridge_.get();
785}

◆ GetEngine()

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

Definition at line 762 of file flutter_windows_view.cc.

762 {
763 return engine_;
764}

◆ GetNativeViewAccessible()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 346 of file flutter_windows_view.cc.

346 {
347 if (!accessibility_bridge_) {
348 return nullptr;
349 }
350
351 return accessibility_bridge_->GetChildOfAXFragmentRoot();
352}

◆ GetWindowHandle()

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

Definition at line 758 of file flutter_windows_view.cc.

758 {
759 return binding_handler_->GetWindowHandle();
760}

◆ IsImplicitView()

bool flutter::FlutterWindowsView::IsImplicitView ( ) const

Definition at line 693 of file flutter_windows_view.cc.

693 {
694 return view_id_ == kImplicitViewId;
695}
constexpr FlutterViewId kImplicitViewId

◆ NotifyWinEventWrapper()

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

Definition at line 776 of file flutter_windows_view.cc.

777 {
778 if (node) {
779 node->NotifyAccessibilityEvent(event);
780 }
781}

◆ OnComposeBegin()

void flutter::FlutterWindowsView::OnComposeBegin ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 309 of file flutter_windows_view.cc.

309 {
310 SendComposeBegin();
311}

◆ OnComposeChange()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 321 of file flutter_windows_view.cc.

322 {
323 SendComposeChange(text, cursor_pos);
324}

◆ OnComposeCommit()

void flutter::FlutterWindowsView::OnComposeCommit ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 313 of file flutter_windows_view.cc.

313 {
314 SendComposeCommit();
315}

◆ OnComposeEnd()

void flutter::FlutterWindowsView::OnComposeEnd ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 317 of file flutter_windows_view.cc.

317 {
318 SendComposeEnd();
319}

◆ OnCursorRectUpdated()

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

Definition at line 354 of file flutter_windows_view.cc.

354 {
355 binding_handler_->OnCursorRectUpdated(rect);
356}
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ OnDwmCompositionChanged()

void flutter::FlutterWindowsView::OnDwmCompositionChanged ( )

Definition at line 808 of file flutter_windows_view.cc.

808 {
809 UpdateVsync(*engine_, surface_.get(), NeedsVsync());
810}

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

◆ 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}
int32_t height
int32_t width

◆ OnFramePresented()

void flutter::FlutterWindowsView::OnFramePresented ( )
virtual

Definition at line 646 of file flutter_windows_view.cc.

646 {
647 // Called on the engine's raster thread.
648 std::unique_lock<std::mutex> lock(resize_mutex_);
649
650 switch (resize_status_) {
651 case ResizeState::kResizeStarted:
652 // The caller must first call |OnFrameGenerated| or
653 // |OnEmptyFrameGenerated| before calling this method. This
654 // indicates one of the following:
655 //
656 // 1. The caller did not call these methods.
657 // 2. The caller ignored these methods' result.
658 // 3. The platform thread started a resize after the caller called these
659 // methods. We might have presented a frame of the wrong size to the
660 // view.
661 return;
662 case ResizeState::kFrameGenerated: {
663 // A frame was generated for a pending resize.
664 // Unblock the platform thread.
665 resize_status_ = ResizeState::kDone;
666 lock.unlock();
667 resize_cv_.notify_all();
668
669 // Blocking the raster thread until DWM flushes alleviates glitches where
670 // previous size surface is stretched over current size view.
671 windows_proc_table_->DwmFlush();
672 }
673 case ResizeState::kDone:
674 return;
675 }
676}

◆ OnHighContrastChanged()

void flutter::FlutterWindowsView::OnHighContrastChanged ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 754 of file flutter_windows_view.cc.

754 {
755 engine_->UpdateHighContrastMode();
756}

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

305 {
307}
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback

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

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

◆ OnPointerLeave()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 271 of file flutter_windows_view.cc.

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

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

240 {
241 engine_->keyboard_key_handler()->SyncModifiersIfNeeded(modifiers_state);
242 SendPointerMove(x, y, GetOrCreatePointerState(device_kind, device_id));
243}
KeyboardHandlerBase * keyboard_key_handler()
virtual void SyncModifiersIfNeeded(int modifiers_state)=0

◆ OnPointerPanZoomEnd()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 291 of file flutter_windows_view.cc.

291 {
292 SendPointerPanZoomEnd(device_id);
293}

◆ OnPointerPanZoomStart()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 278 of file flutter_windows_view.cc.

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

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

287 {
288 SendPointerPanZoomUpdate(device_id, pan_x, pan_y, scale, rotation);
289}
const Scalar scale

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

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

◆ OnResetImeComposing()

void flutter::FlutterWindowsView::OnResetImeComposing ( )
virtual

Definition at line 358 of file flutter_windows_view.cc.

358 {
359 binding_handler_->OnResetImeComposing();
360}

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

332 {
333 SendScroll(x, y, delta_x, delta_y, scroll_offset_multiplier, device_kind,
334 device_id);
335}

◆ OnScrollInertiaCancel()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 337 of file flutter_windows_view.cc.

337 {
338 PointerLocation point = binding_handler_->GetPrimaryPointerLocation();
339 SendScrollInertiaCancel(device_id, point.x, point.y);
340}

◆ OnText()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 295 of file flutter_windows_view.cc.

295 {
296 SendText(text);
297}

◆ OnUpdateSemanticsEnabled()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 342 of file flutter_windows_view.cc.

342 {
343 engine_->UpdateSemanticsEnabled(enabled);
344}

◆ OnWindowRepaint()

void flutter::FlutterWindowsView::OnWindowRepaint ( )
overridevirtual

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 232 of file flutter_windows_view.cc.

◆ OnWindowSizeChanged()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 194 of file flutter_windows_view.cc.

194 {
195 // Called on the platform thread.
196 std::unique_lock<std::mutex> lock(resize_mutex_);
197
198 if (!engine_->egl_manager()) {
199 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
200 return true;
201 }
202
203 if (!surface_ || !surface_->IsValid()) {
204 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
205 return true;
206 }
207
208 // We're using OpenGL rendering. Resizing the surface must happen on the
209 // raster thread.
210 bool surface_will_update =
211 SurfaceWillUpdate(surface_->width(), surface_->height(), width, height);
212 if (!surface_will_update) {
213 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
214 return true;
215 }
216
217 resize_status_ = ResizeState::kResizeStarted;
218 resize_target_width_ = width;
219 resize_target_height_ = height;
220
221 SendWindowMetrics(width, height, binding_handler_->GetDpiScale());
222
223 // Block the platform thread until a frame is presented with the target
224 // size. See |OnFrameGenerated|, |OnEmptyFrameGenerated|, and
225 // |OnFramePresented|.
226 return resize_cv_.wait_for(lock, kWindowResizeTimeout,
227 [&resize_status = resize_status_] {
228 return resize_status == ResizeState::kDone;
229 });
230}

◆ OnWindowStateEvent()

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

Implements flutter::WindowBindingHandlerDelegate.

Definition at line 812 of file flutter_windows_view.cc.

812 {
813 engine_->OnWindowStateEvent(hwnd, event);
814}

◆ PresentSoftwareBitmap()

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

Definition at line 682 of file flutter_windows_view.cc.

684 {
685 return binding_handler_->OnBitmapSurfaceUpdated(allocation, row_bytes,
686 height);
687}

◆ SendInitialBounds()

void flutter::FlutterWindowsView::SendInitialBounds ( )

Definition at line 389 of file flutter_windows_view.cc.

389 {
390 // Non-implicit views' initial window metrics are sent when the view is added
391 // to the engine.
392 if (!IsImplicitView()) {
393 return;
394 }
395
397}
void SendWindowMetricsEvent(const FlutterWindowMetricsEvent &event)
FlutterWindowMetricsEvent CreateWindowMetricsEvent() const

◆ SetFlutterCursor()

void flutter::FlutterWindowsView::SetFlutterCursor ( HCURSOR  cursor)

Definition at line 183 of file flutter_windows_view.cc.

183 {
184 binding_handler_->SetFlutterCursor(cursor);
185}

◆ surface()

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

Definition at line 750 of file flutter_windows_view.cc.

750 {
751 return surface_.get();
752}

◆ UpdateFlutterCursor()

void flutter::FlutterWindowsView::UpdateFlutterCursor ( const std::string &  cursor_name)

Definition at line 179 of file flutter_windows_view.cc.

179 {
180 binding_handler_->UpdateFlutterCursor(cursor_name);
181}

◆ UpdateSemanticsEnabled()

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

Definition at line 796 of file flutter_windows_view.cc.

796 {
797 if (semantics_enabled_ != enabled) {
798 semantics_enabled_ = enabled;
799
800 if (!semantics_enabled_ && accessibility_bridge_) {
801 accessibility_bridge_.reset();
802 } else if (semantics_enabled_ && !accessibility_bridge_) {
803 accessibility_bridge_ = CreateAccessibilityBridge();
804 }
805 }
806}
virtual std::shared_ptr< AccessibilityBridgeWindows > CreateAccessibilityBridge()

◆ view_id()

FlutterViewId flutter::FlutterWindowsView::view_id ( ) const

Definition at line 689 of file flutter_windows_view.cc.

689 {
690 return view_id_;
691}

Friends And Related Function Documentation

◆ ViewModifier

friend class ViewModifier
friend

Definition at line 259 of file flutter_windows_view.h.


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