aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/WebViewStack.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-07-27 16:17:21 +0530
committerAkshay Nair <phenax5@gmail.com>2025-07-27 19:46:01 +0530
commitc95ee83c24b79e64a91a6d3a55addcb6e7ebd11b (patch)
tree1289227e74d6ec955ec039c2a35d8660b0e0533f /src/widgets/WebViewStack.cpp
parent72a47c4eecb31a4976bfd4c47a36cd0ab9811a55 (diff)
downloadnull-browser-c95ee83c24b79e64a91a6d3a55addcb6e7ebd11b.tar.gz
null-browser-c95ee83c24b79e64a91a6d3a55addcb6e7ebd11b.zip
Add viewselected/closed/created events
Diffstat (limited to '')
-rw-r--r--src/widgets/WebViewStack.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/widgets/WebViewStack.cpp b/src/widgets/WebViewStack.cpp
index 9ec8570..0ed2399 100644
--- a/src/widgets/WebViewStack.cpp
+++ b/src/widgets/WebViewStack.cpp
@@ -12,6 +12,9 @@
#include "WindowActionRouter.hpp"
#include "events/PermissionRequestedEvent.hpp"
#include "events/UrlChangedEvent.hpp"
+#include "events/ViewClosedEvent.hpp"
+#include "events/ViewCreatedEvent.hpp"
+#include "events/ViewSelectedEvent.hpp"
#include "widgets/WebViewStack.hpp"
@@ -74,6 +77,10 @@ WebView *WebViewStack::create_new_webview(const QUrl &url, bool focus) {
emit current_webview_title_changed(layout->currentIndex());
+ // TODO: Add window id
+ auto *event = new ViewCreatedEvent(webview->get_id(), 0);
+ WindowActionRouter::instance().dispatch_event(event);
+
return webview;
}
@@ -152,6 +159,9 @@ void WebViewStack::close(WebViewId webview_id) {
create_new_webview(configuration->new_view_url(), true);
}
}
+
+ auto *event = new ViewClosedEvent(webview_id, 0);
+ WindowActionRouter::instance().dispatch_event(event);
}
void WebViewStack::webview_history_back(WebViewId webview_id, qsizetype history_index) {
@@ -209,6 +219,9 @@ void WebViewStack::focus_webview(WebViewId webview_id) {
auto webview_index = get_webview_index(webview_id);
if (webview_index >= 0)
layout->setCurrentIndex((int)webview_index);
+
+ auto *event = new ViewSelectedEvent(webview_id, 0);
+ WindowActionRouter::instance().dispatch_event(event);
}
void WebViewStack::open_devtools(WebViewId webview_id) {