feat: add mouse-down & mouse-up to Tray (#21795)

This commit is contained in:
Shelley Vohr 2020-01-17 16:28:34 +00:00 committed by GitHub
parent 5feafaceee
commit 5c6f9a6947
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 0 deletions

View file

@ -131,6 +131,10 @@
}
- (void)mouseDown:(NSEvent*)event {
trayIcon_->NotifyMouseDown(
gfx::ScreenPointFromNSPoint([event locationInWindow]),
ui::EventFlagsFromModifiers([event modifierFlags]));
// Pass click to superclass to show menu. Custom mouseUp handler won't be
// invoked.
if (menuController_) {
@ -143,6 +147,10 @@
- (void)mouseUp:(NSEvent*)event {
[[statusItem_ button] highlight:NO];
trayIcon_->NotifyMouseUp(
gfx::ScreenPointFromNSPoint([event locationInWindow]),
ui::EventFlagsFromModifiers([event modifierFlags]));
// If we are ignoring double click events, we should ignore the `clickCount`
// value and immediately emit a click event.
BOOL shouldBeHandledAsASingleClick =