| 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< DisplayManagerWin32 > const &display_manager, 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, uint32_t rotation, uint32_t pressure, int modifiers_state)
virtual void | OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button, uint32_t rotation, uint32_t pressure)
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 | 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 bool | OnBitmapSurfaceCleared () override
virtual bool | OnBitmapSurfaceUpdated (const void *allocation, size_t row_bytes, size_t height) override
virtual PointerLocation | GetPrimaryPointerLocation () override
virtual FlutterEngineDisplayId | GetDisplayId () override
virtual void | OnThemeChange ()
virtual AlertPlatformNodeDelegate * | GetAlertDelegate () override
virtual ui::AXPlatformNodeWin * | GetAlert () override
virtual bool | Focus () 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 37 of file flutter_window.h.

## Constructor & Destructor Documentation

## ◆ FlutterWindow() [1/2]

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

Definition at line 77 of file flutter_window.cc.

83 : touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId),
84 display_manager_(display_manager),
85 windows_proc_table_(std::move(windows_proc_table)),
86 text_input_manager_(std::move(text_input_manager)),
87 ax_fragment_root_(nullptr) {
88 // Get the DPI of the primary monitor as the initial DPI. If Per-Monitor V2 is
89 // supported, |current_dpi_| should be updated in the
90 // kWmDpiChangedBeforeParent message.
91 current_dpi_ = GetDpiForHWND(nullptr);
92
93 // Get initial value for wheel scroll lines
94 // TODO: Listen to changes for this value
95 // https://github.com/flutter/flutter/issues/107248
96 UpdateScrollOffsetMultiplier();
97
98 if (windows_proc_table_ == nullptr) {
99 windows_proc_table_ = std::make_unique<WindowsProcTable>();
100 }
101 if (text_input_manager_ == nullptr) {
102 text_input_manager_ = std::make_unique<TextInputManager>();
103 }
104 keyboard_manager_ = std::make_unique<KeyboardManager>(this);
105
106 InitializeChild("FLUTTERVIEW", width, height);
107 }
flutter::FlutterWindow::InitializeChild
void InitializeChild(const char *title, unsigned int width, unsigned int height)
Definition: flutter_window.cc:413
display_manager
const DisplayManagerWin32 * display_manager
Definition: display_manager.cc:18
flutter::GetDpiForHWND
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:128

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

## ◆ ~FlutterWindow()

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

Definition at line 113 of file flutter_window.cc.

113 {
114 Destroy();
115 }

## ◆ FlutterWindow() [2/2]

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

Definition at line 110 of file flutter_window.cc.

111 : touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId) {}

## Member Function Documentation

## ◆ AbortImeComposing()

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

Definition at line 916 of file flutter_window.cc.

916 {
917 text_input_manager_->AbortComposing();
918 }

Referenced by OnResetImeComposing().

## ◆ Focus()

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

Implements flutter::WindowBindingHandler.

Definition at line 138 of file flutter_window.cc.

138 {
139 auto hwnd = GetWindowHandle();
140 if (hwnd == nullptr) {
141 return false;
142 }
143
144 HWND prevFocus = ::SetFocus(hwnd);
145 if (prevFocus == nullptr) {
146 return false;
147 }
148
149 return true;
150 }
flutter::FlutterWindow::GetWindowHandle
virtual HWND GetWindowHandle() override
Definition: flutter_window.cc:448

References GetWindowHandle().

## ◆ GetAlert()

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

Implements flutter::WindowBindingHandler.

Definition at line 339 of file flutter_window.cc.

339 {
340 CreateAxFragmentRoot();
341 return alert_node_.get();
342 }
flutter::FlutterWindow::alert_node_
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_
Definition: flutter_window.h:281

References alert_node_.

## ◆ GetAlertDelegate()

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

Implements flutter::WindowBindingHandler.

Definition at line 334 of file flutter_window.cc.

334 {
335 CreateAxFragmentRoot();
336 return alert_delegate_.get();
337 }
flutter::FlutterWindow::alert_delegate_
std::unique_ptr< AlertPlatformNodeDelegate > alert_delegate_
Definition: flutter_window.h:278

References alert_delegate_.

## ◆ GetAxFragmentRootDelegate()

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

Definition at line 330 of file flutter_window.cc.

