Skip to content

Commit

Permalink
supports mouse side buttons for hardware mouse option #402
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Apr 4, 2024
1 parent 2c8f96d commit cda020b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/app/stream/input/session_evmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ static void mouse_listener(const evmouse_event_t *event, void *userdata) {
switch (event->type) {
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP: {
commons_log_info("Session", "Mouse button %d %s", event->button.button,
event->type == SDL_MOUSEBUTTONDOWN ? "down" : "up");
stream_input_handle_mbutton(&session->input, &event->button);
break;
}
case SDL_MOUSEMOTION:
LiSendMouseMoveEvent((short) event->motion.xrel, (short) event->motion.yrel);
case SDL_MOUSEMOTION: {
stream_input_handle_mmotion(&session->input, &event->motion);
break;
case SDL_MOUSEWHEEL:
}
case SDL_MOUSEWHEEL: {
stream_input_handle_mwheel(&session->input, &event->wheel);
break;
}
}
}
6 changes: 5 additions & 1 deletion src/app/stream/input/session_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ void stream_input_handle_mwheel(stream_input_t *input, const SDL_MouseWheelEvent
}

void stream_input_handle_mmotion(stream_input_t *input, const SDL_MouseMotionEvent *event) {
if (input->view_only || input->no_sdl_mouse) {
if (input->view_only) {
return;
}
if (input->no_sdl_mouse) {
LiSendMouseMoveEvent((short) event->xrel, (short) event->yrel);
return;
}
if (event->which == SDL_TOUCH_MOUSEID && LiGetHostFeatureFlags() & LI_FF_PEN_TOUCH_EVENTS) {
Expand Down
2 changes: 1 addition & 1 deletion third_party/commons

0 comments on commit cda020b

Please sign in to comment.