summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-21 22:09:53 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2026-01-21 22:09:53 -0800
commit7b916d34e8116a1837a5511ec32fa29490fefd0e (patch)
tree7c668c777cbcbaeb264492f425f9a8f28b3d56ea /main.lua
parent302d1dd609837535f3cf4024ae8d8513223fbeae (diff)
downloadmpv-iptv-menu-7b916d34e8116a1837a5511ec32fa29490fefd0e.tar.gz
mpv-iptv-menu-7b916d34e8116a1837a5511ec32fa29490fefd0e.tar.xz
add hover state for menu
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua27
1 files changed, 22 insertions, 5 deletions
diff --git a/main.lua b/main.lua
index 0ee88c7..f3a1915 100644
--- a/main.lua
+++ b/main.lua
@@ -1005,9 +1005,13 @@ local function handle_mouse_click(ev, id)
return
end
+ local mpos = osd.mpos
+ if not mpos then
+ return
+ end
+
local time = mp.get_time()
local clk = click_state
- local mpos = osd.mpos
if ev.event == 'down' then
clk.ct, clk.ck = time, ev.key_name
@@ -1240,19 +1244,30 @@ local function handle_key(ev)
t = binding_state.active['ANY_UNICODE']
end
+ -- ev.is_mouse is false for some mouse events
+ local k = ev.key_name
+ if k:find('MOUSE_') or k:find('MBTN_') or k:find('WHEEL_') then
+ if not osd.mactive then
+ osd:set_mactive(true)
+ end
+ elseif osd.mactive then
+ osd:set_mactive(false)
+ click_state = {}
+ end
+
local f = t and t[1]
if not f then
- return
+ goto flush
end
- local flag = t[2]
- if flag == 'complex' then
+ if t[2] == 'complex' then
f(ev)
elseif ev.event == 'down' or
- (ev.event == 'repeat' and flag == 'repeat') then
+ (ev.event == 'repeat' and t[2] == 'repeat') then
f()
end
+ ::flush::
osd:flush(state)
end
@@ -1365,6 +1380,8 @@ mp.observe_property('mouse-pos', 'native', function(_, mpos)
else
btn_timer:kill()
end
+
+ osd:flush(state)
end)
mp.observe_property('user-data/osc/visibility', 'native', function(_, val)