330 {
331 return binding_handler_delegate_->GetAxFragmentRootDelegate();
332 }
flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()=0

References flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate().

## ◆ GetCurrentDPI()

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

Definition at line 924 of file flutter_window.cc.

924 {
925 return current_dpi_;
926 }

Referenced by GetDpiScale().

## ◆ GetCurrentHeight()

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

Definition at line 932 of file flutter_window.cc.

932 {
933 return current_height_;
934 }

Referenced by GetPhysicalWindowBounds().

## ◆ GetCurrentWidth()

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

Definition at line 928 of file flutter_window.cc.

928 {
929 return current_width_;
930 }

Referenced by GetPhysicalWindowBounds().

## ◆ GetDisplayId()

FlutterEngineDisplayId flutter::FlutterWindow::GetDisplayId | ( |  | ) |
| override virtual

Implements flutter::WindowBindingHandler.

Definition at line 316 of file flutter_window.cc.

316 {
317 FlutterEngineDisplayId const display_id =
318 reinterpret_cast<FlutterEngineDisplayId>(
319 MonitorFromWindow(GetWindowHandle(), MONITOR_DEFAULTTONEAREST));
320 if (!display_manager_->FindById(display_id)) {
321 FML_LOG(ERROR) << "Current monitor not found in display list.";
322 }
323 return display_id;
324 }

References GetWindowHandle().

## ◆ GetDpiScale()

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

Implements flutter::WindowBindingHandler.

Definition at line 130 of file flutter_window.cc.

130 {
131 return static_cast<float>(GetCurrentDPI()) / static_cast<float>(base_dpi);
132 }
flutter::FlutterWindow::GetCurrentDPI
UINT GetCurrentDPI()
Definition: flutter_window.cc:924

References GetCurrentDPI().

Referenced by OnCursorRectUpdated().

## ◆ GetNativeViewAccessible()

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

Definition at line 301 of file flutter_window.cc.

301 {
302 if (binding_handler_delegate_ == nullptr) {
303 return nullptr;
304 }
305
306 return binding_handler_delegate_->GetNativeViewAccessible();
307 }
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 134 of file flutter_window.cc.

134 {
135 return {GetCurrentWidth(), GetCurrentHeight()};
136 }
flutter::FlutterWindow::GetCurrentWidth
UINT GetCurrentWidth()
Definition: flutter_window.cc:928
flutter::FlutterWindow::GetCurrentHeight
UINT GetCurrentHeight()
Definition: flutter_window.cc:932

References GetCurrentHeight(), and GetCurrentWidth().

## ◆ GetPrimaryPointerLocation()

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

Implements flutter::WindowBindingHandler.

Definition at line 309 of file flutter_window.cc.

309 {
310 POINT point;
311 GetCursorPos(&point);
312 ScreenToClient(GetWindowHandle(), &point);
313 return {(size_t)point.x, (size_t)point.y};
314 }

References GetWindowHandle().

## ◆ GetScrollOffsetMultiplier()

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

Definition at line 936 of file flutter_window.cc.

936 {
937 return scroll_offset_multiplier_;
938 }

Referenced by OnScroll().

## ◆ GetWindowHandle()

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

Implements flutter::WindowBindingHandler.

Definition at line 448 of file flutter_window.cc.

448 {
449 return window_handle_;
450 }

Referenced by flutter::DirectManipulationOwner::Destroy(), Focus(), GetDisplayId(), 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 516 of file flutter_window.cc.

