mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: simplify events (#37099)
This commit is contained in:
@@ -97,19 +97,19 @@ void Tray::OnClicked(const gfx::Rect& bounds,
|
||||
int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("click", CreateEventFromFlags(modifiers), bounds, location);
|
||||
EmitWithoutEvent("click", CreateEventFromFlags(modifiers), bounds, location);
|
||||
}
|
||||
|
||||
void Tray::OnDoubleClicked(const gfx::Rect& bounds, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("double-click", CreateEventFromFlags(modifiers), bounds);
|
||||
EmitWithoutEvent("double-click", CreateEventFromFlags(modifiers), bounds);
|
||||
}
|
||||
|
||||
void Tray::OnRightClicked(const gfx::Rect& bounds, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("right-click", CreateEventFromFlags(modifiers), bounds);
|
||||
EmitWithoutEvent("right-click", CreateEventFromFlags(modifiers), bounds);
|
||||
}
|
||||
|
||||
void Tray::OnBalloonShow() {
|
||||
@@ -139,31 +139,31 @@ void Tray::OnDropText(const std::string& text) {
|
||||
void Tray::OnMouseEntered(const gfx::Point& location, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("mouse-enter", CreateEventFromFlags(modifiers), location);
|
||||
EmitWithoutEvent("mouse-enter", CreateEventFromFlags(modifiers), location);
|
||||
}
|
||||
|
||||
void Tray::OnMouseExited(const gfx::Point& location, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("mouse-leave", CreateEventFromFlags(modifiers), location);
|
||||
EmitWithoutEvent("mouse-leave", CreateEventFromFlags(modifiers), location);
|
||||
}
|
||||
|
||||
void Tray::OnMouseMoved(const gfx::Point& location, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("mouse-move", CreateEventFromFlags(modifiers), location);
|
||||
EmitWithoutEvent("mouse-move", CreateEventFromFlags(modifiers), location);
|
||||
}
|
||||
|
||||
void Tray::OnMouseUp(const gfx::Point& location, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("mouse-up", CreateEventFromFlags(modifiers), location);
|
||||
EmitWithoutEvent("mouse-up", CreateEventFromFlags(modifiers), location);
|
||||
}
|
||||
|
||||
void Tray::OnMouseDown(const gfx::Point& location, int modifiers) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
EmitCustomEvent("mouse-down", CreateEventFromFlags(modifiers), location);
|
||||
EmitWithoutEvent("mouse-down", CreateEventFromFlags(modifiers), location);
|
||||
}
|
||||
|
||||
void Tray::OnDragEntered() {
|
||||
|
||||
Reference in New Issue
Block a user