From 86ce3ea3248d045a8f714dc1d825d353aa23bf18 Mon Sep 17 00:00:00 2001 From: Kubat <mael.martin31@gmail.com> Date: Sat, 18 Apr 2020 13:57:20 +0200 Subject: [PATCH] Also check mpv events in sdl2 --- src/module/module_sdl2.c | 10 ++-------- src/module/module_x11.c | 4 ++-- src/module/mpv.c | 5 ++--- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c index a334610c..bb8395a8 100644 --- a/src/module/module_sdl2.c +++ b/src/module/module_sdl2.c @@ -333,14 +333,8 @@ loop: redraw = 1; } /* Handle mpv events. */ - if (event.type == wakeup_on_mpv_events) { - for (;;) { - mpv_event *mp_event = mpv_wait_event(sdl2->mpv, 0); - if (mp_event->event_id == MPV_EVENT_NONE) - break; - printf("event: %s\n", mpv_event_name(mp_event->event_id)); - } - } + if (event.type == wakeup_on_mpv_events) + lmpv_handle(win, sdl2->mpv, db, mpd_idle_events, (int *) &sdl2->mpv_time_pos, (int *) &sdl2->mpv_duration); } if (redraw) { diff --git a/src/module/module_x11.c b/src/module/module_x11.c index 9fa1e238..cc800fd3 100644 --- a/src/module/module_x11.c +++ b/src/module/module_x11.c @@ -352,6 +352,6 @@ module_x11_handle_events(struct lkt_win *const win, sqlite3 *db, enum mpd_idle_f return false; struct module_x11_window *xwin = win->window; return lx11_handle(xwin) && - lmpv_handle(win, xwin->mpv, db, mpd_idle_events, (int *) &xwin->mpv_time_pos, - (int *) &xwin->mpv_duration); + ! lmpv_handle(win, xwin->mpv, db, mpd_idle_events, (int *) &xwin->mpv_time_pos, + (int *) &xwin->mpv_duration); } diff --git a/src/module/mpv.c b/src/module/mpv.c index e1acfe7b..196dcf46 100644 --- a/src/module/mpv.c +++ b/src/module/mpv.c @@ -204,9 +204,8 @@ int lmpv_handle(struct lkt_win *win, mpv_handle *ctx, sqlite3 *db, enum mpd_idle_flag *mpd_idle_events, int *time_pos, int *time_duration) { - int ao_volume; + int ao_volume, sta = 1; struct lkt_queue_state state; - bool sta = false; mpv_event *event = NULL; mpv_event_property *prop; @@ -269,7 +268,7 @@ loop: break; } goto loop; /* A loop without indentation. */ - sta = true; + sta = 0; end: return sta; } -- GitLab