linux-qubasis

linux oasis port as a qubes template

git clone https://9o.is/git/linux-qubasis.git

commit bc7b25d6bf3d4ce86727abd035526486fcd0f58a
parent 918ba9c78490614f2b93d72c1d2dbc45eeec1e00
Author: Jul <jul@9o.is>
Date:   Sun, 12 Oct 2025 23:41:41 +0800

add vis win focus event

Diffstat:
Apkg/vis/patch/0003-add-WIN_FOCUS-event.patch | 119+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 119 insertions(+), 0 deletions(-)

diff --git a/pkg/vis/patch/0003-add-WIN_FOCUS-event.patch b/pkg/vis/patch/0003-add-WIN_FOCUS-event.patch @@ -0,0 +1,119 @@ +From 04bcd4ae8d6838d27b02ad4286f3838c622e3888 Mon Sep 17 00:00:00 2001 +From: Jul <jul@qh.is> +Date: Sun, 12 Oct 2025 23:41:09 +0800 +Subject: [PATCH] add WIN_FOCUS event + +--- + lua/vis.lua | 2 ++ + vis-core.h | 1 + + vis-lua.c | 15 +++++++++++++++ + vis.c | 6 +++++- + 4 files changed, 23 insertions(+), 1 deletion(-) + +diff --git a/lua/vis.lua b/lua/vis.lua +index 9ac41b0..481801b 100644 +--- a/lua/vis.lua ++++ b/lua/vis.lua +@@ -166,6 +166,7 @@ local events = { + WIN_HIGHLIGHT = "Event::WIN_HIGHLIGHT", -- see @{win_highlight} + WIN_OPEN = "Event::WIN_OPEN", -- see @{win_open} + WIN_STATUS = "Event::WIN_STATUS", -- see @{win_status} ++ WIN_FOCUS = "Event::WIN_FOCUS", -- see @{win_focus} + TERM_CSI = "Event::TERM_CSI", -- see @{term_csi} + PROCESS_RESPONSE = "Event::PROCESS_RESPONSE", -- see @{process_response} + UI_DRAW = "Event::UI_DRAW", -- see @{ui_draw} +@@ -183,6 +184,7 @@ events.win_close = function(...) events.emit(events.WIN_CLOSE, ...) end + events.win_highlight = function(...) events.emit(events.WIN_HIGHLIGHT, ...) end + events.win_open = function(...) events.emit(events.WIN_OPEN, ...) end + events.win_status = function(...) events.emit(events.WIN_STATUS, ...) end ++events.win_focus = function(...) events.emit(events.WIN_FOCUS, ...) end + events.term_csi = function(...) events.emit(events.TERM_CSI, ...) end + events.process_response = function(...) events.emit(events.PROCESS_RESPONSE, ...) end + events.ui_draw = function(...) events.emit(events.UI_DRAW, ...) end +diff --git a/vis-core.h b/vis-core.h +index 92770ee..e8f14e8 100644 +--- a/vis-core.h ++++ b/vis-core.h +@@ -235,6 +235,7 @@ enum VisEvents { + VIS_EVENT_WIN_CLOSE, + VIS_EVENT_WIN_HIGHLIGHT, + VIS_EVENT_WIN_STATUS, ++ VIS_EVENT_WIN_FOCUS, + VIS_EVENT_TERM_CSI, + VIS_EVENT_UI_DRAW, + }; +diff --git a/vis-lua.c b/vis-lua.c +index 3c233fa..060058f 100644 +--- a/vis-lua.c ++++ b/vis-lua.c +@@ -3581,6 +3581,18 @@ static void vis_lua_win_status(Vis *vis, Win *win) { + lua_pop(L, 1); + } + ++static void vis_lua_win_focus(Vis *vis, Win *win) { ++ lua_State *L = vis->lua; ++ if (!L || win->file->internal) ++ return; ++ vis_lua_event_get(L, "win_focus"); ++ if (lua_isfunction(L, -1)) { ++ obj_ref_new(L, win, VIS_LUA_TYPE_WINDOW); ++ pcall(vis, L, 1, 0); ++ } ++ lua_pop(L, 1); ++} ++ + /*** + * CSI command received from terminal. + * @function term_csi +@@ -3687,6 +3699,7 @@ bool vis_event_emit(Vis *vis, enum VisEvents id, ...) { + case VIS_EVENT_WIN_CLOSE: + case VIS_EVENT_WIN_HIGHLIGHT: + case VIS_EVENT_WIN_STATUS: ++ case VIS_EVENT_WIN_FOCUS: + { + Win *win = va_arg(ap, Win*); + if (win->file->internal && id != VIS_EVENT_WIN_STATUS) +@@ -3699,6 +3712,8 @@ bool vis_event_emit(Vis *vis, enum VisEvents id, ...) { + vis_lua_win_highlight(vis, win); + } else if (id == VIS_EVENT_WIN_STATUS) { + vis_lua_win_status(vis, win); ++ } else if (id == VIS_EVENT_WIN_FOCUS) { ++ vis_lua_win_focus(vis, win); + } + break; + } +diff --git a/vis.c b/vis.c +index 08ee6b2..16ad8a0 100644 +--- a/vis.c ++++ b/vis.c +@@ -398,6 +398,7 @@ Win *window_new_file(Vis *vis, File *file, enum UiOption options) { + for (size_t i = 0; i < LENGTH(win->modes); i++) + win->modes[i].parent = &vis_modes[i]; + vis_event_emit(vis, VIS_EVENT_WIN_OPEN, win); ++ vis_event_emit(vis, VIS_EVENT_WIN_FOCUS, win); + return win; + } + +@@ -454,6 +455,7 @@ void vis_window_focus(Win *win) { + Vis *vis = win->vis; + vis->win = win; + ui_window_focus(win); ++ vis_event_emit(vis, VIS_EVENT_WIN_FOCUS, win); + } + + void vis_window_next(Vis *vis) { +@@ -559,8 +561,10 @@ void vis_window_close(Win *win) { + if (win == vis->message_window) + vis->message_window = NULL; + window_free(win); +- if (vis->win) ++ if (vis->win) { + ui_window_focus(vis->win); ++ vis_event_emit(vis, VIS_EVENT_WIN_FOCUS, vis->win); ++ } + vis_draw(vis); + } + +-- +2.51.0 +