Flutter Engine
 
Loading...
Searching...
No Matches
flutter::FlutterWindow Class Reference

#include <flutter_window.h>

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

Public Member Functions

 FlutterWindow (FlutterDesktopWindowRef window)
 
 ~FlutterWindow ()=default
 
 FlutterWindow (FlutterWindow const &)=delete
 
FlutterWindowoperator= (FlutterWindow const &)=delete
 
void SetHoverEnabled (bool enabled)
 
void SetTitle (const std::string &title)
 
void SetIcon (uint8_t *pixel_data, int width, int height)
 
WindowFrame GetFrame ()
 
void SetFrame (const WindowFrame &frame)
 
double GetScaleFactor ()
 
void SetPixelRatioOverride (double pixel_ratio)
 
void SetSizeLimits (FlutterDesktopSize minimum_size, FlutterDesktopSize maximum_size)
 
 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, int modifiers_state)
 
virtual void OnPointerDown (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
 
virtual void OnPointerUp (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, UINT button)
 
virtual void OnPointerLeave (double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)
 
virtual void 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::AXFragmentRootDelegateWinGetAxFragmentRootDelegate ()
 
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 26 of file flutter_window.h.

Constructor & Destructor Documentation

◆ FlutterWindow() [1/4]

flutter::FlutterWindow::FlutterWindow ( FlutterDesktopWindowRef  window)
inlineexplicit

Definition at line 28 of file flutter_window.h.

28: window_(window) {}
GLFWwindow * window
Definition main.cc:60

◆ ~FlutterWindow() [1/2]

flutter::FlutterWindow::~FlutterWindow ( )
default

Definition at line 113 of file flutter_window.cc.

113 {
114 Destroy();
115}

◆ FlutterWindow() [2/4]

flutter::FlutterWindow::FlutterWindow ( FlutterWindow const &  )
delete

◆ FlutterWindow() [3/4]

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}
void InitializeChild(const char *title, unsigned int width, unsigned int height)
static const int kMaxTouchDeviceId
static const int kMinTouchDeviceId
UINT GetDpiForHWND(HWND hwnd)
Definition dpi_utils.cc:128
const DisplayManagerWin32 * display_manager
int32_t height
int32_t width

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

◆ ~FlutterWindow() [2/2]

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

◆ FlutterWindow() [4/4]

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 ( )
protectedvirtual

Definition at line 886 of file flutter_window.cc.

886 {
887 text_input_manager_->AbortComposing();
888}

Referenced by OnResetImeComposing().

◆ Focus()

bool flutter::FlutterWindow::Focus ( )
overridevirtual

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}
virtual HWND GetWindowHandle() override

References GetWindowHandle().

◆ GetAlert()

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

Implements flutter::WindowBindingHandler.

Definition at line 334 of file flutter_window.cc.

334 {
335 CreateAxFragmentRoot();
336 return alert_node_.get();
337}
std::unique_ptr< ui::AXPlatformNodeWin > alert_node_

References alert_node_.

◆ GetAlertDelegate()

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

Implements flutter::WindowBindingHandler.

Definition at line 329 of file flutter_window.cc.

329 {
330 CreateAxFragmentRoot();
331 return alert_delegate_.get();
332}
std::unique_ptr< AlertPlatformNodeDelegate > alert_delegate_

References alert_delegate_.

◆ GetAxFragmentRootDelegate()

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

Definition at line 325 of file flutter_window.cc.

325 {
326 return binding_handler_delegate_->GetAxFragmentRootDelegate();
327}
virtual ui::AXFragmentRootDelegateWin * GetAxFragmentRootDelegate()=0

References flutter::WindowBindingHandlerDelegate::GetAxFragmentRootDelegate().

◆ GetCurrentDPI()

UINT flutter::FlutterWindow::GetCurrentDPI ( )
protected

Definition at line 894 of file flutter_window.cc.

894 {
895 return current_dpi_;
896}

Referenced by flutter::testing::MockWindow::GetDpi(), and GetDpiScale().

◆ GetCurrentHeight()