518 {
519 LPARAM result_lparam = lparam;
520 int x_pos = 0, y_pos = 0;
521 UINT width = 0, height = 0;
522 UINT button_pressed = 0;
523 FlutterPointerDeviceKind device_kind;
524
525 switch (message) {
526 case kWmDpiChangedBeforeParent:
527 current_dpi_ = GetDpiForHWND(window_handle_);
528 OnDpiScale(current_dpi_);
529 return 0;
530 case WM_SIZE:
531 width = LOWORD(lparam);
532 height = HIWORD(lparam);
533
534 current_width_ = width;
535 current_height_ = height;
536 HandleResize(width, height);
537
538 OnWindowStateEvent(width == 0 && height == 0 ? WindowStateEvent::kHide
539 : WindowStateEvent::kShow);
540 break;
541 case WM_PAINT:
542 OnPaint();
543 break;
544 case WM_POINTERDOWN:
545 case WM_POINTERUPDATE:
546 case WM_POINTERUP:
547 case WM_POINTERLEAVE: {
548 x_pos = GET_X_LPARAM(lparam);
549 y_pos = GET_Y_LPARAM(lparam);
550 auto const x = static_cast<double>(x_pos);
551 auto const y = static_cast<double>(y_pos);
552 auto const pointerId = GET_POINTERID_WPARAM(wparam);
553 POINTER_INFO pointerInfo;
554 if (windows_proc_table_->GetPointerInfo(pointerId, &pointerInfo)) {
555 UINT32 pressure = 0;
556 UINT32 rotation = 0;
557 if (pointerInfo.pointerType == PT_PEN) {
558 POINTER_PEN_INFO penInfo;
559 if (windows_proc_table_->GetPointerPenInfo(pointerId, &penInfo)) {
560 pressure = penInfo.pressure;
561 rotation = penInfo.rotation;
562 }
563 }
564 auto touch_id = touch_id_generator_.GetGeneratedId(pointerId);
565 FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
566 switch (pointerInfo.pointerType) {
567 case PT_TOUCH:
568 device_kind = kFlutterPointerDeviceKindTouch;
569 break;
570 case PT_PEN:
571 device_kind = kFlutterPointerDeviceKindStylus;
572 break;
573 case PT_MOUSE:
574 device_kind = kFlutterPointerDeviceKindMouse;
575 break;
576 case PT_TOUCHPAD:
577 device_kind = kFlutterPointerDeviceKindTrackpad;
578 break;
579 default:
580 FML_LOG(ERROR) << "Unrecognized device key "
581 << pointerInfo.pointerType;
582 break;
583 }
584 if (message == WM_POINTERDOWN) {
585 OnPointerDown(x, y, device_kind, touch_id, WM_LBUTTONDOWN, rotation,
586 pressure);
587 } else if (message == WM_POINTERUPDATE) {
588 OnPointerMove(x, y, device_kind, touch_id, rotation, pressure,
589 /* modifiers_state=*/0);
590 } else if (message == WM_POINTERUP) {
591 OnPointerUp(x, y, device_kind, touch_id, WM_LBUTTONUP);
592 // keep tracking the pointer (especially important for stylus)
593 // This allows a stylus to "hover" over the window
594 } else if (message == WM_POINTERLEAVE) {
595 OnPointerLeave(x, y, device_kind, touch_id);
596 touch_id_generator_.ReleaseNumber(pointerId);
597 }
598 }
599 break;
600 }
601 case WM_MOUSEMOVE:
602 device_kind = GetFlutterPointerDeviceKind();
603 if (device_kind == kFlutterPointerDeviceKindMouse) {
604 TrackMouseLeaveEvent(window_handle_);
605
606 x_pos = GET_X_LPARAM(lparam);
607 y_pos = GET_Y_LPARAM(lparam);
608 mouse_x_ = static_cast<double>(x_pos);
609 mouse_y_ = static_cast<double>(y_pos);
610
611 int mods = 0;
612 if (wparam & MK_CONTROL) {
613 mods |= kControl;
614 }
615 if (wparam & MK_SHIFT) {
616 mods |= kShift;
617 }
618 OnPointerMove(mouse_x_, mouse_y_, device_kind, kDefaultPointerDeviceId,
619 /*rotation=*/0, /*pressure=*/0, mods);
620 }
621 break;
622 case WM_MOUSELEAVE:
623 device_kind = GetFlutterPointerDeviceKind();
624 if (device_kind == kFlutterPointerDeviceKindMouse) {
625 OnPointerLeave(mouse_x_, mouse_y_, device_kind,
626 kDefaultPointerDeviceId);
627 }
628
629 // Once the tracked event is received, the TrackMouseEvent function
630 // resets. Set to false to make sure it's called once mouse movement is
631 // detected again.
632 tracking_mouse_leave_ = false;
633 break;
634 case WM_SETCURSOR: {
635 UINT hit_test_result = LOWORD(lparam);
636 if (hit_test_result == HTCLIENT) {
637 // Halt further processing to prevent DefWindowProc from setting the
638 // cursor back to the registered class cursor.
639 return TRUE;
640 }
641 break;
642 }
643 case WM_SETFOCUS:
644 OnWindowStateEvent(WindowStateEvent::kFocus);
645 ::CreateCaret(window_handle_, nullptr, 1, 1);
646 break;
647 case WM_KILLFOCUS:
648 OnWindowStateEvent(WindowStateEvent::kUnfocus);
649 ::DestroyCaret();
650 break;
651 case WM_LBUTTONDOWN:
652 case WM_RBUTTONDOWN:
653 case WM_MBUTTONDOWN:
654 case WM_XBUTTONDOWN:
655 device_kind = GetFlutterPointerDeviceKind();
656 if (device_kind != kFlutterPointerDeviceKindMouse) {
657 break;
658 }
659
660 if (message == WM_LBUTTONDOWN) {
661 // Capture the pointer in case the user drags outside the client area.
662 // In this case, the "mouse leave" event is delayed until the user
663 // releases the button. It's only activated on left click given that
664 // it's more common for apps to handle dragging with only the left
665 // button.
666 SetCapture(window_handle_);
667 }
668 button_pressed = message;
669 if (message == WM_XBUTTONDOWN) {
670 button_pressed = GET_XBUTTON_WPARAM(wparam);
671 }
672 x_pos = GET_X_LPARAM(lparam);
673 y_pos = GET_Y_LPARAM(lparam);
674 OnPointerDown(static_cast<double>(x_pos), static_cast<double>(y_pos),
675 device_kind, kDefaultPointerDeviceId, button_pressed,
676 /*rotation=*/0, /*pressure=*/0);
677 break;
678 case WM_LBUTTONUP:
679 case WM_RBUTTONUP:
680 case WM_MBUTTONUP:
681 case WM_XBUTTONUP:
682 device_kind = GetFlutterPointerDeviceKind();
683 if (device_kind != kFlutterPointerDeviceKindMouse) {
684 break;
685 }
686
687 if (message == WM_LBUTTONUP) {
688 ReleaseCapture();
689 }
690 button_pressed = message;
691 if (message == WM_XBUTTONUP) {
692 button_pressed = GET_XBUTTON_WPARAM(wparam);
693 }
694 x_pos = GET_X_LPARAM(lparam);
695 y_pos = GET_Y_LPARAM(lparam);
696 OnPointerUp(static_cast<double>(x_pos), static_cast<double>(y_pos),
697 device_kind, kDefaultPointerDeviceId, button_pressed);
698 break;
699 case WM_MOUSEWHEEL:
700 OnScroll(0.0,
701 -(static_cast<short>(HIWORD(wparam)) /
702 static_cast<double>(WHEEL_DELTA)),
703 kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
704 break;
705 case WM_MOUSEHWHEEL:
706 OnScroll((static_cast<short>(HIWORD(wparam)) /
707 static_cast<double>(WHEEL_DELTA)),
708 0.0, kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
709 break;
710 case WM_GETOBJECT: {
711 LRESULT lresult = OnGetObject(message, wparam, lparam);
712 if (lresult) {
713 return lresult;
714 }
715 break;
716 }
717 case WM_TIMER:
718 if (wparam == kDirectManipulationTimer) {
719 direct_manipulation_owner_->Update();
720 return 0;
721 }
722 break;
723 case DM_POINTERHITTEST: {
724 if (direct_manipulation_owner_) {
725 UINT contact_id = GET_POINTERID_WPARAM(wparam);
726 POINTER_INPUT_TYPE pointer_type;
727 if (windows_proc_table_->GetPointerType(contact_id, &pointer_type) &&
728 pointer_type == PT_TOUCHPAD) {
729 direct_manipulation_owner_->SetContact(contact_id);
730 }
731 }
732 break;
733 }
734 case WM_INPUTLANGCHANGE:
735 // TODO(cbracken): pass this to TextInputManager to aid with
736 // language-specific issues.
737 break;
738 case WM_IME_SETCONTEXT:
739 OnImeSetContext(message, wparam, lparam);
740 // Strip the ISC_SHOWUICOMPOSITIONWINDOW bit from lparam before passing
741 // it to DefWindowProc() so that the composition window is hidden since
742 // Flutter renders the composing string itself.
743 result_lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
744 break;
745 case WM_IME_STARTCOMPOSITION:
746 OnImeStartComposition(message, wparam, lparam);
747 // Suppress further processing by DefWindowProc() so that the default
748 // system IME style isn't used, but rather the one set in the
749 // WM_IME_SETCONTEXT handler.
750 return TRUE;
751 case WM_IME_COMPOSITION:
752 OnImeComposition(message, wparam, lparam);
753 if (lparam & GCS_RESULTSTR || lparam & GCS_COMPSTR) {
754 // Suppress further processing by DefWindowProc() since otherwise it
755 // will emit the result string as WM_CHAR messages on commit. Instead,
756 // committing the composing text to the EditableText string is handled
757 // in TextInputModel::CommitComposing, triggered by
758 // OnImeEndComposition().
759 return TRUE;
760 }
761 break;
762 case WM_IME_ENDCOMPOSITION:
763 OnImeEndComposition(message, wparam, lparam);
764 return TRUE;
765 case WM_IME_REQUEST:
766 OnImeRequest(message, wparam, lparam);
767 break;
768 case WM_UNICHAR: {
769 // Tell third-pary app, we can support Unicode.
770 if (wparam == UNICODE_NOCHAR)
771 return TRUE;
772 // DefWindowProc will send WM_CHAR for this WM_UNICHAR.
773 break;
774 }
775 case WM_THEMECHANGED:
776 OnThemeChange();
777 break;
778 case WM_DEADCHAR:
779 case WM_SYSDEADCHAR:
780 case WM_CHAR:
781 case WM_SYSCHAR:
782 case WM_KEYDOWN:
783 case WM_SYSKEYDOWN:
784 case WM_KEYUP:
785 case WM_SYSKEYUP:
786 if (keyboard_manager_->HandleMessage(message, wparam, lparam)) {
787 return 0;
788 }
789 break;
790 }
791
792 return Win32DefWindowProc(window_handle_, message, wparam, result_lparam);
793 }
flutter::FlutterWindow::OnPointerMove
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint32_t rotation, uint32_t pressure, int modifiers_state)
Definition: flutter_window.cc:168
flutter::FlutterWindow::OnPointerLeave
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
Definition: flutter_window.cc:208
flutter::FlutterWindow::OnThemeChange
virtual void OnThemeChange()
Definition: flutter_window.cc:326
flutter::FlutterWindow::OnPointerDown
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button, uint32_t rotation, uint32_t pressure)
Definition: flutter_window.cc:179
flutter::FlutterWindow::OnImeRequest
virtual void OnImeRequest(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:908
flutter::FlutterWindow::Win32DefWindowProc
virtual LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: flutter_window.cc:940
flutter::FlutterWindow::OnImeStartComposition
virtual void OnImeStartComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:859
flutter::FlutterWindow::OnScroll
virtual void OnScroll(double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
Definition: flutter_window.cc:251
flutter::FlutterWindow::OnPointerUp
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
Definition: flutter_window.cc:195
flutter::FlutterWindow::OnPaint
virtual void OnPaint()
Definition: flutter_window.cc:162
flutter::FlutterWindow::direct_manipulation_owner_
std::unique_ptr< DirectManipulationOwner > direct_manipulation_owner_
Definition: flutter_window.h:285
flutter::FlutterWindow::OnImeSetContext
virtual void OnImeSetContext(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:851
flutter::FlutterWindow::OnWindowStateEvent
virtual void OnWindowStateEvent(WindowStateEvent event)
Definition: flutter_window.cc:344
flutter::FlutterWindow::OnImeComposition
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:866
flutter::FlutterWindow::OnDpiScale
virtual void OnDpiScale(unsigned int dpi)
Definition: flutter_window.cc:152
flutter::FlutterWindow::OnGetObject
virtual LRESULT OnGetObject(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:795
flutter::FlutterWindow::OnImeEndComposition
virtual void OnImeEndComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
Definition: flutter_window.cc:901
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 413 of file flutter_window.cc.

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

References direct_manipulation_owner_, message, and NarrowToWide().

Referenced by FlutterWindow().

## ◆ NarrowToWide()

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

Definition at line 470 of file flutter_window.cc.

470 {
471 size_t length = strlen(source);
472 size_t outlen = 0;
473 std::wstring wideTitle(length, L'#');
474 mbstowcs_s(&outlen, &wideTitle[0], length + 1, source, length);
475 return wideTitle;
476 }

Referenced by InitializeChild().

## ◆ OnBitmapSurfaceCleared()

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

Implements flutter::WindowBindingHandler.

Definition at line 276 of file flutter_window.cc.

276 {
277 HDC dc = ::GetDC(GetWindowHandle());
278 bool result = ::PatBlt(dc, 0, 0, current_width_, current_height_, BLACKNESS);
279 ::ReleaseDC(GetWindowHandle(), dc);
280 return result;
281 }

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 283 of file flutter_window.cc.

285 {
286 HDC dc = ::GetDC(GetWindowHandle());
287 BITMAPINFO bmi = {};
288 bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
289 bmi.bmiHeader.biWidth = row_bytes / 4;
290 bmi.bmiHeader.biHeight = -height;
291 bmi.bmiHeader.biPlanes = 1;
292 bmi.bmiHeader.biBitCount = 32;
293 bmi.bmiHeader.biCompression = BI_RGB;
294 bmi.bmiHeader.biSizeImage = 0;
295 int ret = ::SetDIBitsToDevice(dc, 0, 0, row_bytes / 4, height, 0, 0, 0,
296 height, allocation, &bmi, DIB_RGB_COLORS);
297 ::ReleaseDC(GetWindowHandle(), dc);
298 return ret != 0;
299 }

References GetWindowHandle().

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

## ◆ OnComposeBegin()

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

Definition at line 230 of file flutter_window.cc.

230 {
231 binding_handler_delegate_->OnComposeBegin();
232 }
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 242 of file flutter_window.cc.

243 {
244 binding_handler_delegate_->OnComposeChange(text, cursor_pos);
245 }
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 234 of file flutter_window.cc.

234 {
235 binding_handler_delegate_->OnComposeCommit();
236 }
flutter::WindowBindingHandlerDelegate::OnComposeCommit
virtual void OnComposeCommit()=0

References flutter::WindowBindingHandlerDelegate::OnComposeCommit().

Referenced by OnImeComposition().

## ◆ OnComposeEnd()

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

Definition at line 238 of file flutter_window.cc.

238 {
239 binding_handler_delegate_->OnComposeEnd();
240 }
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 264 of file flutter_window.cc.

264 {
265 // Convert the rect from Flutter logical coordinates to device coordinates.
266 auto scale = GetDpiScale();
267 Point origin(rect.left() * scale, rect.top() * scale);
268 Size size(rect.width() * scale, rect.height() * scale);
269 UpdateCursorRect(Rect(origin, size));
270 }
flutter::FlutterWindow::UpdateCursorRect
virtual void UpdateCursorRect(const Rect &rect)
Definition: flutter_window.cc:920
flutter::FlutterWindow::GetDpiScale
virtual float GetDpiScale() override
Definition: flutter_window.cc:130

References GetDpiScale(), and UpdateCursorRect().

## ◆ OnDpiScale()

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

Definition at line 152 of file flutter_window.cc.

152 {};

## ◆ OnGetObject()

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

Definition at line 795 of file flutter_window.cc.

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

References GetNativeViewAccessible(), and OnUpdateSemanticsEnabled().

## ◆ OnImeComposition()

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

Definition at line 866 of file flutter_window.cc.

868 {
869 // Update the IME window position.
870 text_input_manager_->UpdateImeWindow();
871
872 if (lparam == 0) {
873 OnComposeChange(u"", 0);
874 OnComposeCommit();
875 }
876
877 // Process GCS_RESULTSTR at fisrt, because Google Japanese Input and ATOK
878 // send both GCS_RESULTSTR and GCS_COMPSTR to commit composed text and send
879 // new composing text.
880 if (lparam & GCS_RESULTSTR) {
881 // Commit but don't end composing.
882 // Read the committed composing string.
883 long pos = text_input_manager_->GetComposingCursorPosition();
884 std::optional<std::u16string> text = text_input_manager_->GetResultString();
885 if (text) {
886 OnComposeChange(text.value(), pos);
887 OnComposeCommit();
888 }
889 }
890 if (lparam & GCS_COMPSTR) {
891 // Read the in-progress composing string.
892 long pos = text_input_manager_->GetComposingCursorPosition();
893 std::optional<std::u16string> text =
894 text_input_manager_->GetComposingString();
895 if (text) {
896 OnComposeChange(text.value(), pos);
897 }
898 }
899 }
flutter::FlutterWindow::OnComposeCommit
virtual void OnComposeCommit()
Definition: flutter_window.cc:234
flutter::FlutterWindow::OnComposeChange
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)
Definition: flutter_window.cc:242

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

## ◆ OnImeEndComposition()

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

Definition at line 901 of file flutter_window.cc.

903 {
904 text_input_manager_->DestroyImeWindow();
905 OnComposeEnd();
906 }
flutter::FlutterWindow::OnComposeEnd
virtual void OnComposeEnd()
Definition: flutter_window.cc:238

References OnComposeEnd().

## ◆ OnImeRequest()

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

Definition at line 908 of file flutter_window.cc.

910 {
911 // TODO(cbracken): Handle IMR_RECONVERTSTRING, IMR_DOCUMENTFEED,
912 // and IMR_QUERYCHARPOSITION messages.
913 // https://github.com/flutter/flutter/issues/74547
914 }

## ◆ OnImeSetContext()

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

Definition at line 851 of file flutter_window.cc.

853 {
854 if (wparam != 0) {
855 text_input_manager_->CreateImeWindow();
856 }
857 }

## ◆ OnImeStartComposition()

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

Definition at line 859 of file flutter_window.cc.

861 {
862 text_input_manager_->CreateImeWindow();
863 OnComposeBegin();
864 }
flutter::FlutterWindow::OnComposeBegin
virtual void OnComposeBegin()
Definition: flutter_window.cc:230

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 219 of file flutter_window.cc.

225 {
226 binding_handler_delegate_->OnKey(key, scancode, action, character, extended,
227 was_down, std::move(callback));
228 }
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 162 of file flutter_window.cc.

162 {
163 if (binding_handler_delegate_ != nullptr) {
164 binding_handler_delegate_->OnWindowRepaint();
165 }
166 }
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,
|  | uint32_t | rotation,
|  | uint32_t | pressure
| ) |  |
| virtual

Definition at line 179 of file flutter_window.cc.

185 {
186 uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
187 if (flutter_button != 0) {
188 binding_handler_delegate_->OnPointerDown(
189 x, y, device_kind, device_id,
190 static_cast<FlutterPointerMouseButtons>(flutter_button), rotation,
191 pressure);
192 }
193 }
flutter::WindowBindingHandlerDelegate::OnPointerDown
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button, uint32_t rotation, uint32_t pressure)=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 208 of file flutter_window.cc.

211 {
212 binding_handler_delegate_->OnPointerLeave(x, y, device_kind, device_id);
213 }
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,
|  | uint32_t | rotation,
|  | uint32_t | pressure,
|  | int | modifiers_state
| ) |  |
| virtual

