Flutter Windows Embedder
flutter::FlutterWindow Class Reference

#include <flutter_window.h>

Inheritance diagram for flutter::FlutterWindow:
flutter::KeyboardManager::WindowDelegate flutter::WindowBindingHandler

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, uint64_t buttons, uint32_t rotation, uint32_t pressure, int modifiers_state)
 
virtual void OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, uint32_t rotation, uint32_t pressure)
 
virtual void OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons)
 
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 151 of file flutter_window.cc.

157  : touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId),
158  display_manager_(display_manager),
159  windows_proc_table_(std::move(windows_proc_table)),
160  text_input_manager_(std::move(text_input_manager)),
161  ax_fragment_root_(nullptr) {
162  // Get the DPI of the primary monitor as the initial DPI. If Per-Monitor V2 is
163  // supported, |current_dpi_| should be updated in the
164  // kWmDpiChangedBeforeParent message.
165  current_dpi_ = GetDpiForHWND(nullptr);
166 
167  // Get initial value for wheel scroll lines
168  // TODO: Listen to changes for this value
169  // https://github.com/flutter/flutter/issues/107248
170  UpdateScrollOffsetMultiplier();
171 
172  if (windows_proc_table_ == nullptr) {
173  windows_proc_table_ = std::make_unique<WindowsProcTable>();
174  }
175  if (text_input_manager_ == nullptr) {
176  text_input_manager_ = std::make_unique<TextInputManager>();
177  }
178  keyboard_manager_ = std::make_unique<KeyboardManager>(this);
179 
180  InitializeChild("FLUTTERVIEW", width, height);
181 }
void InitializeChild(const char *title, unsigned int width, unsigned int height)
const DisplayManagerWin32 * display_manager
UINT GetDpiForHWND(HWND hwnd)
Definition: dpi_utils.cc:128

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

◆ ~FlutterWindow()

flutter::FlutterWindow::~FlutterWindow ( )
virtual

Definition at line 187 of file flutter_window.cc.

187  {
188  Destroy();
189 }

◆ FlutterWindow() [2/2]

flutter::FlutterWindow::FlutterWindow ( )
protected

Definition at line 184 of file flutter_window.cc.

185  : touch_id_generator_(kMinTouchDeviceId, kMaxTouchDeviceId) {}

Member Function Documentation

◆ AbortImeComposing()

void flutter::FlutterWindow::AbortImeComposing ( )
protectedvirtual

Definition at line 1023 of file flutter_window.cc.

1023  {
1024  text_input_manager_->AbortComposing();
1025 }

Referenced by OnResetImeComposing().

◆ Focus()

bool flutter::FlutterWindow::Focus ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 212 of file flutter_window.cc.

212  {
213  auto hwnd = GetWindowHandle();
214  if (hwnd == nullptr) {
215  return false;
216  }
217 
218  HWND prevFocus = ::SetFocus(hwnd);
219  if (prevFocus == nullptr) {
220  return false;
221  }
222 
223  return true;
224 }
virtual HWND GetWindowHandle() override

References GetWindowHandle().

◆ GetAlert()

ui::AXPlatformNodeWin * flutter::FlutterWindow::GetAlert ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 407 of file flutter_window.cc.

407  {
408  CreateAxFragmentRoot();
409  return alert_node_.get();
410 }
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_

References alert_node_.

◆ GetAlertDelegate()

AlertPlatformNodeDelegate * flutter::FlutterWindow::GetAlertDelegate ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 402 of file flutter_window.cc.

402  {
403  CreateAxFragmentRoot();
404  return alert_delegate_.get();
405 }
std::unique_ptr< AlertPlatformNodeDelegate > alert_delegate_

References alert_delegate_.

◆ GetAxFragmentRootDelegate()

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

Definition at line 398 of file flutter_window.cc.

398  {
399  return binding_handler_delegate_->GetAxFragmentRootDelegate();
400 }
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()=0

References flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate().

◆ GetCurrentDPI()

UINT flutter::FlutterWindow::GetCurrentDPI ( )
protected

Definition at line 1031 of file flutter_window.cc.

1031  {
1032  return current_dpi_;
1033 }

Referenced by GetDpiScale().

◆ GetCurrentHeight()

UINT flutter::FlutterWindow::GetCurrentHeight ( )
protected

Definition at line 1039 of file flutter_window.cc.

1039  {
1040  return current_height_;
1041 }

Referenced by GetPhysicalWindowBounds().

◆ GetCurrentWidth()

UINT flutter::FlutterWindow::GetCurrentWidth ( )
protected

Definition at line 1035 of file flutter_window.cc.

1035  {
1036  return current_width_;
1037 }

Referenced by GetPhysicalWindowBounds().

◆ GetDisplayId()

FlutterEngineDisplayId flutter::FlutterWindow::GetDisplayId ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 384 of file flutter_window.cc.

