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.
Unified · Split
| @@ -89,6 +89,7 @@ local searching_history = false · 88 unmodified lines | |||
| 89 | local log_buffers = {[id] = {}} | 89 | local log_buffers = {[id] = {}} |
| 90 | local key_bindings = {} | 90 | local key_bindings = {} |
| 91 | local dont_bind_up_down = false | 91 | local dont_bind_up_down = false |
| 92 | local overlay = mp.create_osd_overlay('ass-events') | ||
| 92 | local global_margins = { t = 0, b = 0 } | 93 | local global_margins = { t = 0, b = 0 } |
| 93 | local was_playing = true | 94 | local was_playing = true |
| 94 | local input_caller | 95 | local input_caller |
| @@ -480,6 +481,21 @@ local function populate_log_with_matches() · 385 unmodified lines | |||
| 480 | end | 481 | end |
| 481 | end | 482 | end |
| 482 | 483 | ||
| 484 | local 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() | ||
| 497 | end | ||
| 498 | |||
| 483 | local function print_to_terminal() | 499 | local 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 then | 501 | 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 active | 558 | -- Clear the OSD if the REPL is not active |
| 543 | if not repl_active then | 559 | if not repl_active then |
| 544 | mp.set_osd_ass(0, 0, '') | 560 | update_overlay('', 0, 0, 0) |
| 545 | return | 561 | return |
| 546 | end | 562 | 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) | ||
| 643 | end | 660 | end |
| 644 | 661 | ||
| 645 | local update_timer = nil | 662 | local update_timer = nil |