UINT flutter::FlutterWindow::GetCurrentHeight ( )
protected

Definition at line 902 of file flutter_window.cc.

902 {
903 return current_height_;
904}

Referenced by GetPhysicalWindowBounds().

◆ GetCurrentWidth()

UINT flutter::FlutterWindow::GetCurrentWidth ( )
protected

Definition at line 898 of file flutter_window.cc.

898 {
899 return current_width_;
900}

Referenced by GetPhysicalWindowBounds().

◆ GetDisplayId()

FlutterEngineDisplayId flutter::FlutterWindow::GetDisplayId ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 311 of file flutter_window.cc.

311 {
312 FlutterEngineDisplayId const display_id =
313 reinterpret_cast<FlutterEngineDisplayId>(
314 MonitorFromWindow(GetWindowHandle(), MONITOR_DEFAULTTONEAREST));
315 if (!display_manager_->FindById(display_id)) {
316 FML_LOG(ERROR) << "Current monitor not found in display list.";
317 }
318 return display_id;
319}
uint64_t FlutterEngineDisplayId
Definition embedder.h:1043
#define FML_LOG(severity)
Definition logging.h:101

References FML_LOG, and GetWindowHandle().

◆ GetDpiScale()

float flutter::FlutterWindow::GetDpiScale ( )
overridevirtual

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}

References GetCurrentDPI().

Referenced by OnCursorRectUpdated().

◆ GetFrame()

WindowFrame flutter::FlutterWindow::GetFrame ( )
inline

Definition at line 61 of file flutter_window.h.

61 {
62 WindowFrame frame = {};
63 FlutterDesktopWindowGetFrame(window_, &frame.left, &frame.top, &frame.width,
64 &frame.height);
65 return frame;
66 }
void FlutterDesktopWindowGetFrame(FlutterDesktopWindowRef flutter_window, int *x, int *y, int *width, int *height)

References FlutterDesktopWindowGetFrame(), flutter::WindowFrame::height, flutter::WindowFrame::left, flutter::WindowFrame::top, and flutter::WindowFrame::width.

◆ GetNativeViewAccessible()

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

Definition at line 296 of file flutter_window.cc.

296 {
297 if (binding_handler_delegate_ == nullptr) {
298 return nullptr;
299 }
300
301 return binding_handler_delegate_->GetNativeViewAccessible();
302}
virtual gfx::NativeViewAccessible GetNativeViewAccessible()=0

References flutter::WindowBindingHandlerDelegate::GetNativeViewAccessible().

Referenced by OnGetObject().

◆ GetPhysicalWindowBounds()

PhysicalWindowBounds flutter::FlutterWindow::GetPhysicalWindowBounds ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 134 of file flutter_window.cc.

134 {
135 return {GetCurrentWidth(), GetCurrentHeight()};
136}

References GetCurrentHeight(), and GetCurrentWidth().

◆ GetPrimaryPointerLocation()

PointerLocation flutter::FlutterWindow::GetPrimaryPointerLocation ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 304 of file flutter_window.cc.

304 {
305 POINT point;
306 GetCursorPos(&point);
307 ScreenToClient(GetWindowHandle(), &point);
308 return {(size_t)point.x, (size_t)point.y};
309}

References GetWindowHandle().

◆ GetScaleFactor()

double flutter::FlutterWindow::GetScaleFactor ( )
inline

Definition at line 79 of file flutter_window.h.

79 {
81 }
double FlutterDesktopWindowGetScaleFactor(FlutterDesktopWindowRef flutter_window)

References FlutterDesktopWindowGetScaleFactor().

◆ GetScrollOffsetMultiplier()

float flutter::FlutterWindow::GetScrollOffsetMultiplier ( )
protectedvirtual

Definition at line 906 of file flutter_window.cc.

906 {
907 return scroll_offset_multiplier_;
908}

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

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

References flutter::GetDpiForHWND(), height, flutter::kControl, kFlutterPointerDeviceKindMouse, kFlutterPointerDeviceKindTouch, flutter::kFocus, flutter::kHide, flutter::kShift, flutter::kShow, flutter::kUnfocus, message, TRUE, width, x, and y.