384  {
385  FlutterEngineDisplayId const display_id =
386  reinterpret_cast<FlutterEngineDisplayId>(
387  MonitorFromWindow(GetWindowHandle(), MONITOR_DEFAULTTONEAREST));
388  if (!display_manager_->FindById(display_id)) {
389  FML_LOG(ERROR) << "Current monitor not found in display list.";
390  }
391  return display_id;
392 }

References GetWindowHandle().

◆ GetDpiScale()

float flutter::FlutterWindow::GetDpiScale ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 204 of file flutter_window.cc.

204  {
205  return static_cast<float>(GetCurrentDPI()) / static_cast<float>(base_dpi);
206 }

References GetCurrentDPI().

Referenced by OnCursorRectUpdated().

◆ GetNativeViewAccessible()

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

Definition at line 369 of file flutter_window.cc.

369  {
370  if (binding_handler_delegate_ == nullptr) {
371  return nullptr;
372  }
373 
374  return binding_handler_delegate_->GetNativeViewAccessible();
375 }
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0

References flutter::WindowBindingHandlerDelegate::GetNativeViewAccessible().

Referenced by OnGetObject().

◆ GetPhysicalWindowBounds()

PhysicalWindowBounds flutter::FlutterWindow::GetPhysicalWindowBounds ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 208 of file flutter_window.cc.

208  {
209  return {GetCurrentWidth(), GetCurrentHeight()};
210 }

References GetCurrentHeight(), and GetCurrentWidth().

◆ GetPrimaryPointerLocation()

PointerLocation flutter::FlutterWindow::GetPrimaryPointerLocation ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 377 of file flutter_window.cc.

377  {
378  POINT point;
379  GetCursorPos(&point);
380  ScreenToClient(GetWindowHandle(), &point);
381  return {(size_t)point.x, (size_t)point.y};
382 }

References GetWindowHandle().

◆ GetScrollOffsetMultiplier()

float flutter::FlutterWindow::GetScrollOffsetMultiplier ( )
protectedvirtual

Definition at line 1043 of file flutter_window.cc.

1043  {
1044  return scroll_offset_multiplier_;
1045 }

Referenced by OnScroll().

◆ GetWindowHandle()

HWND flutter::FlutterWindow::GetWindowHandle ( )
overridevirtual

◆ HandleMessage()

LRESULT flutter::FlutterWindow::HandleMessage ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectednoexcept

Definition at line 584 of file flutter_window.cc.

