 |
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;
194 void OnFocus(FlutterViewFocusState focus_state,
195 FlutterViewFocusDirection direction)
override;
214 int scroll_offset_multiplier,
215 FlutterPointerDeviceKind device_kind,
216 int32_t device_id)
override;
238 ui::AXPlatformNodeWin*
AlertNode()
const;
247 return accessibility_bridge_;
255 virtual bool Focus();
259 ax::mojom::Event event);
262 virtual std::shared_ptr<AccessibilityBridgeWindows>
272 struct PointerState {
274 FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
277 int32_t pointer_id = 0;
280 bool flutter_state_is_down =
false;
285 bool flutter_state_is_added =
false;
288 uint64_t buttons = 0;
291 double pan_zoom_start_x = 0;
294 double pan_zoom_start_y = 0;
298 enum class ResizeState {
319 bool ResizeRenderSurface(
size_t width,
size_t height);
323 void SendWindowMetrics(
size_t width,
size_t height,
double pixel_ratio)
const;
326 void SendPointerMove(
double x,
double y, PointerState* state);
329 void SendPointerDown(
double x,
double y, PointerState* state);
332 void SendPointerUp(
double x,
double y, PointerState* state);
339 void SendPointerLeave(
double x,
double y, PointerState* state);
341 void SendPointerPanZoomStart(int32_t device_id,
double x,
double y);
343 void SendPointerPanZoomUpdate(int32_t device_id,
349 void SendPointerPanZoomEnd(int32_t device_id);
352 void SendText(
const std::u16string&);
355 void SendKey(
int key,
364 void SendFocus(FlutterViewFocusState focus_state,
365 FlutterViewFocusDirection direction);
371 void SendComposeBegin();
378 void SendComposeCommit();
384 void SendComposeEnd();
390 void SendComposeChange(
const std::u16string&
text,
int cursor_pos);
393 void SendScroll(
double x,
397 int scroll_offset_multiplier,
398 FlutterPointerDeviceKind device_kind,
402 void SendScrollInertiaCancel(int32_t device_id,
double x,
double y);
405 PointerState* GetOrCreatePointerState(FlutterPointerDeviceKind device_kind,
410 void SetEventPhaseFromCursorButtonState(FlutterPointerEvent* event_data,
411 const PointerState* state)
const;
416 void SendPointerEventWithData(
const FlutterPointerEvent& event_data,
417 PointerState* state);
421 bool NeedsVsync()
const;
427 FlutterWindowsEngine* engine_ =
nullptr;
430 std::shared_ptr<WindowsProcTable> windows_proc_table_;
436 std::unique_ptr<egl::WindowSurface> surface_ =
nullptr;
439 std::unordered_map<int32_t, std::unique_ptr<PointerState>> pointer_states_;
442 std::unique_ptr<WindowBindingHandler> binding_handler_;
445 std::mutex resize_mutex_;
449 ResizeState resize_status_ = ResizeState::kDone;
453 size_t resize_target_width_ = 0;
457 size_t resize_target_height_ = 0;
460 bool semantics_enabled_ =
false;
463 std::shared_ptr<AccessibilityBridgeWindows> accessibility_bridge_;
470 #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 OnFocus(FlutterViewFocusState focus_state, FlutterViewFocusDirection direction) 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
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