From b5448b23f926d00f4146449f76d1f0f57c30d4ee Mon Sep 17 00:00:00 2001 From: natural-harmonia-gropius <50797982+natural-harmonia-gropius@users.noreply.github.com> Date: Tue, 30 Jan 2024 08:31:04 +0000 Subject: [PATCH] Re-add "Left-click will be ignored for a short time after the focus window" For https://github.com/natural-harmonia-gropius/input-event/commit/4a73dd14c13aa8098569ac67403687dd5c21910a the https://github.com/natural-harmonia-gropius/input-event/issues/39#issuecomment-1915905976 shows regression, and it will conflict with other scripts. --- inputevent.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/inputevent.lua b/inputevent.lua index 26b6748..1afa897 100644 --- a/inputevent.lua +++ b/inputevent.lua @@ -439,9 +439,23 @@ function on_input_doubleclick_time_update(_, duration) end end +function on_focused_update(_, focused) + if not focused then + return + end + + local binding = bind_map["MBTN_LEFT"] + if not binding then + return + end + + binding:ignore("click", 100) +end + mp.register_script_message("bind", bind) mp.register_script_message("unbind", unbind) mp.observe_property("input-doubleclick-time", "native", on_input_doubleclick_time_update) +mp.observe_property("focused", "native", on_focused_update) options.read_options(o, _, on_options_update) bind_from_options_configs()