Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.lua: set a high z in select mode #15676

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions player/lua/console.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -629,7 +645,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
Expand Down
2 changes: 1 addition & 1 deletion player/lua/osc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2502,7 +2502,7 @@ local function render()

-- submit
set_osd(osc_param.playresy * osc_param.display_aspect,
osc_param.playresy, ass.text, user_opts.layout == "box" and -1 or 1000)
osc_param.playresy, ass.text, 1000)
end

-- called by mpv on every frame
Expand Down
Loading