From 0763ae38dd9054cbdbffc5be3f42ab52dad0aa04 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 7 Jul 2020 23:57:32 -0400 Subject: [PATCH] Attempts to add conditional include for non-Mac UNIX only. --- OSBindings/Qt/ClockSignal.pro | 8 +++++++- OSBindings/Qt/mainwindow.cpp | 11 ++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/OSBindings/Qt/ClockSignal.pro b/OSBindings/Qt/ClockSignal.pro index e7eb5e3af..d6a6817ca 100644 --- a/OSBindings/Qt/ClockSignal.pro +++ b/OSBindings/Qt/ClockSignal.pro @@ -1,4 +1,10 @@ -QT += core gui multimedia widgets +QT += core gui multimedia widgets + +unix:!mac { + # For non-Mac UNIX targets, include X11 extras to check for X11. + # x11extras isn't supported on the Mac. + QT += x11extras +} CONFIG += c++17 diff --git a/OSBindings/Qt/mainwindow.cpp b/OSBindings/Qt/mainwindow.cpp index 4e52202b2..799b3cc85 100644 --- a/OSBindings/Qt/mainwindow.cpp +++ b/OSBindings/Qt/mainwindow.cpp @@ -765,6 +765,12 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) { processEvent(event); } +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + +#include + +#endif + bool MainWindow::processEvent(QKeyEvent *event) { if(!machine) return true; @@ -797,10 +803,9 @@ bool MainWindow::processEvent(QKeyEvent *event) { // // You can't. Qt is the worst. SDL doesn't have this problem, including in X11, so this seems to be a problem // Qt has invented for itself. - // - // TODO: find a workaround. Platform-specific use of either nativeScanCode() or nativeVirtualKey() maybe, - // but if so, how to interpret the meaning? + // Workaround for X11: assume +// QX11Info::isPlatformX11(); #define BIND2(qtKey, clkKey) case Qt::qtKey: key = Inputs::Keyboard::Key::clkKey; break; #define BIND(key) BIND2(Key_##key, key)