Skip to content

Commit f0e77e7

Browse files
committed
LibInputEventStream: Fix right click on contextual menu
1 parent df8f71f commit f0e77e7

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/servers/app/drawing/interface/linux/LibInputEventStream.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -445,19 +445,30 @@ LibInputEventStream::_ScheduleEvent(libinput_event* ev)
445445
break;
446446
}
447447

448-
case LIBINPUT_EVENT_POINTER_MOTION:
449448
case LIBINPUT_EVENT_POINTER_BUTTON:
450449
{
451450
libinput_event_pointer* e = libinput_event_get_pointer_event(ev);
451+
uint32 linuxButton = libinput_event_pointer_get_button(e);
452+
uint32 bButton = MapMouseButton(linuxButton);
452453

453-
if (type == LIBINPUT_EVENT_POINTER_MOTION)
454-
what = B_MOUSE_MOVED;
455-
else if (libinput_event_pointer_get_button_state(e) == LIBINPUT_BUTTON_STATE_PRESSED)
454+
if (libinput_event_pointer_get_button_state(e)
455+
== LIBINPUT_BUTTON_STATE_PRESSED) {
456456
what = B_MOUSE_DOWN;
457-
else
457+
fMouseButtons |= bButton;
458+
} else {
458459
what = B_MOUSE_UP;
460+
fMouseButtons &= ~bButton;
461+
}
462+
463+
event->AddPoint("where", fMousePosition);
464+
event->AddInt32("buttons", fMouseButtons);
465+
break;
466+
}
459467

460-
fMouseButtons = libinput_event_pointer_get_button(e);
468+
case LIBINPUT_EVENT_POINTER_MOTION:
469+
{
470+
libinput_event_pointer* e = libinput_event_get_pointer_event(ev);
471+
what = B_MOUSE_MOVED;
461472

462473
double dx = libinput_event_pointer_get_dx(e);
463474
double dy = libinput_event_pointer_get_dy(e);
@@ -471,11 +482,8 @@ LibInputEventStream::_ScheduleEvent(libinput_event* ev)
471482
fMousePosition.y = std::min((float)fHeight, fMousePosition.y);
472483
fMousePosition.y = std::max(0.0f, fMousePosition.y);
473484

474-
uint32 bButton = MapMouseButton(fMouseButtons);
475-
476485
event->AddPoint("where", fMousePosition);
477-
if (what == B_MOUSE_MOVED || what == B_MOUSE_DOWN)
478-
event->AddInt32("buttons", bButton);
486+
event->AddInt32("buttons", fMouseButtons);
479487

480488
fLatestMouseMovedEvent = event;
481489
break;

0 commit comments

Comments
 (0)