586  {
587  LPARAM result_lparam = lparam;
588  int x_pos = 0, y_pos = 0;
589  UINT width = 0, height = 0;
590  UINT button_pressed = 0;
591  uint64_t flutter_button = 0;
592  FlutterPointerDeviceKind device_kind;
593 
594  switch (message) {
595  case kWmDpiChangedBeforeParent:
596  current_dpi_ = GetDpiForHWND(window_handle_);
597  OnDpiScale(current_dpi_);
598  return 0;
599  case WM_SIZE:
600  width = LOWORD(lparam);
601  height = HIWORD(lparam);
602 
603  current_width_ = width;
604  current_height_ = height;
605  HandleResize(width, height);
606 
607  OnWindowStateEvent(width == 0 && height == 0 ? WindowStateEvent::kHide
609  break;
610  case WM_PAINT:
611  OnPaint();
612  break;
613  case WM_POINTERDOWN:
614  case WM_POINTERUPDATE:
615  case WM_POINTERUP:
616  case WM_POINTERLEAVE: {
617  POINT pt = {GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam)};
618  ScreenToClient(window_handle_, &pt);
619  auto const x = static_cast<double>(pt.x);
620  auto const y = static_cast<double>(pt.y);
621  auto const pointerId = GET_POINTERID_WPARAM(wparam);
622  POINTER_INFO pointerInfo;
623  if (windows_proc_table_->GetPointerInfo(pointerId, &pointerInfo)) {
624  UINT32 pressure = 0;
625  UINT32 rotation = 0;
626  bool is_inverted = false;
627  flutter_button =
628  ConvertWinPointerFlagsToFlutterButtons(pointerInfo.pointerFlags);
629  if (pointerInfo.pointerType == PT_PEN) {
630  POINTER_PEN_INFO penInfo;
631  if (windows_proc_table_->GetPointerPenInfo(pointerId, &penInfo)) {
632  pressure = penInfo.pressure;
633  rotation = penInfo.rotation;
634  is_inverted = (penInfo.penFlags & PEN_FLAG_INVERTED) != 0;
635  flutter_button = ConvertWinStylusFlagsToFlutterButtons(
636  penInfo.penFlags, pointerInfo.pointerFlags);
637  }
638  }
639  auto touch_id = touch_id_generator_.GetGeneratedId(pointerId);
640  FlutterPointerDeviceKind device_kind = kFlutterPointerDeviceKindMouse;
641  switch (pointerInfo.pointerType) {
642  case PT_TOUCH:
643  device_kind = kFlutterPointerDeviceKindTouch;
644  break;
645  case PT_PEN:
646  device_kind = is_inverted ? kFlutterPointerDeviceKindInvertedStylus
647  : kFlutterPointerDeviceKindStylus;
648  break;
649  case PT_MOUSE:
650  device_kind = kFlutterPointerDeviceKindMouse;
651  break;
652  case PT_TOUCHPAD:
653  device_kind = kFlutterPointerDeviceKindTrackpad;
654  break;
655  default:
656  FML_LOG(ERROR) << "Unrecognized device key "
657  << pointerInfo.pointerType;
658  break;
659  }
660  if (message == WM_POINTERDOWN) {
661  OnPointerDown(x, y, device_kind, touch_id, flutter_button, rotation,
662  pressure);
663  } else if (message == WM_POINTERUPDATE) {
664  OnPointerMove(x, y, device_kind, touch_id, flutter_button, rotation,
665  pressure,
666  /* modifiers_state=*/0);
667  } else if (message == WM_POINTERUP) {
668  OnPointerUp(x, y, device_kind, touch_id, flutter_button);
669  // keep tracking the pointer (especially important for stylus)
670  // This allows a stylus to "hover" over the window
671  } else if (message == WM_POINTERLEAVE) {
672  OnPointerLeave(x, y, device_kind, touch_id);
673  touch_id_generator_.ReleaseNumber(pointerId);
674  }
675  }
676  break;
677  }
678  case WM_MOUSEMOVE:
679  device_kind = GetFlutterPointerDeviceKind();
680  if (device_kind == kFlutterPointerDeviceKindMouse) {
681  TrackMouseLeaveEvent(window_handle_);
682 
683  x_pos = GET_X_LPARAM(lparam);
684  y_pos = GET_Y_LPARAM(lparam);
685  mouse_x_ = static_cast<double>(x_pos);
686  mouse_y_ = static_cast<double>(y_pos);
687 
688  int mods = 0;
689  if (wparam & MK_CONTROL) {
690  mods |= kControl;
691  }
692  if (wparam & MK_SHIFT) {
693  mods |= kShift;
694  }
695 
696  // Mouse move with mouse buttons pressed but current HWND does not have
697  // capture. This can happen when switching windows mid drag - windows
698  // will stop honoring current capture and starts sending WM_MOUSEMOVE
699  // to the HWND below cursor, but without sending a WM_(LRMX)BUTTONDOWN
700  // first. This would confuse pointer tracking in Flutter so it is better
701  // to ignore these events. This also matches behavior of other
702  // applications where drag like this is ignored despite the mouse
703  // capture being lost. https://github.com/flutter/flutter/issues/189583
704  auto buttons = ConvertWinMouseStateToFlutterButtons(wparam);
705  if (buttons != 0 && GetCapture() != window_handle_) {
706  break;
707  }
708 
709  OnPointerMove(mouse_x_, mouse_y_, device_kind, kDefaultPointerDeviceId,
710  buttons, /*rotation=*/0, /*pressure=*/0, mods);
711  }
712  break;
713  case WM_MOUSELEAVE:
714  device_kind = GetFlutterPointerDeviceKind();
715  if (device_kind == kFlutterPointerDeviceKindMouse) {
716  OnPointerLeave(mouse_x_, mouse_y_, device_kind,
717  kDefaultPointerDeviceId);
718  }
719 
720  // Once the tracked event is received, the TrackMouseEvent function
721  // resets. Set to false to make sure it's called once mouse movement is
722  // detected again.
723  tracking_mouse_leave_ = false;
724  break;
725  case WM_SETCURSOR: {
726  UINT hit_test_result = LOWORD(lparam);
727  if (hit_test_result == HTCLIENT) {
728  // Halt further processing to prevent DefWindowProc from setting the
729  // cursor back to the registered class cursor.
730  return TRUE;
731  }
732  break;
733  }
734  case WM_SETFOCUS:
736  ::CreateCaret(window_handle_, nullptr, 1, 1);
737  break;
738  case WM_KILLFOCUS:
740  ::DestroyCaret();
741  break;
742  case WM_LBUTTONDOWN:
743  case WM_RBUTTONDOWN:
744  case WM_MBUTTONDOWN:
745  case WM_XBUTTONDOWN:
746  device_kind = GetFlutterPointerDeviceKind();
747  if (device_kind != kFlutterPointerDeviceKindMouse) {
748  break;
749  }
750 
751  // Capture the pointer in case the user drags outside the client area.
752  // In this case, the "mouse leave" event is delayed until the user
753  // releases the button.
754  SetCapture(window_handle_);
755 
756  button_pressed = message;
757  if (message == WM_XBUTTONDOWN) {
758  button_pressed = GET_XBUTTON_WPARAM(wparam);
759  }
760  x_pos = GET_X_LPARAM(lparam);
761  y_pos = GET_Y_LPARAM(lparam);
762  flutter_button = ConvertWinButtonToFlutterButton(button_pressed);
763 
764  OnPointerDown(static_cast<double>(x_pos), static_cast<double>(y_pos),
765  device_kind, kDefaultPointerDeviceId, flutter_button,
766  /*rotation=*/0, /*pressure=*/0);
767  break;
768  case WM_LBUTTONUP:
769  case WM_RBUTTONUP:
770  case WM_MBUTTONUP:
771  case WM_XBUTTONUP:
772  device_kind = GetFlutterPointerDeviceKind();
773  if (device_kind != kFlutterPointerDeviceKindMouse) {
774  break;
775  }
776 
777  button_pressed = message;
778  if (message == WM_XBUTTONUP) {
779  button_pressed = GET_XBUTTON_WPARAM(wparam);
780  }
781  x_pos = GET_X_LPARAM(lparam);
782  y_pos = GET_Y_LPARAM(lparam);
783  flutter_button = ConvertWinButtonToFlutterButton(button_pressed);
784 
785  // WM_*BUTTONUP messages use wparam to report which buttons remain
786  // pressed after this event; release capture only after the last mouse
787  // button is released. WM_*BUTTONDOWN messages already identify the newly
788  // pressed button via the message itself.
789  // See:
790  // https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-lbuttonup
791  if ((wparam & (MK_LBUTTON | MK_RBUTTON | MK_MBUTTON | MK_XBUTTON1 |
792  MK_XBUTTON2)) == 0) {
793  ReleaseCapture();
794  }
795 
796  OnPointerUp(static_cast<double>(x_pos), static_cast<double>(y_pos),
797  device_kind, kDefaultPointerDeviceId, flutter_button);
798  break;
799  case WM_MOUSEWHEEL:
800  OnScroll(0.0,
801  -(static_cast<short>(HIWORD(wparam)) /
802  static_cast<double>(WHEEL_DELTA)),
803  kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
804  break;
805  case WM_MOUSEHWHEEL:
806  OnScroll((static_cast<short>(HIWORD(wparam)) /
807  static_cast<double>(WHEEL_DELTA)),
808  0.0, kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
809  break;
810  case WM_GETOBJECT: {
811  LRESULT lresult = OnGetObject(message, wparam, lparam);
812  if (lresult) {
813  return lresult;
814  }
815  break;
816  }
817  case WM_TIMER:
818  if (wparam == kDirectManipulationTimer) {
819  direct_manipulation_owner_->Update();
820  return 0;
821  }
822  break;
823  case DM_POINTERHITTEST: {
825  UINT contact_id = GET_POINTERID_WPARAM(wparam);
826  POINTER_INPUT_TYPE pointer_type;
827  if (windows_proc_table_->GetPointerType(contact_id, &pointer_type) &&
828  pointer_type == PT_TOUCHPAD) {
829  direct_manipulation_owner_->SetContact(contact_id);
830  }
831  }
832  break;
833  }
834  case WM_INPUTLANGCHANGE:
835  // TODO(cbracken): pass this to TextInputManager to aid with
836  // language-specific issues.
837  break;
838  case WM_IME_SETCONTEXT:
839  OnImeSetContext(message, wparam, lparam);
840  // Strip the ISC_SHOWUICOMPOSITIONWINDOW bit from lparam before passing
841  // it to DefWindowProc() so that the composition window is hidden since
842  // Flutter renders the composing string itself.
843  result_lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
844  break;
845  case WM_IME_STARTCOMPOSITION:
846  OnImeStartComposition(message, wparam, lparam);
847  // Suppress further processing by DefWindowProc() so that the default
848  // system IME style isn't used, but rather the one set in the
849  // WM_IME_SETCONTEXT handler.
850  return TRUE;
851  case WM_IME_COMPOSITION:
852  OnImeComposition(message, wparam, lparam);
853  if (lparam & GCS_RESULTSTR || lparam & GCS_COMPSTR) {
854  // Suppress further processing by DefWindowProc() since otherwise it
855  // will emit the result string as WM_CHAR messages on commit. Instead,
856  // committing the composing text to the EditableText string is handled
857  // in TextInputModel::CommitComposing, triggered by
858  // OnImeEndComposition().
859  return TRUE;
860  }
861  break;
862  case WM_IME_ENDCOMPOSITION:
863  OnImeEndComposition(message, wparam, lparam);
864  return TRUE;
865  case WM_IME_REQUEST:
866  OnImeRequest(message, wparam, lparam);
867  break;
868  case WM_UNICHAR: {
869  // Tell third-pary app, we can support Unicode.
870  if (wparam == UNICODE_NOCHAR)
871  return TRUE;
872  // DefWindowProc will send WM_CHAR for this WM_UNICHAR.
873  break;
874  }
875  case WM_THEMECHANGED:
876  OnThemeChange();
877  break;
878  case WM_DEADCHAR:
879  case WM_SYSDEADCHAR:
880  case WM_CHAR:
881  case WM_SYSCHAR:
882  case WM_KEYDOWN:
883  case WM_SYSKEYDOWN:
884  case WM_KEYUP:
885  case WM_SYSKEYUP:
886  if (keyboard_manager_->HandleMessage(message, wparam, lparam)) {
887  return 0;
888  }
889  // Prevent default proc for WM_SYSKEYUP which unfocuses the window
890  // and sends WM_MOUSELEAVE.
891  if (message == WM_SYSKEYUP) {
892  return 0;
893  }
894  break;
895  }
896 
897  return Win32DefWindowProc(window_handle_, message, wparam, result_lparam);
898 }
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
virtual void OnThemeChange()
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, uint32_t rotation, uint32_t pressure)
virtual void OnImeRequest(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, uint32_t rotation, uint32_t pressure, int modifiers_state)
virtual LRESULT Win32DefWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
virtual void OnImeStartComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons)
virtual void OnScroll(double delta_x, double delta_y, FlutterPointerDeviceKind device_kind, int32_t device_id)
std::unique_ptr< DirectManipulationOwner > direct_manipulation_owner_
virtual void OnImeSetContext(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnWindowStateEvent(WindowStateEvent event)
virtual void OnImeComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnDpiScale(unsigned int dpi)
virtual LRESULT OnGetObject(UINT const message, WPARAM const wparam, LPARAM const lparam)
virtual void OnImeEndComposition(UINT const message, WPARAM const wparam, LPARAM const lparam)
uint32_t GetGeneratedId(uint32_t number)
Win32Message message
constexpr int kShift
constexpr int kControl

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

483  {
484  Destroy();
485  std::wstring converted_title = NarrowToWide(title);
486 
487  WNDCLASS window_class = RegisterWindowClass(converted_title);
488 
489  auto* result = CreateWindowEx(
490  0, window_class.lpszClassName, converted_title.c_str(),
491  WS_CHILD | WS_VISIBLE, CW_DEFAULT, CW_DEFAULT, width, height,
492  HWND_MESSAGE, nullptr, window_class.hInstance, this);
493 
494  if (result == nullptr) {
495  auto error = GetLastError();
496  LPWSTR message = nullptr;
497  size_t size = FormatMessageW(
498  FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
499  FORMAT_MESSAGE_IGNORE_INSERTS,
500  NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
501  reinterpret_cast<LPWSTR>(&message), 0, NULL);
502  OutputDebugString(message);
503  LocalFree(message);
504  }
505  SetUserObjectInformationA(GetCurrentProcess(),
506  UOI_TIMERPROC_EXCEPTION_SUPPRESSION, FALSE, 1);
507  // SetTimer is not precise, if a 16 ms interval is requested, it will instead
508  // often fire in an interval of 32 ms. Providing a value of 14 will ensure it
509  // runs every 16 ms, which will allow for 60 Hz trackpad gesture events, which
510  // is the maximal frequency supported by SetTimer.
511  SetTimer(result, kDirectManipulationTimer, 14, nullptr);
512  direct_manipulation_owner_ = std::make_unique<DirectManipulationOwner>(this);
513  direct_manipulation_owner_->Init(width, height);
514 }
std::wstring NarrowToWide(const char *source)

References direct_manipulation_owner_, message, and NarrowToWide().

Referenced by FlutterWindow().

◆ NarrowToWide()

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

Definition at line 538 of file flutter_window.cc.

538  {
539  size_t length = strlen(source);
540  size_t outlen = 0;
541  std::wstring wideTitle(length, L'#');
542  mbstowcs_s(&outlen, &wideTitle[0], length + 1, source, length);
543  return wideTitle;
544 }

Referenced by InitializeChild().

◆ OnBitmapSurfaceCleared()

bool flutter::FlutterWindow::OnBitmapSurfaceCleared ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 344 of file flutter_window.cc.

344  {
345  HDC dc = ::GetDC(GetWindowHandle());
346  bool result = ::PatBlt(dc, 0, 0, current_width_, current_height_, BLACKNESS);
347  ::ReleaseDC(GetWindowHandle(), dc);
348  return result;
349 }

References GetWindowHandle().

◆ OnBitmapSurfaceUpdated()

bool flutter::FlutterWindow::OnBitmapSurfaceUpdated ( const void *  allocation,
size_t  row_bytes,
size_t  height 
)
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 351 of file flutter_window.cc.

353  {
354  HDC dc = ::GetDC(GetWindowHandle());
355  BITMAPINFO bmi = {};
356  bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
357  bmi.bmiHeader.biWidth = row_bytes / 4;
358  bmi.bmiHeader.biHeight = -height;
359  bmi.bmiHeader.biPlanes = 1;
360  bmi.bmiHeader.biBitCount = 32;
361  bmi.bmiHeader.biCompression = BI_RGB;
362  bmi.bmiHeader.biSizeImage = 0;
363  int ret = ::SetDIBitsToDevice(dc, 0, 0, row_bytes / 4, height, 0, 0, 0,
364  height, allocation, &bmi, DIB_RGB_COLORS);
365  ::ReleaseDC(GetWindowHandle(), dc);
366  return ret != 0;
367 }

References GetWindowHandle().

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

◆ OnComposeBegin()

void flutter::FlutterWindow::OnComposeBegin ( )
virtual

Definition at line 298 of file flutter_window.cc.

298  {
299  binding_handler_delegate_->OnComposeBegin();
300 }

References flutter::WindowBindingHandlerDelegate::OnComposeBegin().

Referenced by OnImeStartComposition().

◆ OnComposeChange()

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

Definition at line 310 of file flutter_window.cc.

311  {
312  binding_handler_delegate_->OnComposeChange(text, cursor_pos);
313 }
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)=0
std::u16string text

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

