From f186aee48b5a600dfbeebd9f38de4becb389de09 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 28 Jul 2014 22:11:57 +0200 Subject: fixed seek backwards switching to next track when seek pos is negative --- plugins/hotkeys/hotkeys.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/hotkeys/hotkeys.c b/plugins/hotkeys/hotkeys.c index dc94e6a3..ed335d6f 100644 --- a/plugins/hotkeys/hotkeys.c +++ b/plugins/hotkeys/hotkeys.c @@ -694,7 +694,12 @@ action_seek_5p_backward_cb (struct DB_plugin_action_s *action, int ctx) { float dur = deadbeef->pl_get_item_duration (it); if (dur > 0) { float pos = deadbeef->streamer_get_playpos (); - deadbeef->sendmessage (DB_EV_SEEK, 0, (pos - dur * 0.05f) * 1000, 0); + pos = (pos - dur * 0.05f) * 1000; + if (pos < 0) { + pos = 0; + } + + deadbeef->sendmessage (DB_EV_SEEK, 0, pos, 0); } deadbeef->pl_item_unref (it); } @@ -726,7 +731,11 @@ action_seek_1p_backward_cb (struct DB_plugin_action_s *action, int ctx) { float dur = deadbeef->pl_get_item_duration (it); if (dur > 0) { float pos = deadbeef->streamer_get_playpos (); - deadbeef->sendmessage (DB_EV_SEEK, 0, (pos - dur * 0.01f) * 1000, 0); + pos = (pos - dur * 0.01f) * 1000; + if (pos < 0) { + pos = 0; + } + deadbeef->sendmessage (DB_EV_SEEK, 0, pos, 0); } deadbeef->pl_item_unref (it); } -- cgit v1.2.3