History

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, like 490b3ba007 and 86d24b069b did for the OSC.

Guido Cella committed 1 year ago

Commit effa81e1 parent 2ecfe3e1 file · +19 −2Browse files

Unified · Split

player/lua/console.lua+19−2
@@ -89,6 +89,7 @@ local searching_history = false · 88 unmodified lines
89local log_buffers = {[id] = {}}89local log_buffers = {[id] = {}}
90local key_bindings = {}90local key_bindings = {}
91local dont_bind_up_down = false91local dont_bind_up_down = false
92local overlay = mp.create_osd_overlay('ass-events')
92local global_margins = { t = 0, b = 0 }93local global_margins = { t = 0, b = 0 }
93local was_playing = true94local was_playing = true
94local input_caller95local input_caller
@@ -480,6 +481,21 @@ local function populate_log_with_matches() · 385 unmodified lines
480 end481 end
481end482end
482 483
484local function update_overlay(data, res_x, res_y, z)
485 if overlay.data == data and
486 overlay.res_x == res_x and
487 overlay.res_y == res_y and
488 overlay.z == z then
489 return
490 end
491
492 overlay.data = data
493 overlay.res_x = res_x
494 overlay.res_y = res_y
495 overlay.z = z
496 overlay:update()
497end
498
483local function print_to_terminal()499local function print_to_terminal()
484 -- Clear the log after closing the console.500 -- Clear the log after closing the console.
485 if not repl_active then501 if not repl_active then
@@ -541,7 +557,7 @@ local function update() · 55 unmodified lines
541 557
542 -- Clear the OSD if the REPL is not active558 -- Clear the OSD if the REPL is not active
543 if not repl_active then559 if not repl_active then
544 mp.set_osd_ass(0, 0, '')560 update_overlay('', 0, 0, 0)
545 return561 return
546 end562 end
547 563
@@ -639,7 +655,8 @@ local function update() · 91 unmodified lines
639 ass:append(cglyph)655 ass:append(cglyph)
640 ass:append(style .. '{\\alpha&HFF&}' .. after_cur)656 ass:append(style .. '{\\alpha&HFF&}' .. after_cur)
641 657
642 mp.set_osd_ass(osd_w, osd_h, ass.text)658 -- z with selectable_items needs to be greater than the OSC's.
659 update_overlay(ass.text, osd_w, osd_h, selectable_items and 2000 or 0)
643end660end
644 661
645local update_timer = nil662local update_timer = nil

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t