Referenced by OnImeComposition().

◆ OnComposeCommit()

void flutter::FlutterWindow::OnComposeCommit ( )
virtual

Definition at line 302 of file flutter_window.cc.

302  {
303  binding_handler_delegate_->OnComposeCommit();
304 }

References flutter::WindowBindingHandlerDelegate::OnComposeCommit().

Referenced by OnImeComposition().

◆ OnComposeEnd()

void flutter::FlutterWindow::OnComposeEnd ( )
virtual

Definition at line 306 of file flutter_window.cc.

306  {
307  binding_handler_delegate_->OnComposeEnd();
308 }

References flutter::WindowBindingHandlerDelegate::OnComposeEnd().

Referenced by OnImeEndComposition().

◆ OnCursorRectUpdated()

void flutter::FlutterWindow::OnCursorRectUpdated ( const Rect &  rect)
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 332 of file flutter_window.cc.

332  {
333  // Convert the rect from Flutter logical coordinates to device coordinates.
334  auto scale = GetDpiScale();
335  Point origin(rect.left() * scale, rect.top() * scale);
336  Size size(rect.width() * scale, rect.height() * scale);
337  UpdateCursorRect(Rect(origin, size));
338 }
virtual void UpdateCursorRect(const Rect &rect)
virtual float GetDpiScale() override

