| Flutter Windows Embedder |

Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
flutter::FlutterWindow Class Reference

`#include <flutter_window.h>`

Inheritance diagram for flutter::FlutterWindow:

## Public Member Functions
| FlutterWindow (int width, int height, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr, std::unique_ptr< TextInputManager > text_input_manager=nullptr)
virtual | ~FlutterWindow ()
void | InitializeChild (const char *title, unsigned int width, unsigned int height)
virtual BOOL | Win32PeekMessage (LPMSG lpMsg, UINT wMsgFilterMin, UINT wMsgFilterMax, UINT wRemoveMsg) override
virtual uint32_t | Win32MapVkToChar (uint32_t virtual_key) override
virtual UINT | Win32DispatchMessage (UINT Msg, WPARAM wParam, LPARAM lParam) override
virtual void | OnDpiScale (unsigned int dpi)
virtual void | OnResize (unsigned int width, unsigned int height)
virtual void | OnPaint ()
virtual void | OnPointerMove (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)
virtual void | OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
virtual void | OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
virtual void | OnPointerLeave (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual void | OnSetCursor ()
virtual void | OnText (const std::u16string &text) override
virtual void | OnKey (int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback) override
virtual void | OnComposeBegin ()
virtual void | OnComposeCommit ()
virtual void | OnComposeEnd ()
virtual void | OnComposeChange (const std::u16string &text, int cursor_pos)
virtual void | OnCursorRectUpdated (const Rect &rect) override
virtual void | OnResetImeComposing () override
virtual void | OnUpdateSemanticsEnabled (bool enabled)
virtual void | OnScroll (double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual gfx::NativeViewAccessible | GetNativeViewAccessible ()
virtual void | SetView (WindowBindingHandlerDelegate *view) override
virtual HWND | GetWindowHandle () override
virtual float | GetDpiScale () override
virtual PhysicalWindowBounds | GetPhysicalWindowBounds () override
virtual void | UpdateFlutterCursor (const std::string &cursor_name) override
virtual void | SetFlutterCursor (HCURSOR cursor) override
virtual bool | OnBitmapSurfaceCleared () override
virtual bool | OnBitmapSurfaceUpdated (const void *allocation, size_t row_bytes, size_t height) override
virtual PointerLocation | GetPrimaryPointerLocation () override
virtual void | OnThemeChange ()
virtual AlertPlatformNodeDelegate * | GetAlertDelegate () override
virtual ui::AXPlatformNodeWin * | GetAlert () override
virtual ui::AXFragmentRootDelegateWin * | GetAxFragmentRootDelegate ()
virtual void | OnWindowStateEvent (WindowStateEvent event)
Public Member Functions inherited from flutter::KeyboardManager::WindowDelegate
virtual | ~WindowDelegate ()=default
Public Member Functions inherited from flutter::WindowBindingHandler
virtual | ~WindowBindingHandler ()=default

## Protected Member Functions
| FlutterWindow ()
virtual LRESULT | Win32DefWindowProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
std::wstring | NarrowToWide (const char *source)
LRESULT | HandleMessage (UINT const message, WPARAM const wparam, LPARAM const lparam) noexcept
virtual LRESULT | OnGetObject (UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void | OnImeSetContext (UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void | OnImeStartComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void | OnImeComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void | OnImeEndComposition (UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void | OnImeRequest (UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void | AbortImeComposing ()
virtual void | UpdateCursorRect (const Rect &rect)
UINT | GetCurrentDPI ()
UINT | GetCurrentWidth ()
UINT | GetCurrentHeight ()
virtual float | GetScrollOffsetMultiplier ()

## Protected Attributes
std::unique_ptr< AlertPlatformNodeDelegate > | alert_delegate_
std::unique_ptr< ui::AXPlatformNodeWin > | alert_node_
std::unique_ptr< DirectManipulationOwner > | direct_manipulation_owner_

## Friends
class | WindowAXFragmentRootDelegate

## Additional Inherited Members
Public Types inherited from flutter::KeyboardManager::WindowDelegate
using | KeyEventCallback = std::function< void(bool)>

## Detailed Description

Definition at line 35 of file flutter_window.h.

## Constructor & Destructor Documentation

## ◆ FlutterWindow() [1/2]

flutter::FlutterWindow::FlutterWindow | ( | int | width,
|  | int | height,
|  | std::shared_ptr< WindowsProcTable > | windows_proc_table = `nullptr`,
|  | std::unique_ptr< TextInputManager > | text_input_manager = `nullptr`
| ) |  |

Definition at line 119 of file flutter_window.cc.

124 : touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId),
125 windows_proc_table_(std::move(windows_proc_table)),
126 text_input_manager_(std::move(text_input_manager)),
127 ax_fragment_root_(nullptr) {
128 // Get the DPI of the primary monitor as the initial DPI. If Per-Monitor V2 is
129 // supported, |current_dpi_| should be updated in the
130 // kWmDpiChangedBeforeParent message.
131 current_dpi_ = GetDpiForHWND(nullptr);
132
133 // Get initial value for wheel scroll lines
134 // TODO: Listen to changes for this value
135 // https://github.com/flutter/flutter/issues/107248
136 UpdateScrollOffsetMultiplier();
137
138 if (windows_proc_table_ == nullptr) {
139 windows_proc_table_ = std::make_unique<WindowsProcTable>();
140 }
141 if (text_input_manager_ == nullptr) {
142 text_input_manager_ = std::make_unique<TextInputManager>();
143 }
144 keyboard_manager_ = std::make_unique<KeyboardManager>(this);
145
146 InitializeChild("FLUTTERVIEW", width, height);
147 current_cursor_ = ::LoadCursor(nullptr, IDC_ARROW);
148 }
flutter::FlutterWindow::InitializeChild
void InitializeChild(const char *title, unsigned int width, unsigned int height)
Definition: flutter_window.cc:428
flutter::GetDpiForHWND
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:130

References flutter::GetDpiForHWND(), and InitializeChild().

## ◆ ~FlutterWindow()

flutter::FlutterWindow::~FlutterWindow | ( |  | ) |
| virtual

Definition at line 154 of file flutter_window.cc.

154 {
155 Destroy();
156 }

## ◆ FlutterWindow() [2/2]

flutter::FlutterWindow::FlutterWindow | ( |  | ) |
| protected

Definition at line 151 of file flutter_window.cc.

152 : touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId) {}

## Member Function Documentation

## ◆ AbortImeComposing()

void flutter::FlutterWindow::AbortImeComposing | ( |  | ) |
| protected virtual

Definition at line 905 of file flutter_window.cc.

905 {
906 text_input_manager_->AbortComposing();
907 }

Referenced by OnResetImeComposing().

## ◆ GetAlert()

ui::AXPlatformNodeWin * flutter::FlutterWindow::GetAlert | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 364 of file flutter_window.cc.

364 {
365 CreateAxFragmentRoot();
366 return alert_node_.get();
367 }
flutter::FlutterWindow::alert_node_
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_
Definition: flutter_window.h:277

References alert_node_.

## ◆ GetAlertDelegate()

AlertPlatformNodeDelegate * flutter::FlutterWindow::GetAlertDelegate | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 359 of file flutter_window.cc.

359 {
360 CreateAxFragmentRoot();
361 return alert_delegate_.get();
362 }
flutter::FlutterWindow::alert_delegate_
std::unique_ptr< AlertPlatformNodeDelegate > alert_delegate_
Definition: flutter_window.h:274

References alert_delegate_.

## ◆ GetAxFragmentRootDelegate()

ui::AXFragmentRootDelegateWin * flutter::FlutterWindow::GetAxFragmentRootDelegate | ( |  | ) |
| virtual

Definition at line 355 of file flutter_window.cc.

355 {
356 return binding_handler_delegate_->GetAxFragmentRootDelegate();
357 }
flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()=0

References flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate().

## ◆ GetCurrentDPI()

UINT flutter::FlutterWindow::GetCurrentDPI | ( |  | ) |
| protected

Definition at line 913 of file flutter_window.cc.

913 {
914 return current_dpi_;
915 }

Referenced by GetDpiScale().

## ◆ GetCurrentHeight()

UINT flutter::FlutterWindow::GetCurrentHeight | ( |  | ) |
| protected

Definition at line 921 of file flutter_window.cc.

921 {
922 return current_height_;
923 }

Referenced by GetPhysicalWindowBounds().

## ◆ GetCurrentWidth()

UINT flutter::FlutterWindow::GetCurrentWidth | ( |  | ) |
| protected

Definition at line 917 of file flutter_window.cc.

917 {
918 return current_width_;
919 }

Referenced by GetPhysicalWindowBounds().

## ◆ GetDpiScale()

float flutter::FlutterWindow::GetDpiScale | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 171 of file flutter_window.cc.

171 {
172 return static_cast<float>(GetCurrentDPI()) / static_cast<float>(base_dpi);
173 }
flutter::FlutterWindow::GetCurrentDPI
UINT GetCurrentDPI()
Definition: flutter_window.cc:913

References GetCurrentDPI().

Referenced by OnCursorRectUpdated().

## ◆ GetNativeViewAccessible()

gfx::NativeViewAccessible flutter::FlutterWindow::GetNativeViewAccessible | ( |  | ) |
| virtual

Definition at line 336 of file flutter_window.cc.

336 {
337 if (binding_handler_delegate_ == nullptr) {
338 return nullptr;
339 }
340
341 return binding_handler_delegate_->GetNativeViewAccessible();
342 }
flutter::WindowBindingHandlerDelegate::GetNativeViewAccessible
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0

References flutter::WindowBindingHandlerDelegate::GetNativeViewAccessible().

Referenced by OnGetObject().

## ◆ GetPhysicalWindowBounds()

PhysicalWindowBounds flutter::FlutterWindow::GetPhysicalWindowBounds | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 175 of file flutter_window.cc.

175 {
176 return {GetCurrentWidth(), GetCurrentHeight()};
177 }
flutter::FlutterWindow::GetCurrentWidth
UINT GetCurrentWidth()
Definition: flutter_window.cc:917
flutter::FlutterWindow::GetCurrentHeight
UINT GetCurrentHeight()
Definition: flutter_window.cc:921

References GetCurrentHeight(), and GetCurrentWidth().

## ◆ GetPrimaryPointerLocation()

PointerLocation flutter::FlutterWindow::GetPrimaryPointerLocation | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 344 of file flutter_window.cc.

344 {
345 POINT point;
346 GetCursorPos(&point);
347 ScreenToClient(GetWindowHandle(), &point);
348 return {(size_t)point.x, (size_t)point.y};
349 }
flutter::FlutterWindow::GetWindowHandle
virtual HWND GetWindowHandle() override
Definition: flutter_window.cc:463

References GetWindowHandle().

## ◆ GetScrollOffsetMultiplier()

float flutter::FlutterWindow::GetScrollOffsetMultiplier | ( |  | ) |
| protected virtual

Definition at line 925 of file flutter_window.cc.

925 {
926 return scroll_offset_multiplier_;
927 }

Referenced by OnScroll().

## ◆ GetWindowHandle()

HWND flutter::FlutterWindow::GetWindowHandle | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 463 of file flutter_window.cc.

463 {
464 return window_handle_;
465 }

Referenced by flutter::DirectManipulationOwner::Destroy(), GetPrimaryPointerLocation(), flutter::DirectManipulationOwner::Init(), OnBitmapSurfaceCleared(), OnBitmapSurfaceUpdated(), OnScroll(), and OnWindowStateEvent().

## ◆ HandleMessage()

LRESULT flutter::FlutterWindow::HandleMessage | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected noexcept

Definition at line 532 of file flutter_window.cc.

534 {
535 LPARAM result_lparam = lparam;
536 int xPos = 0, yPos = 0;
537 UINT width = 0, height = 0;
538 UINT button_pressed = 0;
539 FlutterPointerDeviceKind device_kind;
540
541 switch (message) {
542 case kWmDpiChangedBeforeParent:
543 current_dpi_ = GetDpiForHWND(window_handle_);
544 OnDpiScale(current_dpi_);
545 return 0;
546 case WM_SIZE:
547 width = LOWORD(lparam);
548 height = HIWORD(lparam);
549
550 current_width_ = width;
551 current_height_ = height;
552 HandleResize(width, height);
553
554 OnWindowStateEvent(width == 0 && height == 0 ? WindowStateEvent::kHide
555 : WindowStateEvent::kShow);
556 break;
557 case WM_PAINT:
558 OnPaint();
559 break;
560 case WM_TOUCH: {
561 UINT num_points = LOWORD(wparam);
562 touch_points_.resize(num_points);
563 auto touch_input_handle = reinterpret_cast<HTOUCHINPUT>(lparam);
564 if (GetTouchInputInfo(touch_input_handle, num_points,
565 touch_points_.data(), sizeof(TOUCHINPUT))) {
566 for (const auto& touch : touch_points_) {
567 // Generate a mapped ID for the Windows-provided touch ID
568 auto touch_id = touch_id_generator_.GetGeneratedId(touch.dwID);
569
570 POINT pt = {TOUCH_COORD_TO_PIXEL(touch.x),
571 TOUCH_COORD_TO_PIXEL(touch.y)};
572 ScreenToClient(window_handle_, &pt);
573 auto x = static_cast<double>(pt.x);
574 auto y = static_cast<double>(pt.y);
575
576 if (touch.dwFlags & TOUCHEVENTF_DOWN) {
577 OnPointerDown(x, y, kFlutterPointerDeviceKindTouch, touch_id,
578 WM_LBUTTONDOWN);
579 } else if (touch.dwFlags & TOUCHEVENTF_MOVE) {
580 OnPointerMove(x, y, kFlutterPointerDeviceKindTouch, touch_id, 0);
581 } else if (touch.dwFlags & TOUCHEVENTF_UP) {
582 OnPointerUp(x, y, kFlutterPointerDeviceKindTouch, touch_id,
583 WM_LBUTTONDOWN);
584 OnPointerLeave(x, y, kFlutterPointerDeviceKindTouch, touch_id);
585 touch_id_generator_.ReleaseNumber(touch.dwID);
586 }
587 }
588 CloseTouchInputHandle(touch_input_handle);
589 }
590 return 0;
591 }
592 case WM_MOUSEMOVE:
593 device_kind = GetFlutterPointerDeviceKind();
594 if (device_kind == kFlutterPointerDeviceKindMouse) {
595 TrackMouseLeaveEvent(window_handle_);
596
597 xPos = GET_X_LPARAM(lparam);
598 yPos = GET_Y_LPARAM(lparam);
599 mouse_x_ = static_cast<double>(xPos);
600 mouse_y_ = static_cast<double>(yPos);
601
602 int mods = 0;
603 if (wparam & MK_CONTROL) {
604 mods |= kControl;
605 }
606 if (wparam & MK_SHIFT) {
607 mods |= kShift;
608 }
609 OnPointerMove(mouse_x_, mouse_y_, device_kind, kDefaultPointerDeviceId,
610 mods);
611 }
612 break;
613 case WM_MOUSELEAVE:
614 device_kind = GetFlutterPointerDeviceKind();
615 if (device_kind == kFlutterPointerDeviceKindMouse) {
616 OnPointerLeave(mouse_x_, mouse_y_, device_kind,
617 kDefaultPointerDeviceId);
618 }
619
620 // Once the tracked event is received, the TrackMouseEvent function
621 // resets. Set to false to make sure it's called once mouse movement is
622 // detected again.
623 tracking_mouse_leave_ = false;
624 break;
625 case WM_SETCURSOR: {
626 UINT hit_test_result = LOWORD(lparam);
627 if (hit_test_result == HTCLIENT) {
628 OnSetCursor();
629 return TRUE;
630 }
631 break;
632 }
633 case WM_SETFOCUS:
634 OnWindowStateEvent(WindowStateEvent::kFocus);
635 ::CreateCaret(window_handle_, nullptr, 1, 1);
636 break;
637 case WM_KILLFOCUS:
638 OnWindowStateEvent(WindowStateEvent::kUnfocus);
639 ::DestroyCaret();
640 break;
641 case WM_LBUTTONDOWN:
642 case WM_RBUTTONDOWN:
643 case WM_MBUTTONDOWN:
644 case WM_XBUTTONDOWN:
645 device_kind = GetFlutterPointerDeviceKind();
646 if (device_kind != kFlutterPointerDeviceKindMouse) {
647 break;
648 }
649
650 if (message == WM_LBUTTONDOWN) {
651 // Capture the pointer in case the user drags outside the client area.
652 // In this case, the "mouse leave" event is delayed until the user
653 // releases the button. It's only activated on left click given that
654 // it's more common for apps to handle dragging with only the left
655 // button.
656 SetCapture(window_handle_);
657 }
658 button_pressed = message;
659 if (message == WM_XBUTTONDOWN) {
660 button_pressed = GET_XBUTTON_WPARAM(wparam);
661 }
662 xPos = GET_X_LPARAM(lparam);
663 yPos = GET_Y_LPARAM(lparam);
664 OnPointerDown(static_cast<double>(xPos), static_cast<double>(yPos),
665 device_kind, kDefaultPointerDeviceId, button_pressed);
666 break;
667 case WM_LBUTTONUP:
668 case WM_RBUTTONUP:
669 case WM_MBUTTONUP:
670 case WM_XBUTTONUP:
671 device_kind = GetFlutterPointerDeviceKind();
672 if (device_kind != kFlutterPointerDeviceKindMouse) {
673 break;
674 }
675
676 if (message == WM_LBUTTONUP) {
677 ReleaseCapture();
678 }
679 button_pressed = message;
680 if (message == WM_XBUTTONUP) {
681 button_pressed = GET_XBUTTON_WPARAM(wparam);
682 }
683 xPos = GET_X_LPARAM(lparam);
684 yPos = GET_Y_LPARAM(lparam);
685 OnPointerUp(static_cast<double>(xPos), static_cast<double>(yPos),
686 device_kind, kDefaultPointerDeviceId, button_pressed);
687 break;
688 case WM_MOUSEWHEEL:
689 OnScroll(0.0,
690 -(static_cast<short>(HIWORD(wparam)) /
691 static_cast<double>(WHEEL_DELTA)),
692 kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
693 break;
694 case WM_MOUSEHWHEEL:
695 OnScroll((static_cast<short>(HIWORD(wparam)) /
696 static_cast<double>(WHEEL_DELTA)),
697 0.0, kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
698 break;
699 case WM_GETOBJECT: {
700 LRESULT lresult = OnGetObject(message, wparam, lparam);
701 if (lresult) {
702 return lresult;
703 }
704 break;
705 }
706 case WM_TIMER:
707 if (wparam == kDirectManipulationTimer) {
708 direct_manipulation_owner_->Update();
709 return 0;
710 }
711 break;
712 case DM_POINTERHITTEST: {
713 if (direct_manipulation_owner_) {
714 UINT contact_id = GET_POINTERID_WPARAM(wparam);
715 POINTER_INPUT_TYPE pointer_type;
716 if (windows_proc_table_->GetPointerType(contact_id, &pointer_type) &&
717 pointer_type == PT_TOUCHPAD) {
718 direct_manipulation_owner_->SetContact(contact_id);
719 }
720 }
721 break;
722 }
723 case WM_INPUTLANGCHANGE:
724 // TODO(cbracken): pass this to TextInputManager to aid with
725 // language-specific issues.
726 break;
727 case WM_IME_SETCONTEXT:
728 OnImeSetContext(message, wparam, lparam);
729 // Strip the ISC_SHOWUICOMPOSITIONWINDOW bit from lparam before passing it
730 // to DefWindowProc() so that the composition window is hidden since
731 // Flutter renders the composing string itself.
732 result_lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
733 break;
734 case WM_IME_STARTCOMPOSITION:
735 OnImeStartComposition(message, wparam, lparam);
736 // Suppress further processing by DefWindowProc() so that the default
737 // system IME style isn't used, but rather the one set in the
738 // WM_IME_SETCONTEXT handler.
739 return TRUE;
740 case WM_IME_COMPOSITION:
741 OnImeComposition(message, wparam, lparam);
742 if (lparam & GCS_RESULTSTR || lparam & GCS_COMPSTR) {
743 // Suppress further processing by DefWindowProc() since otherwise it
744 // will emit the result string as WM_CHAR messages on commit. Instead,
745 // committing the composing text to the EditableText string is handled
746 // in TextInputModel::CommitComposing, triggered by
747 // OnImeEndComposition().
748 return TRUE;
749 }
750 break;
751 case WM_IME_ENDCOMPOSITION:
752 OnImeEndComposition(message, wparam, lparam);
753 return TRUE;
754 case WM_IME_REQUEST:
755 OnImeRequest(message, wparam, lparam);
756 break;
757 case WM_UNICHAR: {
758 // Tell third-pary app, we can support Unicode.
759 if (wparam == UNICODE_NOCHAR)
760 return TRUE;
761 // DefWindowProc will send WM_CHAR for this WM_UNICHAR.
762 break;
763 }
764 case WM_THEMECHANGED:
765 OnThemeChange();
766 break;
767 case WM_DEADCHAR:
768 case WM_SYSDEADCHAR:
769 case WM_CHAR:
770 case WM_SYSCHAR:
771 case WM_KEYDOWN:
772 case WM_SYSKEYDOWN:
773 case WM_KEYUP:
774 case WM_SYSKEYUP:
775 if (keyboard_manager_->HandleMessage(message, wparam, lparam)) {
776 return 0;
777 }
778 break;
779 }
780
781 return Win32DefWindowProc(window_handle_, message, wparam, result_lparam);
782 }
flutter::FlutterWindow::OnPointerLeave
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
Definition: flutter_window.cc:239
flutter::FlutterWindow::OnThemeChange
virtual void OnThemeChange()
Definition: flutter_window.cc:351
flutter::FlutterWindow::OnImeRequest
virtual void OnImeRequest(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:897
flutter::FlutterWindow::Win32DefWindowProc
virtual LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: flutter_window.cc:929
flutter::FlutterWindow::OnImeStartComposition
virtual void OnImeStartComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:848
flutter::FlutterWindow::OnSetCursor
virtual void OnSetCursor()
Definition: flutter_window.cc:246
flutter::FlutterWindow::OnScroll
virtual void OnScroll(double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
Definition: flutter_window.cc:286
flutter::FlutterWindow::OnPointerUp
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
Definition: flutter_window.cc:226
flutter::FlutterWindow::OnPaint
virtual void OnPaint()
Definition: flutter_window.cc:198
flutter::FlutterWindow::direct_manipulation_owner_
std::unique_ptr< DirectManipulationOwner > direct_manipulation_owner_
Definition: flutter_window.h:281
flutter::FlutterWindow::OnPointerDown
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
Definition: flutter_window.cc:213
flutter::FlutterWindow::OnImeSetContext
virtual void OnImeSetContext(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:840
flutter::FlutterWindow::OnWindowStateEvent
virtual void OnWindowStateEvent(WindowStateEvent event)
Definition: flutter_window.cc:369
flutter::FlutterWindow::OnPointerMove
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)
Definition: flutter_window.cc:204
flutter::FlutterWindow::OnImeComposition
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:855
flutter::FlutterWindow::OnDpiScale
virtual void OnDpiScale(unsigned int dpi)
Definition: flutter_window.cc:188
flutter::FlutterWindow::OnGetObject
virtual LRESULT OnGetObject(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:784
flutter::FlutterWindow::OnImeEndComposition
virtual void OnImeEndComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:890
flutter::SequentialIdGenerator::ReleaseNumber
void ReleaseNumber(uint32_t number)
Definition: sequential_id_generator.cc:47
flutter::SequentialIdGenerator::GetGeneratedId
uint32_t GetGeneratedId(uint32_t number)
Definition: sequential_id_generator.cc:32
message
Win32Message message
Definition: keyboard_unittests.cc:137
flutter::kShift
constexpr int kShift
Definition: keyboard_utils.h:14
flutter::WindowStateEvent::kHide
@ kHide
flutter::WindowStateEvent::kUnfocus
@ kUnfocus
flutter::WindowStateEvent::kShow
@ kShow
flutter::WindowStateEvent::kFocus
@ kFocus
flutter::kControl
constexpr int kControl
Definition: keyboard_utils.h:15

References flutter::GetDpiForHWND(), flutter::kControl, flutter::kFocus, flutter::kHide, flutter::kShift, flutter::kShow, flutter::kUnfocus, and message.

## ◆ InitializeChild()

void flutter::FlutterWindow::InitializeChild | ( | const char * | title,
|  | unsigned int | width,
|  | unsigned int | height
| ) |  |

Definition at line 428 of file flutter_window.cc.

430 {
431 Destroy();
432 std::wstring converted_title = NarrowToWide(title);
433
434 WNDCLASS window_class = RegisterWindowClass(converted_title);
435
436 auto* result = CreateWindowEx(
437 0, window_class.lpszClassName, converted_title.c_str(),
438 WS_CHILD | WS_VISIBLE, CW_DEFAULT, CW_DEFAULT, width, height,
439 HWND_MESSAGE, nullptr, window_class.hInstance, this);
440
441 if (result == nullptr) {
442 auto error = GetLastError();
443 LPWSTR message = nullptr;
444 size_t size = FormatMessageW(
445 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
446 FORMAT_MESSAGE_IGNORE_INSERTS,
447 NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
448 reinterpret_cast<LPWSTR>(&message), 0, NULL);
449 OutputDebugString(message);
450 LocalFree(message);
451 }
452 SetUserObjectInformationA(GetCurrentProcess(),
453 UOI_TIMERPROC_EXCEPTION_SUPPRESSION, FALSE, 1);
454 // SetTimer is not precise, if a 16 ms interval is requested, it will instead
455 // often fire in an interval of 32 ms. Providing a value of 14 will ensure it
456 // runs every 16 ms, which will allow for 60 Hz trackpad gesture events, which
457 // is the maximal frequency supported by SetTimer.
458 SetTimer(result, kDirectManipulationTimer, 14, nullptr);
459 direct_manipulation_owner_ = std::make_unique<DirectManipulationOwner>(this);
460 direct_manipulation_owner_->Init(width, height);
461 }
flutter::FlutterWindow::NarrowToWide
std::wstring NarrowToWide(const char *source)
Definition: flutter_window.cc:485

References direct_manipulation_owner_, message, and NarrowToWide().

Referenced by FlutterWindow().

## ◆ NarrowToWide()

std::wstring flutter::FlutterWindow::NarrowToWide | ( | const char * | source | ) |
| protected

Definition at line 485 of file flutter_window.cc.

485 {
486 size_t length = strlen(source);
487 size_t outlen = 0;
488 std::wstring wideTitle(length, L'#');
489 mbstowcs_s(&outlen, &wideTitle[0], length + 1, source, length);
490 return wideTitle;
491 }

Referenced by InitializeChild().

## ◆ OnBitmapSurfaceCleared()

bool flutter::FlutterWindow::OnBitmapSurfaceCleared | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 311 of file flutter_window.cc.

311 {
312 HDC dc = ::GetDC(GetWindowHandle());
313 bool result = ::PatBlt(dc, 0, 0, current_width_, current_height_, BLACKNESS);
314 ::ReleaseDC(GetWindowHandle(), dc);
315 return result;
316 }

References GetWindowHandle().

## ◆ OnBitmapSurfaceUpdated()

bool flutter::FlutterWindow::OnBitmapSurfaceUpdated | ( | const void * | allocation,
|  | size_t | row_bytes,
|  | size_t | height
| ) |  |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 318 of file flutter_window.cc.

320 {
321 HDC dc = ::GetDC(GetWindowHandle());
322 BITMAPINFO bmi = {};
323 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
324 bmi.bmiHeader.biWidth = row_bytes / 4;
325 bmi.bmiHeader.biHeight = -height;
326 bmi.bmiHeader.biPlanes = 1;
327 bmi.bmiHeader.biBitCount = 32;
328 bmi.bmiHeader.biCompression = BI_RGB;
329 bmi.bmiHeader.biSizeImage = 0;
330 int ret = ::SetDIBitsToDevice(dc, 0, 0, row_bytes / 4, height, 0, 0, 0,
331 height, allocation, &bmi, DIB_RGB_COLORS);
332 ::ReleaseDC(GetWindowHandle(), dc);
333 return ret != 0;
334 }

References GetWindowHandle().

Referenced by flutter::testing::TEST_F().

## ◆ OnComposeBegin()

void flutter::FlutterWindow::OnComposeBegin | ( |  | ) |
| virtual

Definition at line 265 of file flutter_window.cc.

265 {
266 binding_handler_delegate_->OnComposeBegin();
267 }
flutter::WindowBindingHandlerDelegate::OnComposeBegin
virtual void OnComposeBegin()=0

References flutter::WindowBindingHandlerDelegate::OnComposeBegin().

Referenced by OnImeStartComposition().

## ◆ OnComposeChange()

void flutter::FlutterWindow::OnComposeChange | ( | const std::u16string & | text,
|  | int | cursor_pos
| ) |  |
| virtual

Definition at line 277 of file flutter_window.cc.

278 {
279 binding_handler_delegate_->OnComposeChange(text, cursor_pos);
280 }
flutter::WindowBindingHandlerDelegate::OnComposeChange
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)=0
text
std::u16string text
Definition: keyboard_unittests.cc:332

References flutter::WindowBindingHandlerDelegate::OnComposeChange(), and text.

Referenced by OnImeComposition().

## ◆ OnComposeCommit()

void flutter::FlutterWindow::OnComposeCommit | ( |  | ) |
| virtual

Definition at line 269 of file flutter_window.cc.

269 {
270 binding_handler_delegate_->OnComposeCommit();
271 }
flutter::WindowBindingHandlerDelegate::OnComposeCommit
virtual void OnComposeCommit()=0

References flutter::WindowBindingHandlerDelegate::OnComposeCommit().

Referenced by OnImeComposition().

## ◆ OnComposeEnd()

void flutter::FlutterWindow::OnComposeEnd | ( |  | ) |
| virtual

Definition at line 273 of file flutter_window.cc.

273 {
274 binding_handler_delegate_->OnComposeEnd();
275 }
flutter::WindowBindingHandlerDelegate::OnComposeEnd
virtual void OnComposeEnd()=0

References flutter::WindowBindingHandlerDelegate::OnComposeEnd().

Referenced by OnImeEndComposition().

## ◆ OnCursorRectUpdated()

void flutter::FlutterWindow::OnCursorRectUpdated | ( | const Rect & | rect | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 299 of file flutter_window.cc.

299 {
300 // Convert the rect from Flutter logical coordinates to device coordinates.
301 auto scale = GetDpiScale();
302 Point origin(rect.left() * scale, rect.top() * scale);
303 Size size(rect.width() * scale, rect.height() * scale);
304 UpdateCursorRect(Rect(origin, size));
305 }
flutter::FlutterWindow::UpdateCursorRect
virtual void UpdateCursorRect(const Rect &rect)
Definition: flutter_window.cc:909
flutter::FlutterWindow::GetDpiScale
virtual float GetDpiScale() override
Definition: flutter_window.cc:171

References GetDpiScale(), flutter::Rect::height(), flutter::Rect::left(), flutter::Rect::top(), UpdateCursorRect(), and flutter::Rect::width().

## ◆ OnDpiScale()

void flutter::FlutterWindow::OnDpiScale | ( | unsigned int | dpi | ) |
| virtual

Definition at line 188 of file flutter_window.cc.

188 {};

## ◆ OnGetObject()

LRESULT flutter::FlutterWindow::OnGetObject | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected virtual

Definition at line 784 of file flutter_window.cc.

786 {
787 LRESULT reference_result = static_cast<LRESULT>(0L);
788
789 // Only the lower 32 bits of lparam are valid when checking the object id
790 // because it sometimes gets sign-extended incorrectly (but not always).
791 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(lparam));
792
793 bool is_uia_request = static_cast<DWORD>(UiaRootObjectId) == obj_id;
794 bool is_msaa_request = static_cast<DWORD>(OBJID_CLIENT) == obj_id;
795
796 if (is_uia_request || is_msaa_request) {
797 // On Windows, we don't get a notification that the screen reader has been
798 // enabled or disabled. There is an API to query for screen reader state,
799 // but that state isn't set by all screen readers, including by Narrator,
800 // the screen reader that ships with Windows:
801 // https://docs.microsoft.com/en-us/windows/win32/winauto/screen-reader-parameter
802 //
803 // Instead, we enable semantics in Flutter if Windows issues queries for
804 // Microsoft Active Accessibility (MSAA) COM objects.
805 OnUpdateSemanticsEnabled(true);
806 }
807
808 gfx::NativeViewAccessible root_view = GetNativeViewAccessible();
809 // TODO(schectman): UIA is currently disabled by default.
810 // https://github.com/flutter/flutter/issues/114547
811 if (root_view) {
812 CreateAxFragmentRoot();
813 if (is_uia_request) {
814 #ifdef FLUTTER_ENGINE_USE_UIA
815 // Retrieve UIA object for the root view.
816 Microsoft::WRL::ComPtr<IRawElementProviderSimple> root;
817 if (SUCCEEDED(
818 ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
819 IID_PPV_ARGS(&root)))) {
820 // Return the UIA object via UiaReturnRawElementProvider(). See:
821 // https://docs.microsoft.com/en-us/windows/win32/winauto/wm-getobject
822 reference_result = UiaReturnRawElementProvider(window_handle_, wparam,
823 lparam, root.Get());
824 } else {
825 FML_LOG(ERROR) << "Failed to query AX fragment root.";
826 }
827 #endif // FLUTTER_ENGINE_USE_UIA
828 } else if (is_msaa_request) {
829 // Create the accessibility root if it does not already exist.
830 // Return the IAccessible for the root view.
831 Microsoft::WRL::ComPtr<IAccessible> root;
832 ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
833 IID_PPV_ARGS(&root));
834 reference_result = LresultFromObject(IID_IAccessible, wparam, root.Get());
835 }
836 }
837 return reference_result;
838 }
flutter::FlutterWindow::OnUpdateSemanticsEnabled
virtual void OnUpdateSemanticsEnabled(bool enabled)
Definition: flutter_window.cc:282
flutter::FlutterWindow::GetNativeViewAccessible
virtual gfx::NativeViewAccessible GetNativeViewAccessible()
Definition: flutter_window.cc:336

References GetNativeViewAccessible(), and OnUpdateSemanticsEnabled().

## ◆ OnImeComposition()

void flutter::FlutterWindow::OnImeComposition | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected virtual

Definition at line 855 of file flutter_window.cc.

857 {
858 // Update the IME window position.
859 text_input_manager_->UpdateImeWindow();
860
861 if (lparam == 0) {
862 OnComposeChange(u"", 0);
863 OnComposeCommit();
864 }
865
866 // Process GCS_RESULTSTR at fisrt, because Google Japanese Input and ATOK send
867 // both GCS_RESULTSTR and GCS_COMPSTR to commit composed text and send new
868 // composing text.
869 if (lparam & GCS_RESULTSTR) {
870 // Commit but don't end composing.
871 // Read the committed composing string.
872 long pos = text_input_manager_->GetComposingCursorPosition();
873 std::optional<std::u16string> text = text_input_manager_->GetResultString();
874 if (text) {
875 OnComposeChange(text.value(), pos);
876 OnComposeCommit();
877 }
878 }
879 if (lparam & GCS_COMPSTR) {
880 // Read the in-progress composing string.
881 long pos = text_input_manager_->GetComposingCursorPosition();
882 std::optional<std::u16string> text =
883 text_input_manager_->GetComposingString();
884 if (text) {
885 OnComposeChange(text.value(), pos);
886 }
887 }
888 }
flutter::FlutterWindow::OnComposeCommit
virtual void OnComposeCommit()
Definition: flutter_window.cc:269
flutter::FlutterWindow::OnComposeChange
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)
Definition: flutter_window.cc:277

References OnComposeChange(), OnComposeCommit(), and text.

## ◆ OnImeEndComposition()

void flutter::FlutterWindow::OnImeEndComposition | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected virtual

Definition at line 890 of file flutter_window.cc.

892 {
893 text_input_manager_->DestroyImeWindow();
894 OnComposeEnd();
895 }
flutter::FlutterWindow::OnComposeEnd
virtual void OnComposeEnd()
Definition: flutter_window.cc:273

References OnComposeEnd().

## ◆ OnImeRequest()

void flutter::FlutterWindow::OnImeRequest | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected virtual

Definition at line 897 of file flutter_window.cc.

899 {
900 // TODO(cbracken): Handle IMR_RECONVERTSTRING, IMR_DOCUMENTFEED,
901 // and IMR_QUERYCHARPOSITION messages.
902 // https://github.com/flutter/flutter/issues/74547
903 }

## ◆ OnImeSetContext()

void flutter::FlutterWindow::OnImeSetContext | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected virtual

Definition at line 840 of file flutter_window.cc.

842 {
843 if (wparam != 0) {
844 text_input_manager_->CreateImeWindow();
845 }
846 }

## ◆ OnImeStartComposition()

void flutter::FlutterWindow::OnImeStartComposition | ( | UINT const | message,
|  | WPARAM const | wparam,
|  | LPARAM const | lparam
| ) |  |
| protected virtual

Definition at line 848 of file flutter_window.cc.

850 {
851 text_input_manager_->CreateImeWindow();
852 OnComposeBegin();
853 }
flutter::FlutterWindow::OnComposeBegin
virtual void OnComposeBegin()
Definition: flutter_window.cc:265

References OnComposeBegin().

## ◆ OnKey()

void flutter::FlutterWindow::OnKey | ( | int | key,
|  | int | scancode,
|  | int | action,
|  | char32_t | character,
|  | bool | extended,
|  | bool | was_down,
|  | KeyEventCallback | callback
| ) |  |
| override virtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 254 of file flutter_window.cc.

260 {
261 binding_handler_delegate_->OnKey(key, scancode, action, character, extended,
262 was_down, std::move(callback));
263 }
flutter::WindowBindingHandlerDelegate::OnKey
virtual void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
callback
FlutterDesktopBinaryReply callback
Definition: flutter_windows_view_unittests.cc:52
extended
bool extended
Definition: keyboard_key_handler_unittests.cc:118
key
int key
Definition: keyboard_key_handler_unittests.cc:114
character
char32_t character
Definition: keyboard_key_handler_unittests.cc:117
action
int action
Definition: keyboard_key_handler_unittests.cc:116
scancode
int scancode
Definition: keyboard_key_handler_unittests.cc:115
was_down
bool was_down
Definition: keyboard_key_handler_unittests.cc:119

References action, callback, character, extended, key, flutter::WindowBindingHandlerDelegate::OnKey(), scancode, and was_down.

## ◆ OnPaint()

void flutter::FlutterWindow::OnPaint | ( |  | ) |
| virtual

Definition at line 198 of file flutter_window.cc.

198 {
199 if (binding_handler_delegate_ != nullptr) {
200 binding_handler_delegate_->OnWindowRepaint();
201 }
202 }
flutter::WindowBindingHandlerDelegate::OnWindowRepaint
virtual void OnWindowRepaint()=0

References flutter::WindowBindingHandlerDelegate::OnWindowRepaint().

## ◆ OnPointerDown()

void flutter::FlutterWindow::OnPointerDown | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | UINT | button
| ) |  |
| virtual

Definition at line 213 of file flutter_window.cc.

217 {
218 uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
219 if (flutter_button != 0) {
220 binding_handler_delegate_->OnPointerDown(
221 x, y, device_kind, device_id,
222 static_cast<FlutterPointerMouseButtons>(flutter_button));
223 }
224 }
flutter::WindowBindingHandlerDelegate::OnPointerDown
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0

References flutter::WindowBindingHandlerDelegate::OnPointerDown().

Referenced by flutter::testing::TEST_F().

## ◆ OnPointerLeave()

void flutter::FlutterWindow::OnPointerLeave | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id
| ) |  |
| virtual

Definition at line 239 of file flutter_window.cc.

242 {
243 binding_handler_delegate_->OnPointerLeave(x, y, device_kind, device_id);
244 }
flutter::WindowBindingHandlerDelegate::OnPointerLeave
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0

References flutter::WindowBindingHandlerDelegate::OnPointerLeave().

Referenced by flutter::testing::TEST_F().

## ◆ OnPointerMove()

void flutter::FlutterWindow::OnPointerMove | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | int | modifiers_state
| ) |  |
| virtual

Definition at line 204 of file flutter_window.cc.

208 {
209 binding_handler_delegate_->OnPointerMove(x, y, device_kind, device_id,
210 modifiers_state);
211 }
flutter::WindowBindingHandlerDelegate::OnPointerMove
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)=0

References flutter::WindowBindingHandlerDelegate::OnPointerMove().

Referenced by flutter::testing::TEST_F().

## ◆ OnPointerUp()

void flutter::FlutterWindow::OnPointerUp | ( | double | x,
|  | double | y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id,
|  | UINT | button
| ) |  |
| virtual

Definition at line 226 of file flutter_window.cc.

230 {
231 uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
232 if (flutter_button != 0) {
233 binding_handler_delegate_->OnPointerUp(
234 x, y, device_kind, device_id,
235 static_cast<FlutterPointerMouseButtons>(flutter_button));
236 }
237 }
flutter::WindowBindingHandlerDelegate::OnPointerUp
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0

References flutter::WindowBindingHandlerDelegate::OnPointerUp().

Referenced by flutter::testing::TEST_F().

## ◆ OnResetImeComposing()

void flutter::FlutterWindow::OnResetImeComposing | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 307 of file flutter_window.cc.

307 {
308 AbortImeComposing();
309 }
flutter::FlutterWindow::AbortImeComposing
virtual void AbortImeComposing()
Definition: flutter_window.cc:905

References AbortImeComposing().

## ◆ OnResize()

void flutter::FlutterWindow::OnResize | ( | unsigned int | width,
|  | unsigned int | height
| ) |  |
| virtual

Definition at line 192 of file flutter_window.cc.

192 {
193 if (binding_handler_delegate_ != nullptr) {
194 binding_handler_delegate_->OnWindowSizeChanged(width, height);
195 }
196 }
flutter::WindowBindingHandlerDelegate::OnWindowSizeChanged
virtual bool OnWindowSizeChanged(size_t width, size_t height)=0

References flutter::WindowBindingHandlerDelegate::OnWindowSizeChanged().

## ◆ OnScroll()

void flutter::FlutterWindow::OnScroll | ( | double | delta_x,
|  | double | delta_y,
|  | FlutterPointerDeviceKind | device_kind,
|  | int32_t | device_id
| ) |  |
| virtual

Definition at line 286 of file flutter_window.cc.

289 {
290 POINT point;
291 GetCursorPos(&point);
292
293 ScreenToClient(GetWindowHandle(), &point);
294 binding_handler_delegate_->OnScroll(point.x, point.y, delta_x, delta_y,
295 GetScrollOffsetMultiplier(), device_kind,
296 device_id);
297 }
flutter::FlutterWindow::GetScrollOffsetMultiplier
virtual float GetScrollOffsetMultiplier()
Definition: flutter_window.cc:925
flutter::WindowBindingHandlerDelegate::OnScroll
virtual void OnScroll(double x, double y, double delta_x, double delta_y, int scroll_offset_multiplier, FlutterPointerDeviceKind device_kind, int32_t device_id)=0

References GetScrollOffsetMultiplier(), GetWindowHandle(), and flutter::WindowBindingHandlerDelegate::OnScroll().

## ◆ OnSetCursor()

void flutter::FlutterWindow::OnSetCursor | ( |  | ) |
| virtual

Definition at line 246 of file flutter_window.cc.

246 {
247 ::SetCursor(current_cursor_);
248 }

## ◆ OnText()

void flutter::FlutterWindow::OnText | ( | const std::u16string & | text | ) |
| override virtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 250 of file flutter_window.cc.

250 {
251 binding_handler_delegate_->OnText(text);
252 }
flutter::WindowBindingHandlerDelegate::OnText
virtual void OnText(const std::u16string &)=0

References flutter::WindowBindingHandlerDelegate::OnText(), and text.

## ◆ OnThemeChange()

void flutter::FlutterWindow::OnThemeChange | ( |  | ) |
| virtual

Definition at line 351 of file flutter_window.cc.

351 {
352 binding_handler_delegate_->OnHighContrastChanged();
353 }
flutter::WindowBindingHandlerDelegate::OnHighContrastChanged
virtual void OnHighContrastChanged()=0

References flutter::WindowBindingHandlerDelegate::OnHighContrastChanged().

## ◆ OnUpdateSemanticsEnabled()

void flutter::FlutterWindow::OnUpdateSemanticsEnabled | ( | bool | enabled | ) |
| virtual

Definition at line 282 of file flutter_window.cc.

282 {
283 binding_handler_delegate_->OnUpdateSemanticsEnabled(enabled);
284 }
flutter::WindowBindingHandlerDelegate::OnUpdateSemanticsEnabled
virtual void OnUpdateSemanticsEnabled(bool enabled)=0

References flutter::WindowBindingHandlerDelegate::OnUpdateSemanticsEnabled().

Referenced by OnGetObject().

## ◆ OnWindowStateEvent()

void flutter::FlutterWindow::OnWindowStateEvent | ( | WindowStateEvent | event | ) |
| virtual

Definition at line 369 of file flutter_window.cc.

369 {
370 switch (event) {
371 case WindowStateEvent::kShow:
372 restored_ = true;
373 break;
374 case WindowStateEvent::kHide:
375 restored_ = false;
376 focused_ = false;
377 break;
378 case WindowStateEvent::kFocus:
379 focused_ = true;
380 break;
381 case WindowStateEvent::kUnfocus:
382 focused_ = false;
383 break;
384 }
385 HWND hwnd = GetWindowHandle();
386 if (hwnd && binding_handler_delegate_) {
387 binding_handler_delegate_->OnWindowStateEvent(hwnd, event);
388 }
389 }
flutter::WindowBindingHandlerDelegate::OnWindowStateEvent
virtual void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)=0

