summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorChrisK2 <spam@kalania.de>2014-07-29 19:26:32 +0200
committerChrisK2 <spam@kalania.de>2014-07-29 19:26:32 +0200
commit48f4f791f4c6ab4439446d676a59c2f13bc2f342 (patch)
tree91364ba67217cbcc51a1c87b0c7edc6408d9b31b /player
parent63d1d53d2fb89de0c7ff081f8b3bb78ee5e52520 (diff)
downloadmpv-48f4f791f4c6ab4439446d676a59c2f13bc2f342.tar.bz2
mpv-48f4f791f4c6ab4439446d676a59c2f13bc2f342.tar.xz
osc: Do precise seeks on simple clicks on seekbar
Diffstat (limited to 'player')
-rw-r--r--player/lua/osc.lua30
1 files changed, 19 insertions, 11 deletions
diff --git a/player/lua/osc.lua b/player/lua/osc.lua
index c00ef4a95b..f688d0f55a 100644
--- a/player/lua/osc.lua
+++ b/player/lua/osc.lua
@@ -68,7 +68,6 @@ local state = {
tc_ms = false, -- Should the timecodes display their time with milliseconds
mp_screen_sizeX, mp_screen_sizeY, -- last screen-resolution, to detect resolution changes to issue reINITs
initREQ = false, -- is a re-init request pending?
- last_seek, -- last seek position, to avoid deadlocks by repeatedly seeking to the same position
last_mouseX, last_mouseY, -- last mouse position, to detect siginificant mouse movement
message_text,
message_timeout,
@@ -314,6 +313,7 @@ function register_element(type, x, y, an, w, h, style, content, eventresponder,
content = content,
eventresponder = eventresponder,
metainfo = metainfo,
+ state = {},
}
table.insert(elements, element)
@@ -882,16 +882,19 @@ function osc_init()
end
local eventresponder = {}
- local sliderF = function (element)
- local seek_to = get_slider_value(element)
- -- ignore identical seeks
- if not(state.last_seek == seek_to) then
- mp.commandv("seek", seek_to, "absolute-percent", "keyframes")
- state.last_seek = seek_to
- end
+
+ -- Do keyframe seeking when mouse is dragged
+ local sliderFfast = function (element)
+ mp.commandv("seek", get_slider_value(element), "absolute-percent", "keyframes")
+ end
+ eventresponder["mouse_move"] = sliderFfast
+
+ -- Do exact seeks on single clicks
+ local sliderFexact = function (element)
+ mp.commandv("seek", get_slider_value(element), "absolute-percent", "exact")
end
- eventresponder.render = sliderF
- eventresponder.mouse_btn0_down = sliderF
+ eventresponder.mouse_btn0_down = sliderFexact
+
register_slider(posX, posY+pos_offsetY-22, 2, pos_offsetX*2, 15, osc_styles.timecodes, 0, 100, markerF, posF, eventresponder, metainfo)
--
@@ -1136,10 +1139,15 @@ function process_event(source, what)
elements[n].eventresponder[source .. "_" .. what](elements[n])
end
end
+
+ --reset active element
+ if not (elements[n].eventresponder["reset"] == nil) then
+ elements[n].eventresponder["reset"](elements[n])
+ end
+
end
state.active_element = nil
state.mouse_down_counter = 0
- state.last_seek = nil
elseif source == "mouse_move" then
local mouseX, mouseY = mp.get_mouse_pos()