References GetDpiScale(), and UpdateCursorRect().

◆ OnDpiScale()

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

Definition at line 226 of file flutter_window.cc.

226 {};

◆ OnGetObject()

LRESULT flutter::FlutterWindow::OnGetObject ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectedvirtual

Definition at line 900 of file flutter_window.cc.

902  {
903  LRESULT reference_result = static_cast<LRESULT>(0L);
904 
905  // Only the lower 32 bits of lparam are valid when checking the object id
906  // because it sometimes gets sign-extended incorrectly (but not always).
907  DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(lparam));
908 
909  bool is_uia_request = static_cast<DWORD>(UiaRootObjectId) == obj_id;
910  bool is_msaa_request = static_cast<DWORD>(OBJID_CLIENT) == obj_id;
911 
912  if (is_uia_request || is_msaa_request) {
913  // On Windows, we don't get a notification that the screen reader has been
914  // enabled or disabled. There is an API to query for screen reader state,
915  // but that state isn't set by all screen readers, including by Narrator,
916  // the screen reader that ships with Windows:
917  // https://docs.microsoft.com/en-us/windows/win32/winauto/screen-reader-parameter
918  //
919  // Instead, we enable semantics in Flutter if Windows issues queries for
920  // Microsoft Active Accessibility (MSAA) COM objects.
922  }
923 
924  gfx::NativeViewAccessible root_view = GetNativeViewAccessible();
925  // TODO(schectman): UIA is currently disabled by default.
926  // https://github.com/flutter/flutter/issues/114547
927  if (root_view) {
928  CreateAxFragmentRoot();
929  if (is_uia_request) {
930 #ifdef FLUTTER_ENGINE_USE_UIA
931  // Retrieve UIA object for the root view.
932  Microsoft::WRL::ComPtr<IRawElementProviderSimple> root;
933  if (SUCCEEDED(
934  ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
935  IID_PPV_ARGS(&root)))) {
936  // Return the UIA object via UiaReturnRawElementProvider(). See:
937  // https://docs.microsoft.com/en-us/windows/win32/winauto/wm-getobject
938  reference_result = UiaReturnRawElementProvider(window_handle_, wparam,
939  lparam, root.Get());
940  } else {
941  FML_LOG(ERROR) << "Failed to query AX fragment root.";
942  }
943 #endif // FLUTTER_ENGINE_USE_UIA
944  } else if (is_msaa_request) {
945  // Create the accessibility root if it does not already exist.
946  // Return the IAccessible for the root view.
947  Microsoft::WRL::ComPtr<IAccessible> root;
948  ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
949  IID_PPV_ARGS(&root));
950  reference_result = LresultFromObject(IID_IAccessible, wparam, root.Get());
951  }
952  }
953  return reference_result;
954 }
virtual void OnUpdateSemanticsEnabled(bool enabled)
virtual gfx::NativeViewAccessible GetNativeViewAccessible()

