5#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_H_
6#define FLUTTER_SHELL_PLATFORM_WINDOWS_FLUTTER_WINDOW_H_
11#include "flutter/fml/macros.h"
12#include "flutter/shell/platform/common/alert_platform_node_delegate.h"
13#include "flutter/shell/platform/common/geometry.h"
14#include "flutter/shell/platform/embedder/embedder.h"
15#include "flutter/shell/platform/windows/direct_manipulation.h"
16#include "flutter/shell/platform/windows/flutter_windows_view.h"
17#include "flutter/shell/platform/windows/keyboard_manager.h"
18#include "flutter/shell/platform/windows/sequential_id_generator.h"
19#include "flutter/shell/platform/windows/text_input_manager.h"
20#include "flutter/shell/platform/windows/window_binding_handler.h"
21#include "flutter/shell/platform/windows/windows_lifecycle_manager.h"
22#include "flutter/shell/platform/windows/windows_proc_table.h"
23#include "flutter/shell/platform/windows/windowsx_shim.h"
24#include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_delegate_win.h"
25#include "flutter/third_party/accessibility/ax/platform/ax_fragment_root_win.h"
26#include "flutter/third_party/accessibility/ax/platform/ax_platform_node_win.h"
27#include "flutter/third_party/accessibility/gfx/native_widget_types.h"
35class FlutterWindow :
public KeyboardManager::WindowDelegate,
36 public WindowBindingHandler {
41 std::shared_ptr<WindowsProcTable> windows_proc_table =
nullptr,
42 std::unique_ptr<TextInputManager> text_input_manager =
nullptr);
57 UINT wRemoveMsg)
override;
111 virtual void OnText(
const std::u16string&
text)
override;
144 virtual void OnScroll(
double delta_x,
188 virtual ui::AXPlatformNodeWin*
GetAlert()
override;
217 LPARAM const lparam)
noexcept;
292 LPARAM const lparam)
noexcept;
296 static const long kWmDpiChangedBeforeParent = 0x02E2;
299 static const int kDirectManipulationTimer = 1;
306 WNDCLASS RegisterWindowClass(std::wstring& title);
312 void TrackMouseLeaveEvent(HWND hwnd);
318 void UpdateScrollOffsetMultiplier();
323 void CreateAxFragmentRoot();
330 HCURSOR current_cursor_;
338 bool restored_ =
false;
339 bool focused_ =
false;
341 int current_dpi_ = 0;
342 int current_width_ = 0;
343 int current_height_ = 0;
346 float scroll_offset_multiplier_;
349 HWND window_handle_ =
nullptr;
352 std::wstring window_class_name_;
355 bool tracking_mouse_leave_ =
false;
359 int keycode_for_char_message_ = 0;
370 std::shared_ptr<WindowsProcTable> windows_proc_table_;
373 std::unique_ptr<TextInputManager> text_input_manager_;
376 std::unique_ptr<KeyboardManager> keyboard_manager_;
379 std::vector<TOUCHINPUT> touch_points_;
382 std::unique_ptr<ui::AXFragmentRootWin> ax_fragment_root_;
virtual void OnCursorRectUpdated(const Rect &rect) override
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual float GetScrollOffsetMultiplier()
virtual ui::AXPlatformNodeWin * GetAlert() override
virtual void OnText(const std::u16string &text) override
virtual UINT Win32DispatchMessage(UINT Msg, WPARAM wParam, LPARAM lParam) override
virtual BOOL Win32PeekMessage(LPMSG lpMsg, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) override
virtual void OnThemeChange()
std::unique_ptr< AlertPlatformNodeDelegate > alert_delegate_
virtual bool OnBitmapSurfaceUpdated(const void *allocation, size_t row_bytes, size_t height) override
virtual void OnImeRequest(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
virtual void OnImeStartComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
std::wstring NarrowToWide(const char *source)
virtual void OnSetCursor()
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()
virtual void OnScroll(double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
void InitializeChild(const char *title, unsigned int width, unsigned int height)
virtual AlertPlatformNodeDelegate * GetAlertDelegate() override
virtual void SetFlutterCursor(HCURSOR cursor) override
std::unique_ptr< DirectManipulationOwner > direct_manipulation_owner_
virtual HWND GetWindowHandle() override
friend class WindowAXFragmentRootDelegate
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
virtual void OnComposeCommit()
virtual void UpdateCursorRect(const Rect &rect)
virtual PhysicalWindowBounds GetPhysicalWindowBounds() override
virtual void OnImeSetContext(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnWindowStateEvent(WindowStateEvent event)
virtual void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_
virtual PointerLocation GetPrimaryPointerLocation() override
virtual void OnComposeEnd()
virtual void SetView(WindowBindingHandlerDelegate *view) override
LRESULT HandleMessage(UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)
virtual void OnResetImeComposing() override
virtual uint32_t Win32MapVkToChar(uint32_t virtual_key) override
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnDpiScale(unsigned int dpi)
virtual void AbortImeComposing()
virtual float GetDpiScale() override
virtual void OnUpdateSemanticsEnabled(bool enabled)
virtual LRESULT OnGetObject(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual gfx::NativeViewAccessible GetNativeViewAccessible()
virtual void OnComposeBegin()
virtual bool OnBitmapSurfaceCleared() override
virtual void OnResize(unsigned int width, unsigned int height)
virtual void UpdateFlutterCursor(const std::string &cursor_name) override
virtual void OnImeEndComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
std::function< void(bool)> KeyEventCallback
FlutterPointerDeviceKind
The device type that created a pointer event.
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
sk_sp< SkBlender > blender SkRect rect
WindowStateEvent
An event representing a change in window state that may update the.
UnimplementedNativeViewAccessible * NativeViewAccessible