Merge branch 'master' of ssh://github.com/86Box/86Box into cleanup30
This commit is contained in:
@@ -214,6 +214,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(qApp, &QGuiApplication::applicationStateChanged, [this](Qt::ApplicationState state) {
|
||||||
|
if (mouse_capture && state != Qt::ApplicationState::ApplicationActive)
|
||||||
|
emit setMouseCapture(false);
|
||||||
|
});
|
||||||
|
|
||||||
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
|
connect(this, &MainWindow::resizeContents, this, [this](int w, int h) {
|
||||||
if (!QApplication::platformName().contains("eglfs") && vid_resize == 0) {
|
if (!QApplication::platformName().contains("eglfs") && vid_resize == 0) {
|
||||||
w = qRound(w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
|
w = qRound(w / (!dpi_scale ? util::screenOfWidget(this)->devicePixelRatio() : 1.));
|
||||||
@@ -1265,6 +1270,8 @@ void MainWindow::on_actionFullscreen_triggered() {
|
|||||||
} else {
|
} else {
|
||||||
if (video_fullscreen_first)
|
if (video_fullscreen_first)
|
||||||
{
|
{
|
||||||
|
bool wasCaptured = mouse_capture == 1;
|
||||||
|
|
||||||
QMessageBox questionbox(QMessageBox::Icon::Information, tr("Entering fullscreen mode"), tr("Press Ctrl+Alt+PgDn to return to windowed mode."), QMessageBox::Ok, this);
|
QMessageBox questionbox(QMessageBox::Icon::Information, tr("Entering fullscreen mode"), tr("Press Ctrl+Alt+PgDn to return to windowed mode."), QMessageBox::Ok, this);
|
||||||
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
|
QCheckBox *chkbox = new QCheckBox(tr("Don't show this message again"));
|
||||||
questionbox.setCheckBox(chkbox);
|
questionbox.setCheckBox(chkbox);
|
||||||
@@ -1275,6 +1282,10 @@ void MainWindow::on_actionFullscreen_triggered() {
|
|||||||
});
|
});
|
||||||
questionbox.exec();
|
questionbox.exec();
|
||||||
config_save();
|
config_save();
|
||||||
|
|
||||||
|
/* (re-capture mouse after dialog. */
|
||||||
|
if (wasCaptured)
|
||||||
|
emit setMouseCapture(true);
|
||||||
}
|
}
|
||||||
video_fullscreen = 1;
|
video_fullscreen = 1;
|
||||||
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||||
@@ -1305,22 +1316,27 @@ bool MainWindow::eventFilter(QObject* receiver, QEvent* event)
|
|||||||
if (this->keyboardGrabber() == this) {
|
if (this->keyboardGrabber() == this) {
|
||||||
if (event->type() == QEvent::KeyPress) {
|
if (event->type() == QEvent::KeyPress) {
|
||||||
event->accept();
|
event->accept();
|
||||||
this->keyPressEvent((QKeyEvent*)event);
|
this->keyPressEvent((QKeyEvent *) event);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (event->type() == QEvent::KeyRelease) {
|
if (event->type() == QEvent::KeyRelease) {
|
||||||
event->accept();
|
event->accept();
|
||||||
this->keyReleaseEvent((QKeyEvent*)event);
|
this->keyReleaseEvent((QKeyEvent *) event);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receiver == this)
|
if (receiver == this) {
|
||||||
{
|
|
||||||
static auto curdopause = dopause;
|
static auto curdopause = dopause;
|
||||||
if (event->type() == QEvent::WindowBlocked) { curdopause = dopause; plat_pause(1); }
|
if (event->type() == QEvent::WindowBlocked) {
|
||||||
else if (event->type() == QEvent::WindowUnblocked) { plat_pause(curdopause); }
|
curdopause = dopause;
|
||||||
|
plat_pause(1);
|
||||||
|
emit setMouseCapture(false);
|
||||||
|
} else if (event->type() == QEvent::WindowUnblocked) {
|
||||||
|
plat_pause(curdopause);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return QMainWindow::eventFilter(receiver, event);
|
return QMainWindow::eventFilter(receiver, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user