|
Flutter Windows Embedder
|
|
Go to the documentation of this file.
5 #ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_VIEW_H_
6 #define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_VIEW_H_
11 #include <unordered_map>
15 #include "flutter/fml/macros.h"
18 #include "flutter/shell/platform/embedder/embedder.h"
41 std::unique_ptr<WindowBindingHandler> window_binding,
42 std::shared_ptr<WindowsProcTable> windows_proc_table =
nullptr);
144 FlutterPointerDeviceKind device_kind,
146 int modifiers_state)
override;
151 FlutterPointerDeviceKind device_kind,
153 FlutterPointerMouseButtons button)
override;
158 FlutterPointerDeviceKind device_kind,
160 FlutterPointerMouseButtons button)
override;
165 FlutterPointerDeviceKind device_kind,
166 int32_t device_id = 0)
override;
176 double rotation)
override;
182 void OnText(
const std::u16string&)
override;
210 int scroll_offset_multiplier,
211 FlutterPointerDeviceKind device_kind,
212 int32_t device_id)
override;
234 ui::AXPlatformNodeWin*
AlertNode()
const;
243 return accessibility_bridge_;
251 ax::mojom::Event event);
254 virtual std::shared_ptr<AccessibilityBridgeWindows>
264 struct PointerState {
266 FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
269 int32_t pointer_id = 0;
272 bool flutter_state_is_down =
false;
277 bool flutter_state_is_added =
false;
280 uint64_t buttons = 0;
283 double pan_zoom_start_x = 0;
286 double pan_zoom_start_y = 0;
290 enum class ResizeState {
311 bool ResizeRenderSurface(
size_t width,
size_t height);
315 void SendWindowMetrics(
size_t width,
size_t height,
double pixel_ratio)
const;
318 void SendPointerMove(
double x,
double y, PointerState* state);
321 void SendPointerDown(
double x,
double y, PointerState* state);
324 void SendPointerUp(
double x,
double y, PointerState* state);
331 void SendPointerLeave(
double x,
double y, PointerState* state);
333 void SendPointerPanZoomStart(int32_t device_id,
double x,
double y);
335 void SendPointerPanZoomUpdate(int32_t device_id,
341 void SendPointerPanZoomEnd(int32_t device_id);
344 void SendText(
const std::u16string&);
347 void SendKey(
int key,
359 void SendComposeBegin();
366 void SendComposeCommit();
372 void SendComposeEnd();
378 void SendComposeChange(
const std::u16string&
text,
int cursor_pos);
381 void SendScroll(
double x,
385 int scroll_offset_multiplier,
386 FlutterPointerDeviceKind device_kind,
390 void SendScrollInertiaCancel(int32_t device_id,
double x,
double y);
393 PointerState* GetOrCreatePointerState(FlutterPointerDeviceKind device_kind,
398 void SetEventPhaseFromCursorButtonState(FlutterPointerEvent* event_data,
399 const PointerState* state)
const;
404 void SendPointerEventWithData(
const FlutterPointerEvent& event_data,
405 PointerState* state);
409 bool NeedsVsync()
const;
415 FlutterWindowsEngine* engine_ =
nullptr;
418 std::shared_ptr<WindowsProcTable> windows_proc_table_;
424 std::unique_ptr<egl::WindowSurface> surface_ =
nullptr;
427 std::unordered_map<int32_t, std::unique_ptr<PointerState>> pointer_states_;
430 std::unique_ptr<WindowBindingHandler> binding_handler_;
434 std::mutex resize_mutex_;
435 std::condition_variable resize_cv_;
439 ResizeState resize_status_ = ResizeState::kDone;
443 size_t resize_target_width_ = 0;
447 size_t resize_target_height_ = 0;
450 bool semantics_enabled_ =
false;
453 std::shared_ptr<AccessibilityBridgeWindows> accessibility_bridge_;
460 #endif // FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOWS_VIEW_H_
void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state) override
void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button) override
WindowStateEvent
An event representing a change in window state that may update the.
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event) override
void CreateRenderSurface()
virtual void OnUpdateSemanticsEnabled(bool enabled) override
FlutterWindowsView(FlutterViewId view_id, FlutterWindowsEngine *engine, std::unique_ptr< WindowBindingHandler > window_binding, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
void OnComposeCommit() override
virtual ~FlutterWindowsView()
egl::WindowSurface * surface() const
void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button) override
void OnComposeChange(const std::u16string &text, int cursor_pos) override
std::weak_ptr< AccessibilityBridgeWindows > accessibility_bridge()
void OnScrollInertiaCancel(int32_t device_id) override
virtual void OnPointerPanZoomStart(int32_t device_id) override
bool IsImplicitView() const
void AnnounceAlert(const std::wstring &text)
virtual HWND GetWindowHandle() const
virtual void OnPointerPanZoomUpdate(int32_t device_id, double pan_x, double pan_y, double scale, double rotation) override
void OnWindowRepaint() override
std::function< void(bool)> KeyEventCallback
void OnComposeEnd() override
friend class ViewModifier
FlutterViewId view_id() const
void OnHighContrastChanged() override
bool OnWindowSizeChanged(size_t width, size_t height) override
bool OnFrameGenerated(size_t width, size_t height)
void UpdateFlutterCursor(const std::string &cursor_name)
void SetFlutterCursor(HCURSOR cursor)
void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id=0) override
void OnText(const std::u16string &) override
virtual bool PresentSoftwareBitmap(const void *allocation, size_t row_bytes, size_t height)
virtual void OnCursorRectUpdated(const Rect &rect)
ui::AXPlatformNodeWin * AlertNode() const
FlutterWindowsEngine * GetEngine() const
virtual void OnPointerPanZoomEnd(int32_t device_id) override
void OnDwmCompositionChanged()
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
bool OnEmptyFrameGenerated()
virtual bool ClearSoftwareBitmap()
virtual void UpdateSemanticsEnabled(bool enabled)
void OnComposeBegin() override
virtual std::shared_ptr< AccessibilityBridgeWindows > CreateAccessibilityBridge()
void OnScroll(double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier, FlutterPointerDeviceKind device_kind, int32_t device_id) override
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate() override
FlutterWindowMetricsEvent CreateWindowMetricsEvent() const
void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
virtual gfx::NativeViewAccessible GetNativeViewAccessible() override
virtual void OnResetImeComposing()
virtual void OnFramePresented()
FlutterDesktopBinaryReply callback