Definition at line 168 of file flutter_window.cc.

174 {
175 binding_handler_delegate_->OnPointerMove(x, y, device_kind, device_id,
176 rotation, pressure, modifiers_state);
177 }
flutter::WindowBindingHandlerDelegate::OnPointerMove
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint32_t rotation, uint32_t pressure, 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 195 of file flutter_window.cc.

199 {
200 uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
201 if (flutter_button != 0) {
202 binding_handler_delegate_->OnPointerUp(
203 x, y, device_kind, device_id,
204 static_cast<FlutterPointerMouseButtons>(flutter_button));
205 }
206 }
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 272 of file flutter_window.cc.

272 {
273 AbortImeComposing();
274 }
flutter::FlutterWindow::AbortImeComposing
virtual void AbortImeComposing()
Definition: flutter_window.cc:916

References AbortImeComposing().

## ◆ OnResize()

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

Definition at line 156 of file flutter_window.cc.

156 {
157 if (binding_handler_delegate_ != nullptr) {
158 binding_handler_delegate_->OnWindowSizeChanged(width, height);
159 }
160 }
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 251 of file flutter_window.cc.

254 {
255 POINT point;
256 GetCursorPos(&point);
257
258 ScreenToClient(GetWindowHandle(), &point);
259 binding_handler_delegate_->OnScroll(point.x, point.y, delta_x, delta_y,
260 GetScrollOffsetMultiplier(), device_kind,
261 device_id);
262 }
flutter::FlutterWindow::GetScrollOffsetMultiplier
virtual float GetScrollOffsetMultiplier()
Definition: flutter_window.cc:936
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().

