[vlc-commits] [Git][videolan/vlc][master] 2 commits: input: es_out: optimize mouse event for pause-toggling

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri May 9 08:56:31 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
db488479 by Khalid Masum at 2025-05-09T08:36:17+00:00
input: es_out: optimize mouse event for pause-toggling

- - - - -
64047ebf by Khalid Masum at 2025-05-09T08:36:17+00:00
player: input: pause when mouse is released

Instead of when mouse is pressed.

- - - - -


3 changed files:

- src/input/es_out.c
- src/input/input_internal.h
- src/player/input.c


Changes:

=====================================
src/input/es_out.c
=====================================
@@ -346,15 +346,11 @@ static void MouseEventCb(const vlc_mouse_t *newmouse, void *userdata)
         return;
     }
 
-    struct vlc_input_event_mouse event = {
-        .oldmouse = id->oldmouse,
-        .newmouse = *newmouse
-    };
-
-    input_SendEvent(p_sys->p_input, &(struct vlc_input_event) {
-        .type = INPUT_EVENT_MOUSE,
-        .mouse_data = event,
-    });
+    if (vlc_mouse_HasReleased(&id->oldmouse, newmouse, MOUSE_BUTTON_LEFT)) {
+        input_SendEvent(p_sys->p_input, &(struct vlc_input_event) {
+            .type = INPUT_EVENT_MOUSE_LEFT
+        });
+    }
 
     id->oldmouse = *newmouse;
 }


=====================================
src/input/input_internal.h
=====================================
@@ -152,7 +152,7 @@ typedef enum input_event_type_e
     INPUT_EVENT_NAV_FAILED,
 
     /* Mouse event */
-    INPUT_EVENT_MOUSE,
+    INPUT_EVENT_MOUSE_LEFT,
 } input_event_type_e;
 
 #define VLC_INPUT_CAPABILITIES_SEEKABLE (1<<0)
@@ -328,8 +328,6 @@ struct vlc_input_event
         struct vlc_input_event_attachments attachments;
         /* INPUT_EVENT_NAV_FAILED */
         int nav_type;
-        /* INPUT_EVENT_MOUSE */
-        struct vlc_input_event_mouse mouse_data;
     };
 };
 


=====================================
src/player/input.c
=====================================
@@ -864,13 +864,10 @@ vlc_player_input_NavigationFallback(struct vlc_player_input *input, int nav_type
 }
 
 static void
-vlc_player_input_MouseFallback(struct vlc_player_input *input,
-                               const struct vlc_input_event_mouse *ev)
+vlc_player_input_MouseFallback(struct vlc_player_input *input)
 {
     vlc_player_t *player = input->player;
-
-    if (vlc_mouse_HasPressed(&ev->oldmouse, &ev->newmouse, MOUSE_BUTTON_LEFT))
-        vlc_player_TogglePause(player);
+    vlc_player_TogglePause(player);
 }
 
 static void
@@ -1052,8 +1049,8 @@ input_thread_Events(input_thread_t *input_thread,
         case INPUT_EVENT_NAV_FAILED:
             vlc_player_input_NavigationFallback(input, event->nav_type);
             break;
-        case INPUT_EVENT_MOUSE:
-            vlc_player_input_MouseFallback(input, &event->mouse_data);
+        case INPUT_EVENT_MOUSE_LEFT:
+            vlc_player_input_MouseFallback(input);
             break;
         default:
             break;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/99e466853fef59668d112557762d309b8d260935...64047ebfe2bbfed0f3b7461952de0891a837bd8a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/99e466853fef59668d112557762d309b8d260935...64047ebfe2bbfed0f3b7461952de0891a837bd8a
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list