Merge branch 'master' of ssh://github.com/86Box/86Box into cleanup30

This commit is contained in:
RichardG867
2022-02-17 11:29:50 -03:00
4 changed files with 25 additions and 16 deletions

View File

@@ -259,8 +259,8 @@ void MachineStatus::iterateCDROM(const std::function<void (int)> &cb) {
for (size_t i = 0; i < CDROM_NUM; i++) { for (size_t i = 0; i < CDROM_NUM; i++) {
/* Could be Internal or External IDE.. */ /* Could be Internal or External IDE.. */
if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) && if ((cdrom[i].bus_type == CDROM_BUS_ATAPI) &&
!hasIDE() && hdc_name != QStringLiteral("ide") && !hasIDE() && hdc_name.left(3) != QStringLiteral("ide") &&
hdc_name != QStringLiteral("xtide")) hdc_name.left(5) != QStringLiteral("xtide"))
continue; continue;
if ((cdrom[i].bus_type == CDROM_BUS_SCSI) && !hasSCSI() && if ((cdrom[i].bus_type == CDROM_BUS_SCSI) && !hasSCSI() &&
(scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) && (scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) &&
@@ -277,8 +277,8 @@ void MachineStatus::iterateZIP(const std::function<void (int)> &cb) {
for (size_t i = 0; i < ZIP_NUM; i++) { for (size_t i = 0; i < ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */ /* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) && if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) &&
!hasIDE() && hdc_name != QStringLiteral("ide") && !hasIDE() && hdc_name.left(3) != QStringLiteral("ide") &&
hdc_name != QStringLiteral("xtide")) hdc_name.left(5) != QStringLiteral("xtide"))
continue; continue;
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && !hasSCSI() && if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && !hasSCSI() &&
(scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) && (scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) &&
@@ -295,8 +295,8 @@ void MachineStatus::iterateMO(const std::function<void (int)> &cb) {
for (size_t i = 0; i < MO_NUM; i++) { for (size_t i = 0; i < MO_NUM; i++) {
/* Could be Internal or External IDE.. */ /* Could be Internal or External IDE.. */
if ((mo_drives[i].bus_type == MO_BUS_ATAPI) && if ((mo_drives[i].bus_type == MO_BUS_ATAPI) &&
!hasIDE() && hdc_name != QStringLiteral("ide") && !hasIDE() && hdc_name.left(3) != QStringLiteral("ide") &&
hdc_name != QStringLiteral("xtide")) hdc_name.left(5) != QStringLiteral("xtide"))
continue; continue;
if ((mo_drives[i].bus_type == MO_BUS_SCSI) && !hasSCSI() && if ((mo_drives[i].bus_type == MO_BUS_SCSI) && !hasSCSI() &&
(scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) && (scsi_card_current[0] == 0) && (scsi_card_current[1] == 0) &&

View File

@@ -445,6 +445,10 @@ void MainWindow::closeEvent(QCloseEvent *event) {
} }
qt_nvr_save(); qt_nvr_save();
config_save(); config_save();
#ifdef __unix__
extern void xinput2_exit();
if (QApplication::platformName() == "xcb") xinput2_exit();
#endif
event->accept(); event->accept();
} }

View File

@@ -337,6 +337,7 @@ extern int nvr_save(void);
void void
plat_power_off(void) plat_power_off(void)
{ {
plat_mouse_capture(0);
confirm_exit = 0; confirm_exit = 0;
nvr_save(); nvr_save();
config_save(); config_save();

View File

@@ -120,6 +120,14 @@ void xinput2_proc()
prev_rel_coords[0] = relative_coords[0]; prev_rel_coords[0] = relative_coords[0];
prev_rel_coords[1] = relative_coords[1]; prev_rel_coords[1] = relative_coords[1];
prev_time = rawev->time; prev_time = rawev->time;
if (!mouse_capture) break;
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);
}
} }
case XI_Motion: { case XI_Motion: {
if (XKeysymToKeycode(disp, XK_Home) == 69) { if (XKeysymToKeycode(disp, XK_Home) == 69) {
@@ -144,9 +152,12 @@ void xinput2_proc()
void xinput2_exit() void xinput2_exit()
{ {
exitthread = true; if (!exitthread)
procThread->wait(5000); {
procThread->terminate(); exitthread = true;
procThread->wait(5000);
procThread->terminate();
}
} }
void xinput2_init() void xinput2_init()
@@ -175,13 +186,6 @@ void xinput2_poll()
{ {
mouse_x = xi2_mouse_x; mouse_x = xi2_mouse_x;
mouse_y = xi2_mouse_y; 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_x = 0;
xi2_mouse_y = 0; xi2_mouse_y = 0;