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 AlertPlatformNodeDelegateGetAlertDelegate () 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< AlertPlatformNodeDelegatealert_delegate_
 
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_
 
std::unique_ptr< DirectManipulationOwnerdirect_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 1005 of file flutter_window.cc.

1005  {
1006  text_input_manager_->AbortComposing();
1007 }

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

1013  {
1014  return current_dpi_;
1015 }

Referenced by GetDpiScale().

◆ GetCurrentHeight()

UINT flutter::FlutterWindow::GetCurrentHeight ( )
protected

Definition at line 1021 of file flutter_window.cc.

1021  {
1022  return current_height_;
1023 }

Referenced by GetPhysicalWindowBounds().

◆ GetCurrentWidth()

UINT flutter::FlutterWindow::GetCurrentWidth ( )
protected

Definition at line 1017 of file flutter_window.cc.

1017  {
1018  return current_width_;
1019 }

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

1025  {
1026  return scroll_offset_multiplier_;
1027 }

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  OnPointerMove(mouse_x_, mouse_y_, device_kind, kDefaultPointerDeviceId,
696  ConvertWinMouseStateToFlutterButtons(wparam),
697  /*rotation=*/0, /*pressure=*/0, mods);
698  }
699  break;
700  case WM_MOUSELEAVE:
701  device_kind = GetFlutterPointerDeviceKind();
702  if (device_kind == kFlutterPointerDeviceKindMouse) {
703  OnPointerLeave(mouse_x_, mouse_y_, device_kind,
704  kDefaultPointerDeviceId);
705  }
706 
707  // Once the tracked event is received, the TrackMouseEvent function
708  // resets. Set to false to make sure it's called once mouse movement is
709  // detected again.
710  tracking_mouse_leave_ = false;
711  break;
712  case WM_SETCURSOR: {
713  UINT hit_test_result = LOWORD(lparam);
714  if (hit_test_result == HTCLIENT) {
715  // Halt further processing to prevent DefWindowProc from setting the
716  // cursor back to the registered class cursor.
717  return TRUE;
718  }
719  break;
720  }
721  case WM_SETFOCUS:
723  ::CreateCaret(window_handle_, nullptr, 1, 1);
724  break;
725  case WM_KILLFOCUS:
727  ::DestroyCaret();
728  break;
729  case WM_LBUTTONDOWN:
730  case WM_RBUTTONDOWN:
731  case WM_MBUTTONDOWN:
732  case WM_XBUTTONDOWN:
733  device_kind = GetFlutterPointerDeviceKind();
734  if (device_kind != kFlutterPointerDeviceKindMouse) {
735  break;
736  }
737 
738  if (message == WM_LBUTTONDOWN) {
739  // Capture the pointer in case the user drags outside the client area.
740  // In this case, the "mouse leave" event is delayed until the user
741  // releases the button. It's only activated on left click given that
742  // it's more common for apps to handle dragging with only the left
743  // button.
744  SetCapture(window_handle_);
745  }
746  button_pressed = message;
747  if (message == WM_XBUTTONDOWN) {
748  button_pressed = GET_XBUTTON_WPARAM(wparam);
749  }
750  x_pos = GET_X_LPARAM(lparam);
751  y_pos = GET_Y_LPARAM(lparam);
752  flutter_button = ConvertWinButtonToFlutterButton(button_pressed);
753 
754  OnPointerDown(static_cast<double>(x_pos), static_cast<double>(y_pos),
755  device_kind, kDefaultPointerDeviceId, flutter_button,
756  /*rotation=*/0, /*pressure=*/0);
757  break;
758  case WM_LBUTTONUP:
759  case WM_RBUTTONUP:
760  case WM_MBUTTONUP:
761  case WM_XBUTTONUP:
762  device_kind = GetFlutterPointerDeviceKind();
763  if (device_kind != kFlutterPointerDeviceKindMouse) {
764  break;
765  }
766 
767  if (message == WM_LBUTTONUP) {
768  ReleaseCapture();
769  }
770  button_pressed = message;
771  if (message == WM_XBUTTONUP) {
772  button_pressed = GET_XBUTTON_WPARAM(wparam);
773  }
774  x_pos = GET_X_LPARAM(lparam);
775  y_pos = GET_Y_LPARAM(lparam);
776  flutter_button = ConvertWinButtonToFlutterButton(button_pressed);
777 
778  OnPointerUp(static_cast<double>(x_pos), static_cast<double>(y_pos),
779  device_kind, kDefaultPointerDeviceId, flutter_button);
780  break;
781  case WM_MOUSEWHEEL:
782  OnScroll(0.0,
783  -(static_cast<short>(HIWORD(wparam)) /
784  static_cast<double>(WHEEL_DELTA)),
785  kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
786  break;
787  case WM_MOUSEHWHEEL:
788  OnScroll((static_cast<short>(HIWORD(wparam)) /
789  static_cast<double>(WHEEL_DELTA)),
790  0.0, kFlutterPointerDeviceKindMouse, kDefaultPointerDeviceId);
791  break;
792  case WM_GETOBJECT: {
793  LRESULT lresult = OnGetObject(message, wparam, lparam);
794  if (lresult) {
795  return lresult;
796  }
797  break;
798  }
799  case WM_TIMER:
800  if (wparam == kDirectManipulationTimer) {
801  direct_manipulation_owner_->Update();
802  return 0;
803  }
804  break;
805  case DM_POINTERHITTEST: {
807  UINT contact_id = GET_POINTERID_WPARAM(wparam);
808  POINTER_INPUT_TYPE pointer_type;
809  if (windows_proc_table_->GetPointerType(contact_id, &pointer_type) &&
810  pointer_type == PT_TOUCHPAD) {
811  direct_manipulation_owner_->SetContact(contact_id);
812  }
813  }
814  break;
815  }
816  case WM_INPUTLANGCHANGE:
817  // TODO(cbracken): pass this to TextInputManager to aid with
818  // language-specific issues.
819  break;
820  case WM_IME_SETCONTEXT:
821  OnImeSetContext(message, wparam, lparam);
822  // Strip the ISC_SHOWUICOMPOSITIONWINDOW bit from lparam before passing
823  // it to DefWindowProc() so that the composition window is hidden since
824  // Flutter renders the composing string itself.
825  result_lparam &= ~ISC_SHOWUICOMPOSITIONWINDOW;
826  break;
827  case WM_IME_STARTCOMPOSITION:
828  OnImeStartComposition(message, wparam, lparam);
829  // Suppress further processing by DefWindowProc() so that the default
830  // system IME style isn't used, but rather the one set in the
831  // WM_IME_SETCONTEXT handler.
832  return TRUE;
833  case WM_IME_COMPOSITION:
834  OnImeComposition(message, wparam, lparam);
835  if (lparam & GCS_RESULTSTR || lparam & GCS_COMPSTR) {
836  // Suppress further processing by DefWindowProc() since otherwise it
837  // will emit the result string as WM_CHAR messages on commit. Instead,
838  // committing the composing text to the EditableText string is handled
839  // in TextInputModel::CommitComposing, triggered by
840  // OnImeEndComposition().
841  return TRUE;
842  }
843  break;
844  case WM_IME_ENDCOMPOSITION:
845  OnImeEndComposition(message, wparam, lparam);
846  return TRUE;
847  case WM_IME_REQUEST:
848  OnImeRequest(message, wparam, lparam);
849  break;
850  case WM_UNICHAR: {
851  // Tell third-pary app, we can support Unicode.
852  if (wparam == UNICODE_NOCHAR)
853  return TRUE;
854  // DefWindowProc will send WM_CHAR for this WM_UNICHAR.
855  break;
856  }
857  case WM_THEMECHANGED:
858  OnThemeChange();
859  break;
860  case WM_DEADCHAR:
861  case WM_SYSDEADCHAR:
862  case WM_CHAR:
863  case WM_SYSCHAR:
864  case WM_KEYDOWN:
865  case WM_SYSKEYDOWN:
866  case WM_KEYUP:
867  case WM_SYSKEYUP:
868  if (keyboard_manager_->HandleMessage(message, wparam, lparam)) {
869  return 0;
870  }
871  // Prevent default proc for WM_SYSKEYUP which unfocuses the window
872  // and sends WM_MOUSELEAVE.
873  if (message == WM_SYSKEYUP) {
874  return 0;
875  }
876  break;
877  }
878 
879  return Win32DefWindowProc(window_handle_, message, wparam, result_lparam);
880 }
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 882 of file flutter_window.cc.

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

