From 1d9cd2bcb69ccbccea67166f9d42ec8ff6892fae Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 5 Apr 2025 13:10:43 +0530 Subject: Connected url changed event --- src/WindowActionRouter.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/WindowActionRouter.cpp') diff --git a/src/WindowActionRouter.cpp b/src/WindowActionRouter.cpp index 1cc39cb..e1d0664 100644 --- a/src/WindowActionRouter.cpp +++ b/src/WindowActionRouter.cpp @@ -10,19 +10,20 @@ #include "widgets/BrowserWindow.hpp" #include "widgets/WebViewStack.hpp" -void WindowActionRouter::dispatch_event(BrowserEvent &event) { +void WindowActionRouter::dispatch_event(BrowserEvent *event) { auto &runtime = LuaRuntime::instance(); - runtime.queue_task([this, &event]() { - std::unordered_map> event_map; + + runtime.queue_task([this, event]() { + std::unordered_map> event_map; { const std::lock_guard lock(events_mutex); event_map = events; } - if (!event_map.contains(event.kind)) + if (!event_map.contains(event->kind)) return; - for (auto &event_handler : event_map.at(event.kind)) { + for (auto &event_handler : event_map.at(event->kind)) { // TODO: Pattern filter event_handler.handler(event); } @@ -39,12 +40,6 @@ void WindowActionRouter::register_event(const EventHandlerRequest &event) { } void WindowActionRouter::initialize() { - UrlChangedEvent url_changed_event("https://googa.com", 2, 1); - WindowActionRouter::instance().dispatch_event(url_changed_event); - - UrlChangedEvent url_changed_event_1("https://duckduckgo.com", 5, 1); - WindowActionRouter::instance().dispatch_event(url_changed_event_1); - auto &runtime = LuaRuntime::instance(); connect(&runtime, &LuaRuntime::keymap_added, this, -- cgit v1.3.1