summaryrefslogtreecommitdiff
path: root/plugins/hotkeys/hotkeys.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hotkeys/hotkeys.c')
-rw-r--r--plugins/hotkeys/hotkeys.c13
1 files changed, 11 insertions, 2 deletions
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);
}