From d37020870600d6c842f9a75ebd3986df6010c25c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 2 Aug 2025 21:54:15 +0530 Subject: Add hints extra for opening links (number keys only) --- src/widgets/BrowserWindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/widgets/BrowserWindow.cpp') diff --git a/src/widgets/BrowserWindow.cpp b/src/widgets/BrowserWindow.cpp index 1971b9c..7852a66 100644 --- a/src/widgets/BrowserWindow.cpp +++ b/src/widgets/BrowserWindow.cpp @@ -4,9 +4,13 @@ #include #include #include +#include #include "Configuration.hpp" +#include "WindowActionRouter.hpp" +#include "events/KeyPressedEvent.hpp" #include "keymap/KeymapEvaluator.hpp" +#include "widgets/BrowserApp.hpp" #include "widgets/Decorations.hpp" #include "widgets/WebViewStack.hpp" @@ -52,10 +56,16 @@ BrowserWindow::BrowserWindow(const Configuration &configuration, QWebEngineProfi &BrowserWindow::close_window_requested); } -bool BrowserWindow::on_window_key_event(QKeyEvent *event) { +bool BrowserWindow::on_window_key_event(QObject *target, QKeyEvent *event) { auto &keymap_evaluator = KeymapEvaluator::instance(); const bool should_skip = keymap_evaluator.evaluate(event->modifiers(), (Qt::Key)event->key()); + // TODO: Fix this logic to find the right "target" for event + if (event->type() == QEvent::KeyPress && dynamic_cast(target->parent())) { + auto *lua_event = KeyPressedEvent::from_qkeyevent(event); + WindowActionRouter::instance().dispatch_event(lua_event); + } + return should_skip; } -- cgit v1.3.1