Referenced by flutter::testing::MockWindow::InjectWindowMessage().

◆ InitializeChild()

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

Definition at line 408 of file flutter_window.cc.

410 {
411 Destroy();
412 std::wstring converted_title = NarrowToWide(title);
413
414 WNDCLASS window_class = RegisterWindowClass(converted_title);
415
416 auto* result = CreateWindowEx(
417 0, window_class.lpszClassName, converted_title.c_str(),
418 WS_CHILD | WS_VISIBLE, CW_DEFAULT, CW_DEFAULT, width, height,
419 HWND_MESSAGE, nullptr, window_class.hInstance, this);
420
421 if (result == nullptr) {
422 auto error = GetLastError();
423 LPWSTR message = nullptr;
424 size_t size = FormatMessageW(
425 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
426 FORMAT_MESSAGE_IGNORE_INSERTS,
427 NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
428 reinterpret_cast<LPWSTR>(&message), 0, NULL);
429 OutputDebugString(message);
430 LocalFree(message);
431 }
432 SetUserObjectInformationA(GetCurrentProcess(),
433 UOI_TIMERPROC_EXCEPTION_SUPPRESSION, FALSE, 1);
434 // SetTimer is not precise, if a 16 ms interval is requested, it will instead
435 // often fire in an interval of 32 ms. Providing a value of 14 will ensure it
436 // runs every 16 ms, which will allow for 60 Hz trackpad gesture events, which
437 // is the maximal frequency supported by SetTimer.
438 SetTimer(result, kDirectManipulationTimer, 14, nullptr);
439 direct_manipulation_owner_ = std::make_unique<DirectManipulationOwner>(this);
441}
std::wstring NarrowToWide(const char *source)
const uint8_t uint32_t uint32_t GError ** error
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)

References direct_manipulation_owner_, error, GetLastError(), height, message, NarrowToWide(), flutter::size, and width.

Referenced by FlutterWindow().

◆ NarrowToWide()

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

Definition at line 465 of file flutter_window.cc.

465 {
466 size_t length = strlen(source);
467 size_t outlen = 0;
468 std::wstring wideTitle(length, L'#');
469 mbstowcs_s(&outlen, &wideTitle[0], length + 1, source, length);
470 return wideTitle;
471}
size_t length

References length.

Referenced by InitializeChild().

◆ OnBitmapSurfaceCleared()

bool flutter::FlutterWindow::OnBitmapSurfaceCleared ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 271 of file flutter_window.cc.

271 {
272 HDC dc = ::GetDC(GetWindowHandle());
273 bool result = ::PatBlt(dc, 0, 0, current_width_, current_height_, BLACKNESS);
274 ::ReleaseDC(GetWindowHandle(), dc);
275 return result;
276}

References GetWindowHandle().

◆ OnBitmapSurfaceUpdated()

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

Implements flutter::WindowBindingHandler.

Definition at line 278 of file flutter_window.cc.

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

References GetWindowHandle(), and height.

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

◆ OnComposeBegin()

void flutter::FlutterWindow::OnComposeBegin ( )
virtual

Definition at line 225 of file flutter_window.cc.

225 {
226 binding_handler_delegate_->OnComposeBegin();
227}

References flutter::WindowBindingHandlerDelegate::OnComposeBegin().

Referenced by OnImeStartComposition().

◆ OnComposeChange()

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

Definition at line 237 of file flutter_window.cc.

238 {
239 binding_handler_delegate_->OnComposeChange(text, cursor_pos);
240}
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 229 of file flutter_window.cc.

229 {
230 binding_handler_delegate_->OnComposeCommit();
231}

References flutter::WindowBindingHandlerDelegate::OnComposeCommit().

Referenced by OnImeComposition().

◆ OnComposeEnd()

void flutter::FlutterWindow::OnComposeEnd ( )
virtual

Definition at line 233 of file flutter_window.cc.

