1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Attempts to add conditional include for non-Mac UNIX only.

This commit is contained in:
Thomas Harte 2020-07-07 23:57:32 -04:00
parent 2230ac6c38
commit 0763ae38dd
2 changed files with 15 additions and 4 deletions

View File

@ -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

View File

@ -765,6 +765,12 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event) {
processEvent(event);
}
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include <QX11Info>
#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)