References GetNativeViewAccessible(), and OnUpdateSemanticsEnabled().

◆ OnImeComposition()

void flutter::FlutterWindow::OnImeComposition ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectedvirtual

Definition at line 971 of file flutter_window.cc.

973  {
974  // Update the IME window position.
975  text_input_manager_->UpdateImeWindow();
976 
977  if (lparam == 0) {
978  OnComposeChange(u"", 0);
979  OnComposeCommit();
980  }
981 
982  // Process GCS_RESULTSTR at fisrt, because Google Japanese Input and ATOK
983  // send both GCS_RESULTSTR and GCS_COMPSTR to commit composed text and send
984  // new composing text.
985  if (lparam & GCS_RESULTSTR) {
986  // Commit but don't end composing.
987  // Read the committed composing string.
988  std::optional<std::u16string> text = text_input_manager_->GetResultString();
989  if (text) {
990  int pos = GetCursorPositionForComposition(*text_input_manager_, lparam,
991  text->length());
992  OnComposeChange(text.value(), pos);
993  OnComposeCommit();
994  }
995  }
996  if (lparam & GCS_COMPSTR) {
997  // Read the in-progress composing string.
998  std::optional<std::u16string> text =
999  text_input_manager_->GetComposingString();
1000  if (text) {
1001  int pos = GetCursorPositionForComposition(*text_input_manager_, lparam,
1002  text->length());
1003  OnComposeChange(text.value(), pos);
1004  }
1005  }
1006 }
virtual void OnComposeCommit()
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)

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