## ◆ OnText()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 215 of file flutter_window.cc.

215 {
216 binding_handler_delegate_->OnText(text);
217 }
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 326 of file flutter_window.cc.

326 {
327 binding_handler_delegate_->OnHighContrastChanged();
328 }
flutter::WindowBindingHandlerDelegate::OnHighContrastChanged
virtual void OnHighContrastChanged()=0

References flutter::WindowBindingHandlerDelegate::OnHighContrastChanged().

## ◆ OnUpdateSemanticsEnabled()

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

Definition at line 247 of file flutter_window.cc.

247 {
248 binding_handler_delegate_->OnUpdateSemanticsEnabled(enabled);
249 }
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 344 of file flutter_window.cc.

344 {
345 switch (event) {
346 case WindowStateEvent::kShow:
347 restored_ = true;
348 break;
349 case WindowStateEvent::kHide:
350 restored_ = false;
351 focused_ = false;
352 break;
353 case WindowStateEvent::kFocus:
354 focused_ = true;
355 if (binding_handler_delegate_) {
356 binding_handler_delegate_->OnFocus(
357 FlutterViewFocusState::kFocused,
358 FlutterViewFocusDirection::kUndefined);
359 }
360 break;
361 case WindowStateEvent::kUnfocus:
362 focused_ = false;
363 if (binding_handler_delegate_) {
364 binding_handler_delegate_->OnFocus(
365 FlutterViewFocusState::kUnfocused,
366 FlutterViewFocusDirection::kUndefined);
367 }
368 break;
369 }
370 HWND hwnd = GetWindowHandle();
371 if (hwnd && binding_handler_delegate_) {
372 binding_handler_delegate_->OnWindowStateEvent(hwnd, event);
373 }
374 }
flutter::WindowBindingHandlerDelegate::OnWindowStateEvent
virtual void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)=0
flutter::WindowBindingHandlerDelegate::OnFocus
virtual void OnFocus(FlutterViewFocusState focus_state, FlutterViewFocusDirection direction)=0

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