233 {
234 binding_handler_delegate_->OnComposeEnd();
235}

References flutter::WindowBindingHandlerDelegate::OnComposeEnd().

Referenced by OnImeEndComposition().

◆ OnCursorRectUpdated()

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

Implements flutter::WindowBindingHandler.

Definition at line 259 of file flutter_window.cc.

259 {
260 // Convert the rect from Flutter logical coordinates to device coordinates.
261 auto scale = GetDpiScale();
262 Point origin(rect.left() * scale, rect.top() * scale);
263 Size size(rect.width() * scale, rect.height() * scale);
264 UpdateCursorRect(Rect(origin, size));
265}
virtual void UpdateCursorRect(const Rect &rect)
virtual float GetDpiScale() override
TRect< Scalar > Rect
Definition rect.h:788
TPoint< Scalar > Point
Definition point.h:327
TSize< Scalar > Size
Definition size.h:159

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

◆ 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 
)
protectedvirtual

Definition at line 765 of file flutter_window.cc.

767 {
768 LRESULT reference_result = static_cast<LRESULT>(0L);
769
770 // Only the lower 32 bits of lparam are valid when checking the object id
771 // because it sometimes gets sign-extended incorrectly (but not always).
772 DWORD obj_id = static_cast<DWORD>(static_cast<DWORD_PTR>(lparam));
773
774 bool is_uia_request = static_cast<DWORD>(UiaRootObjectId) == obj_id;
775 bool is_msaa_request = static_cast<DWORD>(OBJID_CLIENT) == obj_id;
776
777 if (is_uia_request || is_msaa_request) {
778 // On Windows, we don't get a notification that the screen reader has been
779 // enabled or disabled. There is an API to query for screen reader state,
780 // but that state isn't set by all screen readers, including by Narrator,
781 // the screen reader that ships with Windows:
782 // https://docs.microsoft.com/en-us/windows/win32/winauto/screen-reader-parameter
783 //
784 // Instead, we enable semantics in Flutter if Windows issues queries for
785 // Microsoft Active Accessibility (MSAA) COM objects.
787 }
788
790 // TODO(schectman): UIA is currently disabled by default.
791 // https://github.com/flutter/flutter/issues/114547
792 if (root_view) {
793 CreateAxFragmentRoot();
794 if (is_uia_request) {
795#ifdef FLUTTER_ENGINE_USE_UIA
796 // Retrieve UIA object for the root view.
797 Microsoft::WRL::ComPtr<IRawElementProviderSimple> root;
798 if (SUCCEEDED(
799 ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
800 IID_PPV_ARGS(&root)))) {
801 // Return the UIA object via UiaReturnRawElementProvider(). See:
802 // https://docs.microsoft.com/en-us/windows/win32/winauto/wm-getobject
803 reference_result = UiaReturnRawElementProvider(window_handle_, wparam,
804 lparam, root.Get());
805 } else {
806 FML_LOG(ERROR) << "Failed to query AX fragment root.";
807 }
808#endif // FLUTTER_ENGINE_USE_UIA
809 } else if (is_msaa_request) {
810 // Create the accessibility root if it does not already exist.
811 // Return the IAccessible for the root view.
812 Microsoft::WRL::ComPtr<IAccessible> root;
813 ax_fragment_root_->GetNativeViewAccessible()->QueryInterface(
814 IID_PPV_ARGS(&root));
815 reference_result = LresultFromObject(IID_IAccessible, wparam, root.Get());
816 }
817 }
818 return reference_result;
819}
virtual void OnUpdateSemanticsEnabled(bool enabled)
virtual gfx::NativeViewAccessible GetNativeViewAccessible()
UnimplementedNativeViewAccessible * NativeViewAccessible
#define SUCCEEDED(hr)
unsigned long DWORD

References FML_LOG, GetNativeViewAccessible(), OnUpdateSemanticsEnabled(), and SUCCEEDED.

◆ OnImeComposition()

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

Definition at line 836 of file flutter_window.cc.