◆ OnImeEndComposition()

void flutter::FlutterWindow::OnImeEndComposition ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectedvirtual

Definition at line 1008 of file flutter_window.cc.

1010  {
1011  text_input_manager_->DestroyImeWindow();
1012  OnComposeEnd();
1013 }
virtual void OnComposeEnd()

References OnComposeEnd().

◆ OnImeRequest()

void flutter::FlutterWindow::OnImeRequest ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectedvirtual

Definition at line 1015 of file flutter_window.cc.

1017  {
1018  // TODO(cbracken): Handle IMR_RECONVERTSTRING, IMR_DOCUMENTFEED,
1019  // and IMR_QUERYCHARPOSITION messages.
1020  // https://github.com/flutter/flutter/issues/74547
1021 }

◆ OnImeSetContext()

void flutter::FlutterWindow::OnImeSetContext ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectedvirtual

Definition at line 956 of file flutter_window.cc.

958  {
959  if (wparam != 0) {
960  text_input_manager_->CreateImeWindow();
961  }
962 }

◆ OnImeStartComposition()

void flutter::FlutterWindow::OnImeStartComposition ( UINT const  message,
WPARAM const  wparam,
LPARAM const  lparam 
)
protectedvirtual

Definition at line 964 of file flutter_window.cc.

966  {
967  text_input_manager_->CreateImeWindow();
968  OnComposeBegin();
969 }
virtual void OnComposeBegin()

References OnComposeBegin().

◆ OnKey()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 287 of file flutter_window.cc.

293  {
294  binding_handler_delegate_->OnKey(key, scancode, action, character, extended,
295  was_down, std::move(callback));
296 }
virtual void OnKey(int key, int scancode, int action, char32_t character, bool extended, bool was_down, KeyEventCallback callback)=0
FlutterDesktopBinaryReply callback

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

◆ OnPaint()

void flutter::FlutterWindow::OnPaint ( )
virtual

Definition at line 236 of file flutter_window.cc.

236  {
237  if (binding_handler_delegate_ != nullptr) {
238  binding_handler_delegate_->OnWindowRepaint();
239  }
240 }

References flutter::WindowBindingHandlerDelegate::OnWindowRepaint().

◆ OnPointerDown()

void flutter::FlutterWindow::OnPointerDown ( double  x,
double  y,
FlutterPointerDeviceKind  device_kind,
int32_t  device_id,
uint64_t  buttons,
uint32_t  rotation,
uint32_t  pressure 
)
virtual

Definition at line 255 of file flutter_window.cc.

261  {
262  if (buttons != 0) {
263  binding_handler_delegate_->OnPointerDown(x, y, device_kind, device_id,
264  buttons, rotation, pressure);
265  }
266 }
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, 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 276 of file flutter_window.cc.

279  {
280  binding_handler_delegate_->OnPointerLeave(x, y, device_kind, device_id);
281 }
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,
uint64_t  buttons,
uint32_t  rotation,
uint32_t  pressure,
int  modifiers_state 
)
virtual

Definition at line 242 of file flutter_window.cc.

249  {
250  binding_handler_delegate_->OnPointerMove(x, y, device_kind, device_id,
251  buttons, rotation, pressure,
252  modifiers_state);
253 }
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons, 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,
uint64_t  buttons 
)
virtual

Definition at line 268 of file flutter_window.cc.

272  {
273  binding_handler_delegate_->OnPointerUp(x, y, device_kind, device_id, buttons);
274 }
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, uint64_t buttons)=0

References flutter::WindowBindingHandlerDelegate::OnPointerUp().

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

◆ OnResetImeComposing()

void flutter::FlutterWindow::OnResetImeComposing ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 340 of file flutter_window.cc.

340  {
342 }
virtual void AbortImeComposing()