References GetWindowHandle(), flutter::kFocus, flutter::kHide, flutter::kShow, flutter::kUnfocus, and flutter::WindowBindingHandlerDelegate::OnWindowStateEvent().

Referenced by SetView().

## ◆ SetFlutterCursor()

void flutter::FlutterWindow::SetFlutterCursor | ( | HCURSOR | cursor | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 183 of file flutter_window.cc.

183 {
184 current_cursor_ = cursor;
185 ::SetCursor(current_cursor_);
186 }

Referenced by UpdateFlutterCursor().

## ◆ SetView()

void flutter::FlutterWindow::SetView | ( | WindowBindingHandlerDelegate * | view | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 158 of file flutter_window.cc.

158 {
159 binding_handler_delegate_ = window;
160 if (direct_manipulation_owner_) {
161 direct_manipulation_owner_->SetBindingHandlerDelegate(window);
162 }
163 if (restored_ && window) {
164 OnWindowStateEvent(WindowStateEvent::kShow);
165 }
166 if (focused_ && window) {
167 OnWindowStateEvent(WindowStateEvent::kFocus);
168 }
169 }

References direct_manipulation_owner_, flutter::kFocus, flutter::kShow, and OnWindowStateEvent().

Referenced by flutter::testing::TEST_F().

## ◆ UpdateCursorRect()

void flutter::FlutterWindow::UpdateCursorRect | ( | const Rect & | rect | ) |
| protected virtual

Definition at line 909 of file flutter_window.cc.

909 {
910 text_input_manager_->UpdateCaretRect(rect);
911 }

Referenced by OnCursorRectUpdated().

## ◆ UpdateFlutterCursor()

void flutter::FlutterWindow::UpdateFlutterCursor | ( | const std::string & | cursor_name | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 179 of file flutter_window.cc.

179 {
180 SetFlutterCursor(GetCursorByName(cursor_name));
181 }
flutter::FlutterWindow::SetFlutterCursor
virtual void SetFlutterCursor(HCURSOR cursor) override
Definition: flutter_window.cc:183

References SetFlutterCursor().

Referenced by flutter::testing::TEST_F().

## ◆ Win32DefWindowProc()

LRESULT flutter::FlutterWindow::Win32DefWindowProc | ( | HWND | hWnd,
|  | UINT | Msg,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) |  |
| protected virtual

Definition at line 929 of file flutter_window.cc.

932 {
933 return ::DefWindowProc(hWnd, Msg, wParam, lParam);
934 }

## ◆ Win32DispatchMessage()

UINT flutter::FlutterWindow::Win32DispatchMessage | ( | UINT | Msg,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) |  |
| override virtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 479 of file flutter_window.cc.

481 {
482 return ::SendMessage(window_handle_, Msg, wParam, lParam);
483 }

## ◆ Win32MapVkToChar()

uint32_t flutter::FlutterWindow::Win32MapVkToChar | ( | uint32_t | virtual_key | ) |
| override virtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 475 of file flutter_window.cc.

475 {
476 return ::MapVirtualKey(virtual_key, MAPVK_VK_TO_CHAR);
477 }

## ◆ Win32PeekMessage()

BOOL flutter::FlutterWindow::Win32PeekMessage | ( | LPMSG | lpMsg,
|  | UINT | wMsgFilterMin,
|  | UINT | wMsgFilterMax,
|  | UINT | wRemoveMsg
| ) |  |
| override virtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 467 of file flutter_window.cc.

470 {
471 return ::PeekMessage(lpMsg, window_handle_, wMsgFilterMin, wMsgFilterMax,
472 wRemoveMsg);
473 }

## Friends And Related Function Documentation

## ◆ WindowAXFragmentRootDelegate

friend class WindowAXFragmentRootDelegate
| friend

Definition at line 385 of file flutter_window.h.

## Member Data Documentation

## ◆ alert_delegate_

std::unique_ptr<AlertPlatformNodeDelegate> flutter::FlutterWindow::alert_delegate_
| protected

Definition at line 274 of file flutter_window.h.

Referenced by GetAlertDelegate().

## ◆ alert_node_

std::unique_ptr<ui::AXPlatformNodeWin> flutter::FlutterWindow::alert_node_
| protected

Definition at line 277 of file flutter_window.h.

Referenced by GetAlert().

## ◆ direct_manipulation_owner_

std::unique_ptr<DirectManipulationOwner> flutter::FlutterWindow::direct_manipulation_owner_
| protected

Definition at line 281 of file flutter_window.h.

Referenced by InitializeChild(), and SetView().

The documentation for this class was generated from the following files:

- shell/platform/windows/flutter_window.h
- shell/platform/windows/flutter_window.cc