From 4198e6f35f1a923da0aea2fb6f62c840e83a2c15 Mon Sep 17 00:00:00 2001 From: llyyr Date: Fri, 21 Jul 2023 05:44:32 +0530 Subject: [PATCH] osc: don't add margins to osc-deadzonesize Currently, the osc will add a margin of (osc_height / 2) to the deadzonesize for the window controls, the topbar and the bottombar, i.e. when osc-deadzonesize=1, the osc will show up even if the cursor is only hovering (osc_height / 2) pixels above or below it. This is not what this option is supposed to do according to the manual, instead osc-deadzonesize=1 should result in the osc only appearing when it is directly hovered. The user can simply set osc-deadzonesize=0.9 or so if such a margin is desired, instead make the option work as advertised by removing this margin. It should be noted that osc-layout=box does not share this behavior, and it already works as advertised in the manual. --- player/lua/osc.lua | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/player/lua/osc.lua b/player/lua/osc.lua index 0722102e94..e1d6fe2973 100644 --- a/player/lua/osc.lua +++ b/player/lua/osc.lua @@ -1142,9 +1142,8 @@ function window_controls(topbar) -- deadzone below window controls local sh_area_y0, sh_area_y1 sh_area_y0 = user_opts.barmargin - sh_area_y1 = (wc_geo.y + (wc_geo.h / 2)) + - get_align(1 - (2 * user_opts.deadzonesize), - osc_param.playresy - (wc_geo.y + (wc_geo.h / 2)), 0, 0) + sh_area_y1 = wc_geo.y + get_align(1 - (2 * user_opts.deadzonesize), + osc_param.playresy - wc_geo.y, 0, 0) add_area("showhide_wc", wc_geo.x, sh_area_y0, wc_geo.w, sh_area_y1) if topbar then @@ -1532,13 +1531,11 @@ function bar_layout(direction) if direction > 0 then -- deadzone below OSC sh_area_y0 = user_opts.barmargin - sh_area_y1 = (osc_geo.y + (osc_geo.h / 2)) + - get_align(1 - (2*user_opts.deadzonesize), - osc_param.playresy - (osc_geo.y + (osc_geo.h / 2)), 0, 0) + sh_area_y1 = osc_geo.y + get_align(1 - (2 * user_opts.deadzonesize), + osc_param.playresy - osc_geo.y, 0, 0) else -- deadzone above OSC - sh_area_y0 = get_align(-1 + (2*user_opts.deadzonesize), - osc_geo.y - (osc_geo.h / 2), 0, 0) + sh_area_y0 = get_align(-1 + (2 * user_opts.deadzonesize), osc_geo.y, 0, 0) sh_area_y1 = osc_param.playresy - user_opts.barmargin end add_area("showhide", 0, sh_area_y0, osc_param.playresx, sh_area_y1)