References AbortImeComposing().

◆ OnResize()

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

Definition at line 230 of file flutter_window.cc.

230  {
231  if (binding_handler_delegate_ != nullptr) {
232  binding_handler_delegate_->OnWindowSizeChanged(width, height);
233  }
234 }
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 319 of file flutter_window.cc.

322  {
323  POINT point;
324  GetCursorPos(&point);
325 
326  ScreenToClient(GetWindowHandle(), &point);
327  binding_handler_delegate_->OnScroll(point.x, point.y, delta_x, delta_y,
328  GetScrollOffsetMultiplier(), device_kind,
329  device_id);
330 }
virtual float GetScrollOffsetMultiplier()
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)
overridevirtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 283 of file flutter_window.cc.

283  {
284  binding_handler_delegate_->OnText(text);
285 }
virtual void OnText(const std::u16string &)=0

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

◆ OnThemeChange()

void flutter::FlutterWindow::OnThemeChange ( )
virtual

Definition at line 394 of file flutter_window.cc.

394  {
395  binding_handler_delegate_->OnHighContrastChanged();
396 }

References flutter::WindowBindingHandlerDelegate::OnHighContrastChanged().

◆ OnUpdateSemanticsEnabled()

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

Definition at line 315 of file flutter_window.cc.

315  {
316  binding_handler_delegate_->OnUpdateSemanticsEnabled(enabled);
317 }
virtual void OnUpdateSemanticsEnabled(bool enabled)=0

References flutter::WindowBindingHandlerDelegate::OnUpdateSemanticsEnabled().

Referenced by OnGetObject().

◆ OnWindowStateEvent()

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

Definition at line 412 of file flutter_window.cc.

412  {
413  switch (event) {
415  restored_ = true;
416  break;
418  restored_ = false;
419  focused_ = false;
420  break;
422  focused_ = true;
423  if (binding_handler_delegate_) {
424  binding_handler_delegate_->OnFocus(
425  FlutterViewFocusState::kFocused,
426  FlutterViewFocusDirection::kUndefined);
427  }
428  break;
430  focused_ = false;
431  if (binding_handler_delegate_) {
432  binding_handler_delegate_->OnFocus(
433  FlutterViewFocusState::kUnfocused,
434  FlutterViewFocusDirection::kUndefined);
435  }
436  break;
437  }
438  HWND hwnd = GetWindowHandle();
439  if (hwnd && binding_handler_delegate_) {
440  binding_handler_delegate_->OnWindowStateEvent(hwnd, event);
441  }
442 }
virtual void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)=0
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)
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 191 of file flutter_window.cc.

191  {
192  binding_handler_delegate_ = window;
194  direct_manipulation_owner_->SetBindingHandlerDelegate(window);
195  }
196  if (restored_ && window) {
198  }
199  if (focused_ && window) {
201  }
202 }

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

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

◆ UpdateCursorRect()

void flutter::FlutterWindow::UpdateCursorRect ( const Rect &  rect)
protectedvirtual

Definition at line 1027 of file flutter_window.cc.

1027  {
1028  text_input_manager_->UpdateCaretRect(rect);
1029 }

Referenced by OnCursorRectUpdated().

◆ Win32DefWindowProc()

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

Definition at line 1047 of file flutter_window.cc.

1050  {
1051  return ::DefWindowProc(hWnd, Msg, wParam, lParam);
1052 }

◆ Win32DispatchMessage()

UINT flutter::FlutterWindow::Win32DispatchMessage ( UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)
overridevirtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 532 of file flutter_window.cc.

534  {
535  return ::SendMessage(window_handle_, Msg, wParam, lParam);
536 }

◆ Win32MapVkToChar()

uint32_t flutter::FlutterWindow::Win32MapVkToChar ( uint32_t  virtual_key)
overridevirtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 528 of file flutter_window.cc.

528  {
529  return ::MapVirtualKey(virtual_key, MAPVK_VK_TO_CHAR);
530 }

◆ Win32PeekMessage()

BOOL flutter::FlutterWindow::Win32PeekMessage ( LPMSG  lpMsg,
UINT  wMsgFilterMin,
UINT  wMsgFilterMax,
UINT  wRemoveMsg 
)
overridevirtual

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 520 of file flutter_window.cc.

523  {
524  return ::PeekMessage(lpMsg, window_handle_, wMsgFilterMin, wMsgFilterMax,
525  wRemoveMsg);
526 }

Friends And Related Function Documentation

◆ WindowAXFragmentRootDelegate

friend class WindowAXFragmentRootDelegate
friend

Definition at line 390 of file flutter_window.h.

Member Data Documentation

◆ alert_delegate_

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

Definition at line 279 of file flutter_window.h.

Referenced by GetAlertDelegate().

◆ alert_node_

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

Definition at line 282 of file flutter_window.h.

Referenced by GetAlert().

◆ direct_manipulation_owner_

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

Definition at line 286 of file flutter_window.h.

Referenced by InitializeChild(), and SetView().


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