-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track "mouse leave" event #12363
Track "mouse leave" event #12363
Changes from 3 commits
4ab6c8b
7e59dd3
b1bfea6
89c11a9
bcc6ed6
a9cbb66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,9 @@ class Win32FlutterWindow : public Win32Window { | |
// |Win32Window| | ||
void OnPointerUp(double x, double y) override; | ||
|
||
// |Win32Window| | ||
void OnPointerLeave() override; | ||
|
||
// |Win32Window| | ||
void OnChar(char32_t code_point) override; | ||
|
||
|
@@ -102,6 +105,13 @@ class Win32FlutterWindow : public Win32Window { | |
// Reports mouse release to Flutter engine. | ||
void SendPointerUp(double x, double y); | ||
|
||
// Reports mouse left the window client area. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the asymmetry is non-obvious (or at least was to me coming from a non-Windows background—macOS and GLFW both have enter and exit, apparently unlike Win32), maybe add a comment explicitly saying that there is no SendPointerEnter because it's automatically inferred from any other pointer event being sent. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
// | ||
// Win32 api doesn't have "mouse enter" event. Therefore, there is no | ||
// SendPointerEnter method. A mouse enter event is tracked then the "move" | ||
// event is called. | ||
void SendPointerLeave(); | ||
|
||
// Reports a keyboard character to Flutter engine. | ||
void SendChar(char32_t code_point); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,6 +88,9 @@ class Win32Window { | |
// down to up | ||
virtual void OnPointerUp(double x, double y) = 0; | ||
|
||
// Called when the mouse leaves the window. | ||
virtual void OnPointerLeave() = 0; | ||
|
||
// Called when character input occurs. | ||
virtual void OnChar(char32_t code_point) = 0; | ||
|
||
|
@@ -106,7 +109,13 @@ class Win32Window { | |
|
||
UINT GetCurrentHeight(); | ||
|
||
// Set to true to be notified when the mouse leaves the window. | ||
bool tracking_mouse_leave_ = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ivars need to be private, not protected, with accessors if necessary. In this case, rather than an accessor you can just put the toggling of the variable in the superclass. That would make a lot more sense anyway, because what it's tracking is whether There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
private: | ||
// Activates tracking for a "mouse leave" event. | ||
void TrackMouseLeaveEvent(HWND hwnd); | ||
|
||
// Stores new width and height and calls |OnResize| to notify inheritors | ||
void HandleResize(UINT width, UINT height); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW (not something to change in this PR), it's likely that process_events_ and the plugin handler hooks that toggle it are entirely cruft inherited from what the GLFW implementation did to interoperate reasonably with GTK dialogs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly. There was a contract that somewhere that required events to be disabled / enabled.