diff options
Diffstat (limited to 'main.lua')
| -rw-r--r-- | main.lua | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -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) |
