osc: ensure that window control show/hide zone is handled dynamically

As preparation for adding the auto mode for window controls, we need
to make sure that the controls can be successfully toggled at runtime,
rather than only being able to configure them once at startup. Right
now, there is a problem with the handling of the show/hide zone for
the window controls.

The previous fix for #7212 was to avoid registering the input mapping
for the window control show/hide zone. If there is no input mapping,
then there is no input, and the zone is a no-op, even if it exists.
But this only happens at startup. After that point, the input mapping
doesn't exist and cannot be turned on.

In this change, I'm switching the approach; we now go back to always
registering the input mapping, and instead, we zero out the show/hide
zone if window controls are disabled, and set its size appropriately
if they are enabled.
This commit is contained in:
Philip Langdale 2019-12-03 21:41:04 +08:00
parent 7f300a00e9
commit f8689eff6d
1 changed files with 6 additions and 6 deletions

View File

@ -2218,6 +2218,8 @@ function render()
for k,cords in pairs(osc_param.areas["showhide_wc"]) do
set_virt_mouse_area(cords.x1, cords.y1, cords.x2, cords.y2, "showhide_wc")
end
else
set_virt_mouse_area(0, 0, 0, 0, "showhide_wc")
end
do_enable_keybindings()
@ -2489,12 +2491,10 @@ mp.set_key_bindings({
{"mouse_move", function(e) process_event("mouse_move", nil) end},
{"mouse_leave", mouse_leave},
}, "showhide", "force")
if user_opts.windowcontrols ~= "no" then
mp.set_key_bindings({
{"mouse_move", function(e) process_event("mouse_move", nil) end},
{"mouse_leave", mouse_leave},
}, "showhide_wc", "force")
end
mp.set_key_bindings({
{"mouse_move", function(e) process_event("mouse_move", nil) end},
{"mouse_leave", mouse_leave},
}, "showhide_wc", "force")
do_enable_keybindings()
--mouse input bindings