838 {
839 // Update the IME window position.
840 text_input_manager_->UpdateImeWindow();
841
842 if (lparam == 0) {
843 OnComposeChange(u"", 0);
845 }
846
847 // Process GCS_RESULTSTR at fisrt, because Google Japanese Input and ATOK send
848 // both GCS_RESULTSTR and GCS_COMPSTR to commit composed text and send new
849 // composing text.
850 if (lparam & GCS_RESULTSTR) {
851 // Commit but don't end composing.
852 // Read the committed composing string.
853 long pos = text_input_manager_->GetComposingCursorPosition();
854 std::optional<std::u16string> text = text_input_manager_->GetResultString();
855 if (text) {
856 OnComposeChange(text.value(), pos);
858 }
859 }
860 if (lparam & GCS_COMPSTR) {
861 // Read the in-progress composing string.
862 long pos = text_input_manager_->GetComposingCursorPosition();
863 std::optional<std::u16string> text =
864 text_input_manager_->GetComposingString();
865 if (text) {
866 OnComposeChange(text.value(), pos);
867 }
868 }
869}
virtual void OnComposeCommit()
virtual void OnComposeChange(const std::u16string &text, int cursor_pos)

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

Referenced by flutter::testing::MockWindow::CallOnImeComposition().

◆ OnImeEndComposition()

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

Definition at line 871 of file flutter_window.cc.

873 {
874 text_input_manager_->DestroyImeWindow();
875 OnComposeEnd();
876}
virtual void OnComposeEnd()

References OnComposeEnd().

◆ OnImeRequest()

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

Definition at line 878 of file flutter_window.cc.

880 {
881 // TODO(cbracken): Handle IMR_RECONVERTSTRING, IMR_DOCUMENTFEED,
882 // and IMR_QUERYCHARPOSITION messages.
883 // https://github.com/flutter/flutter/issues/74547
884}

◆ OnImeSetContext()

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

Definition at line 821 of file flutter_window.cc.

823 {
824 if (wparam != 0) {
825 text_input_manager_->CreateImeWindow();
826 }
827}

◆ OnImeStartComposition()

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

Definition at line 829 of file flutter_window.cc.

831 {
832 text_input_manager_->CreateImeWindow();
834}
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 214 of file flutter_window.cc.

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

162 {
163 if (binding_handler_delegate_ != nullptr) {
164 binding_handler_delegate_->OnWindowRepaint();
165 }
166}

References flutter::WindowBindingHandlerDelegate::OnWindowRepaint().

◆ OnPointerDown()

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

Definition at line 177 of file flutter_window.cc.

181 {
182 uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
183 if (flutter_button != 0) {
184 binding_handler_delegate_->OnPointerDown(
185 x, y, device_kind, device_id,
186 static_cast<FlutterPointerMouseButtons>(flutter_button));
187 }
188}
virtual void OnPointerDown(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0
FlutterPointerMouseButtons
Definition embedder.h:1288

References flutter::WindowBindingHandlerDelegate::OnPointerDown(), x, and y.

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

206 {
207 binding_handler_delegate_->OnPointerLeave(x, y, device_kind, device_id);
208}
virtual void OnPointerLeave(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id)=0

References flutter::WindowBindingHandlerDelegate::OnPointerLeave(), x, and y.

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

◆ OnPointerMove()

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

Definition at line 168 of file flutter_window.cc.

172 {
173 binding_handler_delegate_->OnPointerMove(x, y, device_kind, device_id,
174 modifiers_state);
175}
virtual void OnPointerMove(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, int modifiers_state)=0

References flutter::WindowBindingHandlerDelegate::OnPointerMove(), x, and y.

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

194 {
195 uint64_t flutter_button = ConvertWinButtonToFlutterButton(button);
196 if (flutter_button != 0) {
197 binding_handler_delegate_->OnPointerUp(
198 x, y, device_kind, device_id,
199 static_cast<FlutterPointerMouseButtons>(flutter_button));
200 }
201}
virtual void OnPointerUp(double x, double y, FlutterPointerDeviceKind device_kind, int32_t device_id, FlutterPointerMouseButtons button)=0

References flutter::WindowBindingHandlerDelegate::OnPointerUp(), x, and y.

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

◆ OnResetImeComposing()

void flutter::FlutterWindow::OnResetImeComposing ( )
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 267 of file flutter_window.cc.

267 {
269}
virtual void AbortImeComposing()

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}
virtual bool OnWindowSizeChanged(size_t width, size_t height)=0

