aboutsummaryrefslogtreecommitdiff
path: root/src/LuaRuntime.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-03-29 11:45:18 +0530
committerAkshay Nair <phenax5@gmail.com>2025-03-29 11:45:18 +0530
commitbcecbced7e1af9d99443a7e823f18328c7943f09 (patch)
tree612fac477acfa38358e15916bd4a44f386dc9206 /src/LuaRuntime.cpp
parentf7392096d2d84be7143947d386528bf4f487ee83 (diff)
downloadnull-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.tar.gz
null-browser-bcecbced7e1af9d99443a7e823f18328c7943f09.zip
Add window action router for multi-window
Diffstat (limited to '')
-rw-r--r--src/LuaRuntime.cpp22
1 files changed, 3 insertions, 19 deletions
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 <QtCore>
#include <lua.hpp>
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;