aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/BrowserWindow.cpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-08-02 21:54:15 +0530
committerAkshay Nair <phenax5@gmail.com>2025-08-02 21:58:49 +0530
commitd37020870600d6c842f9a75ebd3986df6010c25c (patch)
tree471e4ebac8661dcc299df61fb01436071e88f4b5 /src/widgets/BrowserWindow.cpp
parent052f043274e122cf4e8f4589e1256d5dfd526252 (diff)
downloadnull-browser-d37020870600d6c842f9a75ebd3986df6010c25c.tar.gz
null-browser-d37020870600d6c842f9a75ebd3986df6010c25c.zip
Add hints extra for opening links (number keys only)
Diffstat (limited to 'src/widgets/BrowserWindow.cpp')
-rw-r--r--src/widgets/BrowserWindow.cpp12
1 files changed, 11 insertions, 1 deletions
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 <QStackedLayout>
#include <QVBoxLayout>
#include <QtCore>
+#include <qcoreevent.h>
#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<WebView *>(target->parent())) {
+ auto *lua_event = KeyPressedEvent::from_qkeyevent(event);
+ WindowActionRouter::instance().dispatch_event(lua_event);
+ }
+
return should_skip;
}