Referenced by SetView().

## ◆ SetView()

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

Implements flutter::WindowBindingHandler.

Definition at line 117 of file flutter_window.cc.

117 {
118 binding_handler_delegate_ = window;
119 if (direct_manipulation_owner_) {
120 direct_manipulation_owner_->SetBindingHandlerDelegate(window);
121 }
122 if (restored_ && window) {
123 OnWindowStateEvent(WindowStateEvent::kShow);
124 }
125 if (focused_ && window) {
126 OnWindowStateEvent(WindowStateEvent::kFocus);
127 }
128 }

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 920 of file flutter_window.cc.

920 {
921 text_input_manager_->UpdateCaretRect(rect);
922 }

Referenced by OnCursorRectUpdated().

## ◆ Win32DefWindowProc()

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

Definition at line 940 of file flutter_window.cc.

943 {
944 return ::DefWindowProc(hWnd, Msg, wParam, lParam);
945 }

## ◆ Win32DispatchMessage()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 464 of file flutter_window.cc.

466 {
467 return ::SendMessage(window_handle_, Msg, wParam, lParam);
468 }

## ◆ Win32MapVkToChar()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 460 of file flutter_window.cc.

460 {
461 return ::MapVirtualKey(virtual_key, MAPVK_VK_TO_CHAR);
462 }

## ◆ Win32PeekMessage()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 452 of file flutter_window.cc.

455 {
456 return ::PeekMessage(lpMsg, window_handle_, wMsgFilterMin, wMsgFilterMax,
457 wRemoveMsg);
458 }

## Friends And Related Function Documentation

## ◆ WindowAXFragmentRootDelegate

friend class WindowAXFragmentRootDelegate
| friend

Definition at line 389 of file flutter_window.h.

## Member Data Documentation

## ◆ alert_delegate_

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

Definition at line 278 of file flutter_window.h.

Referenced by GetAlertDelegate().

## ◆ alert_node_

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

Definition at line 281 of file flutter_window.h.

Referenced by GetAlert().

## ◆ direct_manipulation_owner_

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

Definition at line 285 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