From bcecbced7e1af9d99443a7e823f18328c7943f09 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 29 Mar 2025 11:45:18 +0530 Subject: Add window action router for multi-window --- src/LuaRuntime.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/LuaRuntime.cpp') diff --git a/src/LuaRuntime.cpp b/src/LuaRuntime.cpp index edf3b74..523fe59 100644 --- a/src/LuaRuntime.cpp +++ b/src/LuaRuntime.cpp @@ -1,4 +1,3 @@ -#include "widgets/WebViewStack.hpp" #include #include extern "C" { @@ -207,12 +206,7 @@ int LuaRuntime::lua_history_back(lua_State *state) { qsizetype history_index = lua_isnoneornil(state, 1) ? 1 : lua_tointeger(state, 1); - WebViewId tab_id; - if (lua_isnoneornil(state, 2)) { - tab_id = runtime->fetch_current_tab_id(); - } else { - tab_id = lua_tointeger(state, 2); - } + WebViewId tab_id = lua_isnoneornil(state, 2) ? 0 : lua_tointeger(state, 2); emit runtime->history_back_requested(tab_id, history_index); return 1; @@ -224,12 +218,7 @@ int LuaRuntime::lua_history_forward(lua_State *state) { qsizetype history_index = lua_isnoneornil(state, 1) ? 1 : lua_tointeger(state, 1); - WebViewId tab_id; - if (lua_isnoneornil(state, 2)) { - tab_id = runtime->fetch_current_tab_id(); - } else { - tab_id = lua_tointeger(state, 2); - } + WebViewId tab_id = lua_isnoneornil(state, 2) ? 0 : lua_tointeger(state, 2); emit runtime->history_forward_requested(tab_id, history_index); return 1; @@ -238,12 +227,7 @@ int LuaRuntime::lua_history_forward(lua_State *state) { int LuaRuntime::lua_tab_close(lua_State *state) { auto *runtime = LuaRuntime::instance(); - WebViewId tab_id; - if (lua_isnoneornil(state, 1)) { - tab_id = runtime->fetch_current_tab_id(); - } else { - tab_id = lua_tointeger(state, 1); - } + WebViewId tab_id = lua_isnoneornil(state, 1) ? 0 : lua_tointeger(state, 1); emit runtime->webview_closed(tab_id); return 1; -- cgit v1.3.1