aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/BrowserWindow.cpp
diff options
context:
space:
mode:
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;
}