References height, flutter::WindowBindingHandlerDelegate::OnWindowSizeChanged(), and width.

◆ OnScroll()

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

Definition at line 246 of file flutter_window.cc.

249 {
250 POINT point;
251 GetCursorPos(&point);
252
253 ScreenToClient(GetWindowHandle(), &point);
254 binding_handler_delegate_->OnScroll(point.x, point.y, delta_x, delta_y,
255 GetScrollOffsetMultiplier(), device_kind,
256 device_id);
257}
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 210 of file flutter_window.cc.

210 {
211 binding_handler_delegate_->OnText(text);
212}
virtual void OnText(const std::u16string &)=0

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

◆ OnThemeChange()

void flutter::FlutterWindow::OnThemeChange ( )
virtual

Definition at line 321 of file flutter_window.cc.

321 {
322 binding_handler_delegate_->OnHighContrastChanged();
323}

References flutter::WindowBindingHandlerDelegate::OnHighContrastChanged().

◆ OnUpdateSemanticsEnabled()

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

Definition at line 242 of file flutter_window.cc.

242 {
243 binding_handler_delegate_->OnUpdateSemanticsEnabled(enabled);
244}
virtual void OnUpdateSemanticsEnabled(bool enabled)=0

References flutter::WindowBindingHandlerDelegate::OnUpdateSemanticsEnabled().

Referenced by OnGetObject().

◆ OnWindowStateEvent()

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

Definition at line 339 of file flutter_window.cc.

