Merge branch 'master' of https://github.com/86Box/86Box
This commit is contained in:
@@ -34,7 +34,6 @@ AppDir:
|
|||||||
- sourceline: 'deb http://deb.debian.org/debian bullseye-updates main'
|
- sourceline: 'deb http://deb.debian.org/debian bullseye-updates main'
|
||||||
key_url: 'https://ftp-master.debian.org/keys/archive-key-11-security.asc'
|
key_url: 'https://ftp-master.debian.org/keys/archive-key-11-security.asc'
|
||||||
include:
|
include:
|
||||||
- libdrm2
|
|
||||||
- libevdev2
|
- libevdev2
|
||||||
- libfluidsynth2
|
- libfluidsynth2
|
||||||
- libfreetype6
|
- libfreetype6
|
||||||
|
@@ -254,7 +254,8 @@ endif()
|
|||||||
|
|
||||||
if (UNIX AND NOT APPLE)
|
if (UNIX AND NOT APPLE)
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
target_link_libraries(ui PRIVATE X11::X11)
|
target_link_libraries(ui PRIVATE X11::X11 X11::Xi)
|
||||||
|
target_sources(ui PRIVATE xinput2_mouse.cpp)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(LIBEVDEV IMPORTED_TARGET libevdev)
|
pkg_check_modules(LIBEVDEV IMPORTED_TARGET libevdev)
|
||||||
if (LIBEVDEV_FOUND)
|
if (LIBEVDEV_FOUND)
|
||||||
|
@@ -66,6 +66,7 @@ extern "C"
|
|||||||
#include "cocoa_mouse.hpp"
|
#include "cocoa_mouse.hpp"
|
||||||
#include "qt_styleoverride.hpp"
|
#include "qt_styleoverride.hpp"
|
||||||
|
|
||||||
|
|
||||||
// Void Cast
|
// Void Cast
|
||||||
#define VC(x) const_cast<wchar_t*>(x)
|
#define VC(x) const_cast<wchar_t*>(x)
|
||||||
|
|
||||||
|
@@ -168,7 +168,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
mouse_capture = state ? 1 : 0;
|
mouse_capture = state ? 1 : 0;
|
||||||
qt_mouse_capture(mouse_capture);
|
qt_mouse_capture(mouse_capture);
|
||||||
if (mouse_capture) {
|
if (mouse_capture) {
|
||||||
ui->stackedWidget->grabMouse();
|
|
||||||
this->grabKeyboard();
|
this->grabKeyboard();
|
||||||
#ifdef WAYLAND
|
#ifdef WAYLAND
|
||||||
if (QGuiApplication::platformName().contains("wayland")) {
|
if (QGuiApplication::platformName().contains("wayland")) {
|
||||||
@@ -176,7 +175,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
ui->stackedWidget->releaseMouse();
|
|
||||||
this->releaseKeyboard();
|
this->releaseKeyboard();
|
||||||
#ifdef WAYLAND
|
#ifdef WAYLAND
|
||||||
if (QGuiApplication::platformName().contains("wayland")) {
|
if (QGuiApplication::platformName().contains("wayland")) {
|
||||||
|
@@ -131,6 +131,7 @@ private:
|
|||||||
|
|
||||||
friend class SpecifyDimensions;
|
friend class SpecifyDimensions;
|
||||||
friend class ProgSettings;
|
friend class ProgSettings;
|
||||||
|
friend class RendererCommon;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QT_MAINWINDOW_HPP
|
#endif // QT_MAINWINDOW_HPP
|
||||||
|
@@ -49,15 +49,21 @@ RendererStack::RendererStack(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
#ifdef WAYLAND
|
#ifdef WAYLAND
|
||||||
if (QApplication::platformName().contains("wayland")) {
|
if (QApplication::platformName().contains("wayland")) {
|
||||||
wl_init();
|
wl_init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef EVDEV_INPUT
|
#ifdef EVDEV_INPUT
|
||||||
if (QApplication::platformName() == "xcb" || QApplication::platformName() == "eglfs") {
|
if (QApplication::platformName() == "eglfs") {
|
||||||
evdev_init();
|
evdev_init();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
if (QApplication::platformName() == "xcb") {
|
||||||
|
extern void xinput2_init();
|
||||||
|
xinput2_init();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,20 +97,31 @@ void RendererStack::mousePoll()
|
|||||||
{
|
{
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
return macos_poll_mouse();
|
return macos_poll_mouse();
|
||||||
#else
|
#else /* !defined __APPLE__ */
|
||||||
mouse_x = mousedata.deltax;
|
mouse_x = mousedata.deltax;
|
||||||
mouse_y = mousedata.deltay;
|
mouse_y = mousedata.deltay;
|
||||||
mouse_z = mousedata.deltaz;
|
mouse_z = mousedata.deltaz;
|
||||||
mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0;
|
mousedata.deltax = mousedata.deltay = mousedata.deltaz = 0;
|
||||||
mouse_buttons = mousedata.mousebuttons;
|
mouse_buttons = mousedata.mousebuttons;
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
#ifdef WAYLAND
|
#ifdef WAYLAND
|
||||||
if (QApplication::platformName().contains("wayland"))
|
if (QApplication::platformName().contains("wayland"))
|
||||||
wl_mouse_poll();
|
wl_mouse_poll();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EVDEV_INPUT
|
#ifdef EVDEV_INPUT
|
||||||
evdev_mouse_poll();
|
if (QApplication::platformName() == "eglfs") evdev_mouse_poll();
|
||||||
#endif
|
else
|
||||||
#endif
|
#endif
|
||||||
|
if (QApplication::platformName() == "xcb")
|
||||||
|
{
|
||||||
|
extern void xinput2_poll();
|
||||||
|
xinput2_poll();
|
||||||
|
}
|
||||||
|
#endif /* defined __unix__ */
|
||||||
|
#endif /* !defined __APPLE__ */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ignoreNextMouseEvent = 1;
|
int ignoreNextMouseEvent = 1;
|
||||||
@@ -169,8 +186,8 @@ void RendererStack::mouseMoveEvent(QMouseEvent *event)
|
|||||||
leaveEvent((QEvent*)event);
|
leaveEvent((QEvent*)event);
|
||||||
ignoreNextMouseEvent--;
|
ignoreNextMouseEvent--;
|
||||||
}
|
}
|
||||||
else if (event->globalPos().x() == 0 || event->globalPos().y() == 0) leaveEvent((QEvent*)event);
|
QCursor::setPos(mapToGlobal(QPoint(width() / 2, height() / 2)));
|
||||||
else if (event->globalPos().x() == (util::screenOfWidget(this)->geometry().width() - 1) || event->globalPos().y() == (util::screenOfWidget(this)->geometry().height() - 1)) leaveEvent((QEvent*)event);
|
ignoreNextMouseEvent = 2;
|
||||||
oldPos = event->pos();
|
oldPos = event->pos();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -183,7 +200,6 @@ void RendererStack::leaveEvent(QEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mouse_capture) return;
|
if (!mouse_capture) return;
|
||||||
QCursor::setPos(mapToGlobal(QPoint(width() / 2, height() / 2)));
|
|
||||||
ignoreNextMouseEvent = 2;
|
ignoreNextMouseEvent = 2;
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="pushButtonConfigure">
|
<widget class="QPushButton" name="pushButtonConfigure">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Configure</string>
|
<string>Configure</string>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -41,6 +41,9 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
<attribute name="verticalHeaderVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
@@ -102,6 +105,9 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
<attribute name="verticalHeaderVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@@ -34,6 +34,9 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
<attribute name="verticalHeaderVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@@ -13,18 +13,6 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
@@ -35,23 +23,10 @@
|
|||||||
<property name="rightMargin">
|
<property name="rightMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="bottomMargin">
|
<item row="2" column="1">
|
||||||
<number>0</number>
|
<widget class="QPushButton" name="pushButtonJoystick2">
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Mouse:</string>
|
<string>Joystick 2...</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBoxMouse"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="pushButtonConfigureMouse">
|
|
||||||
<property name="text">
|
|
||||||
<string>Configure</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -62,63 +37,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="3">
|
||||||
<widget class="QComboBox" name="comboBoxJoystick"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonJoystick1">
|
|
||||||
<property name="text">
|
|
||||||
<string>Joystick 1...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonJoystick2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Joystick 2...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonJoystick3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Joystick 3...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButtonJoystick4">
|
<widget class="QPushButton" name="pushButtonJoystick4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Joystick 4...</string>
|
<string>Joystick 4...</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Mouse:</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="2">
|
||||||
|
<widget class="QPushButton" name="pushButtonJoystick3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Joystick 3...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
@@ -127,6 +74,39 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QPushButton" name="pushButtonJoystick1">
|
||||||
|
<property name="text">
|
||||||
|
<string>Joystick 1...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QPushButton" name="pushButtonConfigureMouse">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Configure</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxMouse">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxJoystick"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -93,7 +93,14 @@
|
|||||||
<widget class="QComboBox" name="comboBoxWaitStates"/>
|
<widget class="QComboBox" name="comboBoxWaitStates"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1">
|
||||||
<widget class="QSpinBox" name="spinBoxRAM"/>
|
<widget class="QSpinBox" name="spinBoxRAM">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QWidget" name="widget_2" native="true">
|
<widget class="QWidget" name="widget_2" native="true">
|
||||||
@@ -111,7 +118,14 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxCPU"/>
|
<widget class="QComboBox" name="comboBoxCPU">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
@@ -119,12 +133,19 @@
|
|||||||
<string>Speed:</string>
|
<string>Speed:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxSpeed"/>
|
<widget class="QComboBox" name="comboBoxSpeed">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -179,19 +200,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="groupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -222,6 +230,19 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -26,24 +26,7 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="1" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>PCap device:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Network adapter:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBoxPcap"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@@ -56,8 +39,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="0">
|
||||||
<widget class="QComboBox" name="comboBoxNetwork"/>
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>PCap device:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
@@ -67,33 +54,42 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QComboBox" name="comboBoxAdapter">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<property name="sizePolicy">
|
||||||
<property name="leftMargin">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<number>0</number>
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
</widget>
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBoxAdapter"/>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Network adapter:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<widget class="QPushButton" name="pushButtonConfigure">
|
<widget class="QPushButton" name="pushButtonConfigure">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Configure</string>
|
<string>Configure</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="0" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxNetwork">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1" colspan="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxPcap"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -36,7 +36,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxRTC"/>
|
<widget class="QComboBox" name="comboBoxRTC">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButtonConfigureRTC">
|
<widget class="QPushButton" name="pushButtonConfigureRTC">
|
||||||
@@ -92,7 +99,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxCard1"/>
|
<widget class="QComboBox" name="comboBoxCard1">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
|
@@ -41,6 +41,9 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
<attribute name="verticalHeaderVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
@@ -108,6 +111,9 @@
|
|||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="showGrid">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
<attribute name="verticalHeaderVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
|
@@ -62,7 +62,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxMidiIn"/>
|
<widget class="QComboBox" name="comboBoxMidiIn">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
@@ -106,11 +113,15 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBoxSoundCard"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxMidiOut"/>
|
<widget class="QComboBox" name="comboBoxMidiOut">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<widget class="QPushButton" name="pushButtonConfigureMidiOut">
|
<widget class="QPushButton" name="pushButtonConfigureMidiOut">
|
||||||
@@ -153,6 +164,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="comboBoxSoundCard">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -50,7 +50,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="comboBoxHD"/>
|
<widget class="QComboBox" name="comboBoxHD">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QPushButton" name="pushButtonHD">
|
<widget class="QPushButton" name="pushButtonHD">
|
||||||
@@ -104,8 +111,12 @@
|
|||||||
<string>SCSI</string>
|
<string>SCSI</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="3" column="2">
|
<item row="1" column="3">
|
||||||
<widget class="QComboBox" name="comboBoxSCSI4"/>
|
<widget class="QPushButton" name="pushButtonSCSI2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Configure</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="3">
|
<item row="3" column="3">
|
||||||
<widget class="QPushButton" name="pushButtonSCSI4">
|
<widget class="QPushButton" name="pushButtonSCSI4">
|
||||||
@@ -114,47 +125,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 1:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QComboBox" name="comboBoxSCSI1"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QComboBox" name="comboBoxSCSI2"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" rowspan="2">
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 4:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Controller 2:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="3">
|
|
||||||
<widget class="QPushButton" name="pushButtonSCSI1">
|
|
||||||
<property name="text">
|
|
||||||
<string>Configure</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QPushButton" name="pushButtonSCSI2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Configure</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -162,9 +132,53 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxSCSI1">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QPushButton" name="pushButtonSCSI1">
|
||||||
|
<property name="text">
|
||||||
|
<string>Configure</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxSCSI2"/>
|
||||||
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
<widget class="QComboBox" name="comboBoxSCSI3"/>
|
<widget class="QComboBox" name="comboBoxSCSI3"/>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QComboBox" name="comboBoxSCSI4"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Controller 1:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Controller 2:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" rowspan="2">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Controller 4:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="2" column="3">
|
<item row="2" column="3">
|
||||||
<widget class="QPushButton" name="pushButtonSCSI3">
|
<widget class="QPushButton" name="pushButtonSCSI3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@@ -13,15 +13,36 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Specify Main Window Dimensions</string>
|
<string>Specify Main Window Dimensions</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="geometry">
|
<item row="0" column="0">
|
||||||
<rect>
|
<widget class="QLabel" name="labelWidth">
|
||||||
<x>20</x>
|
<property name="text">
|
||||||
<y>110</y>
|
<string>Width:</string>
|
||||||
<width>361</width>
|
|
||||||
<height>32</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBoxWidth"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="labelHeight">
|
||||||
|
<property name="text">
|
||||||
|
<string>Height:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QSpinBox" name="spinBoxHeight"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Lock to this size</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="4">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -29,65 +50,8 @@
|
|||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QSpinBox" name="spinBoxWidth">
|
</item>
|
||||||
<property name="geometry">
|
</layout>
|
||||||
<rect>
|
|
||||||
<x>70</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>81</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="labelWidth">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>30</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>41</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Width:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QCheckBox" name="checkBox">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>20</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>131</width>
|
|
||||||
<height>23</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Lock to this size</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="labelHeight">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>200</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>51</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Height:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QSpinBox" name="spinBoxHeight">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>250</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>81</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
174
src/qt/xinput2_mouse.cpp
Normal file
174
src/qt/xinput2_mouse.cpp
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||||
|
* running old operating systems and software designed for IBM
|
||||||
|
* PC systems and compatibles from 1981 through fairly recent
|
||||||
|
* system designs based on the PCI bus.
|
||||||
|
*
|
||||||
|
* This file is part of the 86Box distribution.
|
||||||
|
*
|
||||||
|
* X11 Xinput2 mouse input module.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Authors: Cacodemon345
|
||||||
|
*
|
||||||
|
* Copyright 2022 Cacodemon345
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Valuator parsing and duplicate event checking code from SDL2. */
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QThread>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QAbstractNativeEventFilter>
|
||||||
|
|
||||||
|
#include "qt_mainwindow.hpp"
|
||||||
|
extern MainWindow* main_window;
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/extensions/XInput2.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <86box/86box.h>
|
||||||
|
#include <86box/mouse.h>
|
||||||
|
#include <86box/plat.h>
|
||||||
|
}
|
||||||
|
|
||||||
|
int xi2flides[2] = { 0, 0 };
|
||||||
|
|
||||||
|
static Display* disp = nullptr;
|
||||||
|
static QThread* procThread = nullptr;
|
||||||
|
static bool xi2childinit = false;
|
||||||
|
static XIEventMask ximask;
|
||||||
|
static std::atomic<bool> exitfromthread = false;
|
||||||
|
static std::atomic<double> xi2_mouse_x = 0, xi2_mouse_y = 0;
|
||||||
|
static int xi2opcode = 0;
|
||||||
|
static double prev_rel_coords[2] = { 0., 0. };
|
||||||
|
static Time prev_time = 0;
|
||||||
|
|
||||||
|
// From SDL2.
|
||||||
|
static void parse_valuators(const double *input_values, const unsigned char *mask,int mask_len,
|
||||||
|
double *output_values,int output_values_len) {
|
||||||
|
int i = 0,z = 0;
|
||||||
|
int top = mask_len * 8;
|
||||||
|
if (top > 16)
|
||||||
|
top = 16;
|
||||||
|
|
||||||
|
memset(output_values,0,output_values_len * sizeof(double));
|
||||||
|
for (; i < top && z < output_values_len; i++) {
|
||||||
|
if (XIMaskIsSet(mask, i)) {
|
||||||
|
const int value = (int) *input_values;
|
||||||
|
output_values[z] = value;
|
||||||
|
input_values++;
|
||||||
|
}
|
||||||
|
z++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool exitthread = false;
|
||||||
|
|
||||||
|
void xinput2_proc()
|
||||||
|
{
|
||||||
|
Window win;
|
||||||
|
win = DefaultRootWindow(disp);
|
||||||
|
|
||||||
|
// XIAllMasterDevices doesn't work for click-and-drag operations.
|
||||||
|
ximask.deviceid = XIAllDevices;
|
||||||
|
ximask.mask_len = XIMaskLen(XI_LASTEVENT);
|
||||||
|
ximask.mask = (unsigned char*)calloc(ximask.mask_len, sizeof(unsigned char));
|
||||||
|
|
||||||
|
XISetMask(ximask.mask, XI_RawKeyPress);
|
||||||
|
XISetMask(ximask.mask, XI_RawKeyRelease);
|
||||||
|
XISetMask(ximask.mask, XI_RawButtonPress);
|
||||||
|
XISetMask(ximask.mask, XI_RawButtonRelease);
|
||||||
|
XISetMask(ximask.mask, XI_RawMotion);
|
||||||
|
|
||||||
|
XISelectEvents(disp, win, &ximask, 1);
|
||||||
|
|
||||||
|
XSync(disp, False);
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
XEvent ev;
|
||||||
|
XGenericEventCookie *cookie = (XGenericEventCookie*)&ev.xcookie;
|
||||||
|
XNextEvent(disp, (XEvent*)&ev);
|
||||||
|
|
||||||
|
if (XGetEventData(disp, cookie) && cookie->type == GenericEvent && cookie->extension == xi2opcode) {
|
||||||
|
switch (cookie->evtype) {
|
||||||
|
case XI_RawMotion: {
|
||||||
|
static int ss = 0;
|
||||||
|
const XIRawEvent *rawev = (const XIRawEvent*)cookie->data;
|
||||||
|
double relative_coords[2] = { 0., 0. };
|
||||||
|
parse_valuators(rawev->raw_values,rawev->valuators.mask,
|
||||||
|
rawev->valuators.mask_len,relative_coords,2);
|
||||||
|
|
||||||
|
if ((rawev->time == prev_time) && (relative_coords[0] == prev_rel_coords[0]) && (relative_coords[1] == prev_rel_coords[1])) {
|
||||||
|
break; // Ignore duplicated events.
|
||||||
|
}
|
||||||
|
xi2_mouse_x = xi2_mouse_x + relative_coords[0];
|
||||||
|
xi2_mouse_y = xi2_mouse_y + relative_coords[1];
|
||||||
|
prev_rel_coords[0] = relative_coords[0];
|
||||||
|
prev_rel_coords[1] = relative_coords[1];
|
||||||
|
prev_time = rawev->time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
XFreeEventData(disp, cookie);
|
||||||
|
if (exitthread) break;
|
||||||
|
}
|
||||||
|
XCloseDisplay(disp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void xinput2_exit()
|
||||||
|
{
|
||||||
|
exitthread = true;
|
||||||
|
procThread->wait(5000);
|
||||||
|
procThread->terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void xinput2_init()
|
||||||
|
{
|
||||||
|
disp = XOpenDisplay(nullptr);
|
||||||
|
if (!disp)
|
||||||
|
{
|
||||||
|
qWarning() << "Cannot open current X11 display";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto event = 0, err = 0, minor = 0, major = 2;
|
||||||
|
if (XQueryExtension(disp, "XInputExtension", &xi2opcode, &event, &err))
|
||||||
|
{
|
||||||
|
if (XIQueryVersion(disp, &major, &minor) == Success)
|
||||||
|
{
|
||||||
|
procThread = QThread::create(xinput2_proc);
|
||||||
|
procThread->start();
|
||||||
|
atexit(xinput2_exit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void xinput2_poll()
|
||||||
|
{
|
||||||
|
if (procThread && mouse_capture)
|
||||||
|
{
|
||||||
|
mouse_x = xi2_mouse_x;
|
||||||
|
mouse_y = xi2_mouse_y;
|
||||||
|
XWindowAttributes winattrib{};
|
||||||
|
if (XGetWindowAttributes(disp, main_window->winId(), &winattrib))
|
||||||
|
{
|
||||||
|
auto globalPoint = main_window->mapToGlobal(QPoint(main_window->width() / 2, main_window->height() / 2));
|
||||||
|
XWarpPointer(disp, XRootWindow(disp, XScreenNumberOfScreen(winattrib.screen)), XRootWindow(disp, XScreenNumberOfScreen(winattrib.screen)), 0, 0, 0, 0, globalPoint.x(), globalPoint.y());
|
||||||
|
XFlush(disp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xi2_mouse_x = 0;
|
||||||
|
xi2_mouse_y = 0;
|
||||||
|
}
|
Reference in New Issue
Block a user