Skip to content

Commit

Permalink
Ladybird/AppKit: Send mouse event on middle click
Browse files Browse the repository at this point in the history
  • Loading branch information
nico authored and trflynn89 committed Jun 27, 2024
1 parent 450b9ff commit c4e935a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Ladybird/AppKit/UI/LadybirdWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,35 @@ - (void)rightMouseDragged:(NSEvent*)event
m_web_view_bridge->enqueue_input_event(move(mouse_event));
}

- (void)otherMouseDown:(NSEvent*)event
{
if (event.buttonNumber != 2)
return;

[[self window] makeFirstResponder:self];

auto mouse_event = Ladybird::ns_event_to_mouse_event(Web::MouseEvent::Type::MouseDown, event, self, [self scrollView], Web::UIEvents::MouseButton::Middle);
m_web_view_bridge->enqueue_input_event(move(mouse_event));
}

- (void)otherMouseUp:(NSEvent*)event
{
if (event.buttonNumber != 2)
return;

auto mouse_event = Ladybird::ns_event_to_mouse_event(Web::MouseEvent::Type::MouseUp, event, self, [self scrollView], Web::UIEvents::MouseButton::Middle);
m_web_view_bridge->enqueue_input_event(move(mouse_event));
}

- (void)otherMouseDragged:(NSEvent*)event
{
if (event.buttonNumber != 2)
return;

auto mouse_event = Ladybird::ns_event_to_mouse_event(Web::MouseEvent::Type::MouseMove, event, self, [self scrollView], Web::UIEvents::MouseButton::Middle);
m_web_view_bridge->enqueue_input_event(move(mouse_event));
}

- (BOOL)performKeyEquivalent:(NSEvent*)event
{
if ([event window] != [self window]) {
Expand Down

0 comments on commit c4e935a

Please sign in to comment.