955  {
956  // Update the IME window position.
957  text_input_manager_->UpdateImeWindow();
958 
959  if (lparam == 0) {
960  OnComposeChange(u"", 0);
961  OnComposeCommit();
962  }
963 
964  // Process GCS_RESULTSTR at fisrt, because Google Japanese Input and ATOK
965  // send both GCS_RESULTSTR and GCS_COMPSTR to commit composed text and send
966  // new composing text.
967  if (lparam & GCS_RESULTSTR) {
968  // Commit but don't end composing.
969  // Read the committed composing string.
970  std::optional<std::u16string> text = text_input_manager_->GetResultString();
971  if (text) {
972  int pos = GetCursorPositionForComposition(*text_input_manager_, lparam,
973  text->length());
974  OnComposeChange(text.value(), pos);
975  OnComposeCommit();
976  }
977  }
978  if (lparam & GCS_COMPSTR) {
979  // Read the in-progress composing string.
980  std::optional<std::u16string> text =
981  text_input_manager_->GetComposingString();
982  if (text) {
983  int pos = GetCursorPositionForComposition(*text_input_manager_, lparam,
984  text->length());
985  OnComposeChange(text.value(), pos);
986  }
987  }
988 }
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 990 of file flutter_window.cc.

992  {
993  text_input_manager_->DestroyImeWindow();
994  OnComposeEnd();
995 }
virtual void OnComposeEnd()

References OnComposeEnd().

◆ OnImeRequest()

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

Definition at line 997 of file flutter_window.cc.

999  {
1000  // TODO(cbracken): Handle IMR_RECONVERTSTRING, IMR_DOCUMENTFEED,
1001  // and IMR_QUERYCHARPOSITION messages.
1002  // https://github.com/flutter/flutter/issues/74547
1003 }

◆ OnImeSetContext()

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

Definition at line 938 of file flutter_window.cc.

940  {
941  if (wparam != 0) {
942  text_input_manager_->CreateImeWindow();
943  }
944 }

◆ OnImeStartComposition()

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

Definition at line 946 of file flutter_window.cc.

948  {
949  text_input_manager_->CreateImeWindow();
950  OnComposeBegin();
951 }
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 1009 of file flutter_window.cc.

1009  {
1010  text_input_manager_->UpdateCaretRect(rect);
1011 }

Referenced by OnCursorRectUpdated().

◆ Win32DefWindowProc()

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

Definition at line 1029 of file flutter_window.cc.

1032  {
1033  return ::DefWindowProc(hWnd, Msg, wParam, lParam);
1034 }

◆ 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: