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"
16#include "flutter/shell/platform/common/client_wrapper/include/flutter/plugin_registrar.h"
17#include "flutter/shell/platform/common/geometry.h"
18#include "flutter/shell/platform/embedder/embedder.h"
19#include "flutter/shell/platform/windows/accessibility_bridge_windows.h"
20#include "flutter/shell/platform/windows/flutter_windows_engine.h"
21#include "flutter/shell/platform/windows/public/flutter_windows.h"
22#include "flutter/shell/platform/windows/window_binding_handler.h"
23#include "flutter/shell/platform/windows/window_binding_handler_delegate.h"
24#include "flutter/shell/platform/windows/window_state.h"
25#include "flutter/shell/platform/windows/windows_proc_table.h"
41 std::unique_ptr<WindowBindingHandler> window_binding,
42 std::shared_ptr<WindowsProcTable> windows_proc_table =
nullptr);
146 int modifiers_state)
override;
166 int32_t device_id = 0)
override;
176 double rotation)
override;
182 void OnText(
const std::u16string&)
override;
210 int scroll_offset_multiplier,
212 int32_t device_id)
override;
234 ui::AXPlatformNodeWin*
AlertNode()
const;
243 return accessibility_bridge_;
254 virtual std::shared_ptr<AccessibilityBridgeWindows>
264 struct PointerState {
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,
390 void SendScrollInertiaCancel(int32_t device_id,
double x,
double y);
399 const PointerState*
state)
const;
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_;
virtual void OnFramePresented()
virtual void OnPointerPanZoomStart(int32_t device_id) override
void CreateRenderSurface()
void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button) override
FlutterWindowsView(FlutterViewId view_id, FlutterWindowsEngine *engine, std::unique_ptr< WindowBindingHandler > window_binding, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
virtual void UpdateSemanticsEnabled(bool enabled)
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate() override
void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state) override
bool IsImplicitView() const
void OnScrollInertiaCancel(int32_t device_id) override
virtual std::shared_ptr< AccessibilityBridgeWindows > CreateAccessibilityBridge()
void OnComposeBegin() override
ui::AXPlatformNodeWin * AlertNode() const
virtual void OnResetImeComposing()
virtual void OnUpdateSemanticsEnabled(bool enabled) override
void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id=0) override
virtual void NotifyWinEventWrapper(ui::AXPlatformNodeWin *node, ax::mojom::Event event)
FlutterWindowsEngine * GetEngine() const
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 UpdateFlutterCursor(const std::string &cursor_name)
void OnWindowStateEvent(HWND hwnd, WindowStateEvent event) override
virtual void OnPointerPanZoomEnd(int32_t device_id) override
FlutterWindowMetricsEvent CreateWindowMetricsEvent() const
FlutterViewId view_id() const
void AnnounceAlert(const std::wstring &text)
void SetFlutterCursor(HCURSOR cursor)
std::weak_ptr< AccessibilityBridgeWindows > accessibility_bridge()
virtual bool PresentSoftwareBitmap(const void *allocation, size_t row_bytes, size_t height)
virtual HWND GetWindowHandle() const
egl::WindowSurface * surface() const
bool OnWindowSizeChanged(size_t width, size_t height) override
void OnText(const std::u16string &) override
void OnWindowRepaint() override
virtual void OnPointerPanZoomUpdate(int32_t device_id, double pan_x, double pan_y, double scale, double rotation) override
void OnComposeChange(const std::u16string &text, int cursor_pos) override
void OnDwmCompositionChanged()
void OnComposeCommit() override
virtual bool ClearSoftwareBitmap()
void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button) override
virtual gfx::NativeViewAccessible GetNativeViewAccessible() override
virtual ~FlutterWindowsView()
void OnHighContrastChanged() override
virtual void OnCursorRectUpdated(const Rect &rect)
void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
void OnComposeEnd() override
bool OnEmptyFrameGenerated()
bool OnFrameGenerated(size_t width, size_t height)
std::function< void(bool)> KeyEventCallback
FlutterPointerMouseButtons
FlutterPointerDeviceKind
The device type that created a pointer event.
@ kFlutterPointerDeviceKindMouse
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
sk_sp< SkBlender > blender SkRect rect
WindowStateEvent
An event representing a change in window state that may update the.
UnimplementedNativeViewAccessible * NativeViewAccessible