 |
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"
43 std::unique_ptr<WindowBindingHandler> window_binding,
44 std::shared_ptr<WindowsProcTable> windows_proc_table =
nullptr);
109 FlutterPointerDeviceKind device_kind,
111 int modifiers_state)
override;
116 FlutterPointerDeviceKind device_kind,
118 FlutterPointerMouseButtons button)
override;
123 FlutterPointerDeviceKind device_kind,
125 FlutterPointerMouseButtons button)
override;
130 FlutterPointerDeviceKind device_kind,
131 int32_t device_id = 0)
override;
141 double rotation)
override;
147 void OnText(
const std::u16string&)
override;
175 int scroll_offset_multiplier,
176 FlutterPointerDeviceKind device_kind,
177 int32_t device_id)
override;
199 ui::AXPlatformNodeWin*
AlertNode()
const;
208 return accessibility_bridge_;
216 ax::mojom::Event event);
219 virtual std::shared_ptr<AccessibilityBridgeWindows>
226 struct PointerState {
228 FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
231 int32_t pointer_id = 0;
234 bool flutter_state_is_down =
false;
239 bool flutter_state_is_added =
false;
242 uint64_t buttons = 0;
245 double pan_zoom_start_x = 0;
248 double pan_zoom_start_y = 0;
252 enum class ResizeState {
266 void SendWindowMetrics(
size_t width,
size_t height,
double dpiscale)
const;
269 void SendPointerMove(
double x,
double y, PointerState* state);
272 void SendPointerDown(
double x,
double y, PointerState* state);
275 void SendPointerUp(
double x,
double y, PointerState* state);
282 void SendPointerLeave(
double x,
double y, PointerState* state);
284 void SendPointerPanZoomStart(int32_t device_id,
double x,
double y);
286 void SendPointerPanZoomUpdate(int32_t device_id,
292 void SendPointerPanZoomEnd(int32_t device_id);
295 void SendText(
const std::u16string&);
298 void SendKey(
int key,
310 void SendComposeBegin();
317 void SendComposeCommit();
323 void SendComposeEnd();
329 void SendComposeChange(
const std::u16string&
text,
int cursor_pos);
332 void SendScroll(
double x,
336 int scroll_offset_multiplier,
337 FlutterPointerDeviceKind device_kind,
341 void SendScrollInertiaCancel(int32_t device_id,
double x,
double y);
344 PointerState* GetOrCreatePointerState(FlutterPointerDeviceKind device_kind,
349 void SetEventPhaseFromCursorButtonState(FlutterPointerEvent* event_data,
350 const PointerState* state)
const;
355 void SendPointerEventWithData(
const FlutterPointerEvent& event_data,
356 PointerState* state);
360 bool NeedsVsync()
const;
363 FlutterWindowsEngine* engine_ =
nullptr;
366 std::shared_ptr<WindowsProcTable> windows_proc_table_;
369 std::unordered_map<int32_t, std::unique_ptr<PointerState>> pointer_states_;
372 std::unique_ptr<WindowBindingHandler> binding_handler_;
376 std::mutex resize_mutex_;
377 std::condition_variable resize_cv_;
381 ResizeState resize_status_ = ResizeState::kDone;
385 size_t resize_target_width_ = 0;
389 size_t resize_target_height_ = 0;
392 bool semantics_enabled_ =
false;
395 std::shared_ptr<AccessibilityBridgeWindows> accessibility_bridge_;
402 #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()
void OnWindowSizeChanged(size_t width, size_t height) override
virtual void OnUpdateSemanticsEnabled(bool enabled) override
void OnComposeCommit() override
virtual ~FlutterWindowsView()
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
void DestroyRenderSurface()
virtual void OnPointerPanZoomStart(int32_t device_id) override
void AnnounceAlert(const std::wstring &text)
constexpr uint32_t kWindowFrameBufferID
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
void OnHighContrastChanged() override
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
bool PresentSoftwareBitmap(const void *allocation, size_t row_bytes, size_t height)
virtual void OnCursorRectUpdated(const Rect &rect)
ui::AXPlatformNodeWin * AlertNode() const
void SetEngine(FlutterWindowsEngine *engine)
virtual void OnPointerPanZoomEnd(int32_t device_id) override
void OnDwmCompositionChanged()
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
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
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()
FlutterWindowsEngine * GetEngine()
uint32_t GetFrameBufferId(size_t width, size_t height)
FlutterWindowsView(std::unique_ptr< WindowBindingHandler > window_binding, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
FlutterDesktopBinaryReply callback