339 {
340 switch (event) {
342 restored_ = true;
343 break;
345 restored_ = false;
346 focused_ = false;
347 break;
349 focused_ = true;
350 if (binding_handler_delegate_) {
351 binding_handler_delegate_->OnFocus(
354 }
355 break;
357 focused_ = false;
358 if (binding_handler_delegate_) {
359 binding_handler_delegate_->OnFocus(
362 }
363 break;
364 }
365 HWND hwnd = GetWindowHandle();
366 if (hwnd && binding_handler_delegate_) {
367 binding_handler_delegate_->OnWindowStateEvent(hwnd, event);
368 }
369}
virtual void OnWindowStateEvent(HWND hwnd, WindowStateEvent event)=0
virtual void OnFocus(FlutterViewFocusState focus_state, FlutterViewFocusDirection direction)=0
@ kUnfocused
Specifies that a view does not have platform focus.
Definition embedder.h:1191
@ kFocused
Specifies that a view has platform focus.
Definition embedder.h:1194
@ kUndefined
Definition embedder.h:1175

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

Referenced by SetView().

◆ operator=()

FlutterWindow & flutter::FlutterWindow::operator= ( FlutterWindow const &  )
delete

◆ SetFrame()

void flutter::FlutterWindow::SetFrame ( const WindowFrame frame)
inline

Definition at line 70 of file flutter_window.h.

70 {
71 FlutterDesktopWindowSetFrame(window_, frame.left, frame.top, frame.width,
72 frame.height);
73 }
void FlutterDesktopWindowSetFrame(FlutterDesktopWindowRef flutter_window, int x, int y, int width, int height)

References FlutterDesktopWindowSetFrame(), flutter::WindowFrame::height, flutter::WindowFrame::left, flutter::WindowFrame::top, and flutter::WindowFrame::width.

◆ SetHoverEnabled()

void flutter::FlutterWindow::SetHoverEnabled ( bool  enabled)
inline

Definition at line 41 of file flutter_window.h.

41 {
43 }
void FlutterDesktopWindowSetHoverEnabled(FlutterDesktopWindowRef flutter_window, bool enabled)

References FlutterDesktopWindowSetHoverEnabled().

◆ SetIcon()

void flutter::FlutterWindow::SetIcon ( uint8_t *  pixel_data,
int  width,
int  height 
)
inline

Definition at line 55 of file flutter_window.h.

55 {
56 FlutterDesktopWindowSetIcon(window_, pixel_data, width, height);
57 }
void FlutterDesktopWindowSetIcon(FlutterDesktopWindowRef flutter_window, uint8_t *pixel_data, int width, int height)

References FlutterDesktopWindowSetIcon(), height, and width.

◆ SetPixelRatioOverride()

void flutter::FlutterWindow::SetPixelRatioOverride ( double  pixel_ratio)
inline

Definition at line 87 of file flutter_window.h.

87 {
89 }
void FlutterDesktopWindowSetPixelRatioOverride(FlutterDesktopWindowRef flutter_window, double pixel_ratio)

References FlutterDesktopWindowSetPixelRatioOverride().

◆ SetSizeLimits()

void flutter::FlutterWindow::SetSizeLimits ( FlutterDesktopSize  minimum_size,
FlutterDesktopSize  maximum_size 
)
inline

Definition at line 93 of file flutter_window.h.

94 {
95 FlutterDesktopWindowSetSizeLimits(window_, minimum_size, maximum_size);
96 }
void FlutterDesktopWindowSetSizeLimits(FlutterDesktopWindowRef flutter_window, FlutterDesktopSize minimum_size, FlutterDesktopSize maximum_size)

References FlutterDesktopWindowSetSizeLimits().

◆ SetTitle()

void flutter::FlutterWindow::SetTitle ( const std::string &  title)
inline

Definition at line 46 of file flutter_window.h.

46 {
47 FlutterDesktopWindowSetTitle(window_, title.c_str());
48 }
void FlutterDesktopWindowSetTitle(FlutterDesktopWindowRef flutter_window, const char *title)

References FlutterDesktopWindowSetTitle().

◆ SetView()

void flutter::FlutterWindow::SetView ( WindowBindingHandlerDelegate view)
overridevirtual

Implements flutter::WindowBindingHandler.

Definition at line 117 of file flutter_window.cc.

117 {
118 binding_handler_delegate_ = window;
120 direct_manipulation_owner_->SetBindingHandlerDelegate(window);
121 }
122 if (restored_ && window) {
124 }
125 if (focused_ && window) {
127 }
128}

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

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

◆ UpdateCursorRect()

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

Definition at line 890 of file flutter_window.cc.

890 {
891 text_input_manager_->UpdateCaretRect(rect);
892}

Referenced by OnCursorRectUpdated().

◆ Win32DefWindowProc()

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

Reimplemented in flutter::testing::MockWindow.

Definition at line 910 of file flutter_window.cc.

913 {
914 return ::DefWindowProc(hWnd, Msg, wParam, lParam);
915}

◆ Win32DispatchMessage()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 459 of file flutter_window.cc.

461 {
462 return ::SendMessage(window_handle_, Msg, wParam, lParam);
463}

◆ Win32MapVkToChar()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 455 of file flutter_window.cc.

455 {
456 return ::MapVirtualKey(virtual_key, MAPVK_VK_TO_CHAR);
457}

◆ Win32PeekMessage()

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

Implements flutter::KeyboardManager::WindowDelegate.

Definition at line 447 of file flutter_window.cc.

450 {
451 return ::PeekMessage(lpMsg, window_handle_, wMsgFilterMin, wMsgFilterMax,
452 wRemoveMsg);
453}

Friends And Related Symbol Documentation

◆ WindowAXFragmentRootDelegate

friend class WindowAXFragmentRootDelegate
friend

Definition at line 385 of file flutter_window.h.

Member Data Documentation

◆ alert_delegate_

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

Definition at line 274 of file flutter_window.h.

Referenced by GetAlertDelegate().

◆ alert_node_

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

Definition at line 277 of file flutter_window.h.

Referenced by GetAlert().

◆ direct_manipulation_owner_

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

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