 |
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"
49 void SetEngine(std::unique_ptr<FlutterWindowsEngine> engine);
113 FlutterPointerDeviceKind device_kind,
115 int modifiers_state)
override;
120 FlutterPointerDeviceKind device_kind,
122 FlutterPointerMouseButtons button)
override;
127 FlutterPointerDeviceKind device_kind,
129 FlutterPointerMouseButtons button)
override;
134 FlutterPointerDeviceKind device_kind,
135 int32_t device_id = 0)
override;
145 double rotation)
override;
151 void OnText(
const std::u16string&)
override;
179 int scroll_offset_multiplier,
180 FlutterPointerDeviceKind device_kind,
181 int32_t device_id)
override;
202 ui::AXPlatformNodeWin*
AlertNode()
const;
211 return accessibility_bridge_;
219 ax::mojom::Event event);
222 virtual std::shared_ptr<AccessibilityBridgeWindows>
229 struct PointerState {
231 FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
234 int32_t pointer_id = 0;
237 bool flutter_state_is_down =
false;
242 bool flutter_state_is_added =
false;
245 uint64_t buttons = 0;
248 double pan_zoom_start_x = 0;
251 double pan_zoom_start_y = 0;
255 enum class ResizeState {
269 void SendWindowMetrics(
size_t width,
size_t height,
double dpiscale)
const;
272 void SendPointerMove(
double x,
double y, PointerState* state);
275 void SendPointerDown(
double x,
double y, PointerState* state);
278 void SendPointerUp(
double x,
double y, PointerState* state);
285 void SendPointerLeave(
double x,
double y, PointerState* state);
287 void SendPointerPanZoomStart(int32_t device_id,
double x,
double y);
289 void SendPointerPanZoomUpdate(int32_t device_id,
295 void SendPointerPanZoomEnd(int32_t device_id);
298 void SendText(
const std::u16string&);
301 void SendKey(
int key,
313 void SendComposeBegin();
320 void SendComposeCommit();
326 void SendComposeEnd();
332 void SendComposeChange(
const std::u16string&
text,
int cursor_pos);
335 void SendScroll(
double x,
339 int scroll_offset_multiplier,
340 FlutterPointerDeviceKind device_kind,
344 void SendScrollInertiaCancel(int32_t device_id,
double x,
double y);
347 PointerState* GetOrCreatePointerState(FlutterPointerDeviceKind device_kind,
352 void SetEventPhaseFromCursorButtonState(FlutterPointerEvent* event_data,
353 const PointerState* state)
const;
358 void SendPointerEventWithData(
const FlutterPointerEvent& event_data,
359 PointerState* state);
364 std::unique_ptr<WindowsRenderTarget> render_target_;
367 std::unique_ptr<FlutterWindowsEngine> engine_;
370 std::unordered_map<int32_t, std::unique_ptr<PointerState>> pointer_states_;
373 std::unique_ptr<WindowBindingHandler> binding_handler_;
377 std::mutex resize_mutex_;
378 std::condition_variable resize_cv_;
382 ResizeState resize_status_ = ResizeState::kDone;
386 size_t resize_target_width_ = 0;
390 size_t resize_target_height_ = 0;
393 bool semantics_enabled_ =
false;
396 std::shared_ptr<AccessibilityBridgeWindows> accessibility_bridge_;
403 #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
FlutterWindowsView(std::unique_ptr< WindowBindingHandler > window_binding)
void CreateRenderSurface()
void OnWindowSizeChanged(size_t width, size_t height) override
virtual void OnUpdateSemanticsEnabled(bool enabled) override
void OnComposeCommit() override
WindowsRenderTarget * GetRenderTarget() const
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()
std::variant< HWND > WindowsRenderTarget
virtual void OnPointerPanZoomStart(int32_t device_id) override
bool MakeResourceCurrent()
void OnCursorRectUpdated(const Rect &rect) override
void AnnounceAlert(const std::wstring &text)
constexpr uint32_t kWindowFrameBufferID
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 SetEngine(std::unique_ptr< FlutterWindowsEngine > engine)
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)
ui::AXPlatformNodeWin * AlertNode() const
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
void UpdateHighContrastEnabled(bool enabled) 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
void OnResetImeComposing() override
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate() override
virtual PlatformWindow GetPlatformWindow() 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
FlutterWindowsEngine * GetEngine()
uint32_t GetFrameBufferId(size_t width, size_t height)
void SendInitialAccessibilityFeatures()
FlutterDesktopBinaryReply callback