mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-26 21:00:21 +00:00
console.lua: set a high z in select mode
Give console's overlay a high z only in select mode, since in this case you want to click it so it should be above other overlays. In particular console should be above the OSC's box layout with visibility=always when you show it by clicking its buttons. Keep using z=0 otherwise when it doesn't handle clicks, to avoid unintuitive behavior of overlays handling clicks like the OSC being drawn below console. Since the legacy mp.set_osd_ass() doesn't accept z, we need to repeat its caching logic, like490b3ba007and86d24b069bdid for the OSC.
This commit is contained in:
committed by
Avi Halachmi
parent
2ecfe3ecf7
commit
effa81eb6e
@@ -89,6 +89,7 @@ local searching_history = false
|
||||
local log_buffers = {[id] = {}}
|
||||
local key_bindings = {}
|
||||
local dont_bind_up_down = false
|
||||
local overlay = mp.create_osd_overlay('ass-events')
|
||||
local global_margins = { t = 0, b = 0 }
|
||||
local was_playing = true
|
||||
local input_caller
|
||||
@@ -480,6 +481,21 @@ local function populate_log_with_matches()
|
||||
end
|
||||
end
|
||||
|
||||
local function update_overlay(data, res_x, res_y, z)
|
||||
if overlay.data == data and
|
||||
overlay.res_x == res_x and
|
||||
overlay.res_y == res_y and
|
||||
overlay.z == z then
|
||||
return
|
||||
end
|
||||
|
||||
overlay.data = data
|
||||
overlay.res_x = res_x
|
||||
overlay.res_y = res_y
|
||||
overlay.z = z
|
||||
overlay:update()
|
||||
end
|
||||
|
||||
local function print_to_terminal()
|
||||
-- Clear the log after closing the console.
|
||||
if not repl_active then
|
||||
@@ -541,7 +557,7 @@ local function update()
|
||||
|
||||
-- Clear the OSD if the REPL is not active
|
||||
if not repl_active then
|
||||
mp.set_osd_ass(0, 0, '')
|
||||
update_overlay('', 0, 0, 0)
|
||||
return
|
||||
end
|
||||
|
||||
@@ -639,7 +655,8 @@ local function update()
|
||||
ass:append(cglyph)
|
||||
ass:append(style .. '{\\alpha&HFF&}' .. after_cur)
|
||||
|
||||
mp.set_osd_ass(osd_w, osd_h, ass.text)
|
||||
-- z with selectable_items needs to be greater than the OSC's.
|
||||
update_overlay(ass.text, osd_w, osd_h, selectable_items and 2000 or 0)
|
||||
end
|
||||
|
||||
local update_timer = nil
|
||||
|
||||
Reference in New Issue
Block a user