Make Qt shortcuts actually work in fullscreen
Also removes hacks related to fullscreen.
This commit is contained in:
@@ -194,8 +194,6 @@ win_keyboard_handle(uint32_t scancode, int up, int e0, int e1)
|
|||||||
it's not an invalid scan code. */
|
it's not an invalid scan code. */
|
||||||
if (scancode != 0xFFFF)
|
if (scancode != 0xFFFF)
|
||||||
keyboard_input(!up, scancode);
|
keyboard_input(!up, scancode);
|
||||||
|
|
||||||
main_window->checkFullscreenHotkey();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,8 +368,6 @@ emu_LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
|
|||||||
else if ((lpKdhs->scanCode == 0x3e) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
|
else if ((lpKdhs->scanCode == 0x3e) && (lpKdhs->flags & LLKHF_ALTDOWN) &&
|
||||||
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
|
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
else if ((lpKdhs->scanCode == 0x49) && bCtrlDown && !(lpKdhs->flags & LLKHF_UP))
|
|
||||||
ret = TRUE;
|
|
||||||
else if ((lpKdhs->scanCode >= 0x5b) && (lpKdhs->scanCode <= 0x5d) && (lpKdhs->flags & LLKHF_EXTENDED))
|
else if ((lpKdhs->scanCode >= 0x5b) && (lpKdhs->scanCode <= 0x5d) && (lpKdhs->flags & LLKHF_EXTENDED))
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
else if (inhibit_multimedia_keys
|
else if (inhibit_multimedia_keys
|
||||||
|
|||||||
@@ -674,6 +674,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
/* Remove default Shift+F10 handler, which unfocuses keyboard input even with no context menu. */
|
/* Remove default Shift+F10 handler, which unfocuses keyboard input even with no context menu. */
|
||||||
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F10), this), &QShortcut::activated, this, [](){});
|
connect(new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F10), this), &QShortcut::activated, this, [](){});
|
||||||
|
|
||||||
|
auto windowedShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_PageDown), this);
|
||||||
|
windowedShortcut->setContext(Qt::ShortcutContext::ApplicationShortcut);
|
||||||
|
connect(windowedShortcut, &QShortcut::activated, this, [this] () {
|
||||||
|
if (video_fullscreen)
|
||||||
|
ui->actionFullscreen->trigger();
|
||||||
|
});
|
||||||
|
|
||||||
connect(this, &MainWindow::initRendererMonitor, this, &MainWindow::initRendererMonitorSlot);
|
connect(this, &MainWindow::initRendererMonitor, this, &MainWindow::initRendererMonitorSlot);
|
||||||
connect(this, &MainWindow::initRendererMonitorForNonQtThread, this, &MainWindow::initRendererMonitorSlot, Qt::BlockingQueuedConnection);
|
connect(this, &MainWindow::initRendererMonitorForNonQtThread, this, &MainWindow::initRendererMonitorSlot, Qt::BlockingQueuedConnection);
|
||||||
connect(this, &MainWindow::destroyRendererMonitor, this, &MainWindow::destroyRendererMonitorSlot);
|
connect(this, &MainWindow::destroyRendererMonitor, this, &MainWindow::destroyRendererMonitorSlot);
|
||||||
@@ -696,6 +703,22 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QTimer::singleShot(0, this, [this]() {
|
||||||
|
for (auto curObj : this->menuBar()->children()) {
|
||||||
|
if (qobject_cast<QMenu *>(curObj)) {
|
||||||
|
auto menu = qobject_cast<QMenu *>(curObj);
|
||||||
|
for (auto curObj2 : menu->children()) {
|
||||||
|
if (qobject_cast<QAction *>(curObj2)) {
|
||||||
|
auto action = qobject_cast<QAction *>(curObj2);
|
||||||
|
if (!action->shortcut().isEmpty()) {
|
||||||
|
this->insertAction(nullptr, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
actGroup = new QActionGroup(this);
|
actGroup = new QActionGroup(this);
|
||||||
actGroup->addAction(ui->actionCursor_Puck);
|
actGroup->addAction(ui->actionCursor_Puck);
|
||||||
actGroup->addAction(ui->actionPen);
|
actGroup->addAction(ui->actionPen);
|
||||||
@@ -833,6 +856,11 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
|
|||||||
});
|
});
|
||||||
secondaryRenderer->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
secondaryRenderer->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
||||||
secondaryRenderer->setWindowTitle(QObject::tr("86Box Monitor #") + QString::number(monitor_index + 1));
|
secondaryRenderer->setWindowTitle(QObject::tr("86Box Monitor #") + QString::number(monitor_index + 1));
|
||||||
|
secondaryRenderer->setContextMenuPolicy(Qt::PreventContextMenu);
|
||||||
|
|
||||||
|
for (int i = 0; i < this->actions().size(); i++) {
|
||||||
|
secondaryRenderer->addAction(this->actions()[i]);
|
||||||
|
}
|
||||||
|
|
||||||
if (vid_resize == 2)
|
if (vid_resize == 2)
|
||||||
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
||||||
@@ -1360,18 +1388,9 @@ MainWindow::keyPressEvent(QKeyEvent *event)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
checkFullscreenHotkey();
|
|
||||||
|
|
||||||
if (keyboard_ismsexit())
|
if (keyboard_ismsexit())
|
||||||
plat_mouse_capture(0);
|
plat_mouse_capture(0);
|
||||||
|
|
||||||
if ((video_fullscreen > 0) && (keyboard_recv_ui(0x1D) || keyboard_recv_ui(0x11D))) {
|
|
||||||
if (keyboard_recv_ui(0x57))
|
|
||||||
ui->actionTake_screenshot->trigger();
|
|
||||||
else if (keyboard_recv_ui(0x58))
|
|
||||||
pc_send_cad();
|
|
||||||
}
|
|
||||||
|
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1403,28 +1422,6 @@ MainWindow::keyReleaseEvent(QKeyEvent *event)
|
|||||||
processKeyboardInput(false, event->nativeScanCode());
|
processKeyboardInput(false, event->nativeScanCode());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
checkFullscreenHotkey();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
MainWindow::checkFullscreenHotkey()
|
|
||||||
{
|
|
||||||
if (!fs_off_signal && video_fullscreen && keyboard_isfsexit()) {
|
|
||||||
/* Signal "exit fullscreen mode". */
|
|
||||||
fs_off_signal = true;
|
|
||||||
} else if (fs_off_signal && video_fullscreen && keyboard_isfsexit_up()) {
|
|
||||||
ui->actionFullscreen->trigger();
|
|
||||||
fs_off_signal = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs_on_signal && !video_fullscreen && keyboard_isfsenter()) {
|
|
||||||
/* Signal "enter fullscreen mode". */
|
|
||||||
fs_on_signal = true;
|
|
||||||
} else if (fs_on_signal && !video_fullscreen && keyboard_isfsenter_up()) {
|
|
||||||
ui->actionFullscreen->trigger();
|
|
||||||
fs_on_signal = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize
|
QSize
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public:
|
|||||||
void blitToWidget(int x, int y, int w, int h, int monitor_index);
|
void blitToWidget(int x, int y, int w, int h, int monitor_index);
|
||||||
QSize getRenderWidgetSize();
|
QSize getRenderWidgetSize();
|
||||||
void setSendKeyboardInput(bool enabled);
|
void setSendKeyboardInput(bool enabled);
|
||||||
void checkFullscreenHotkey();
|
|
||||||
void reloadAllRenderers();
|
void reloadAllRenderers();
|
||||||
|
|
||||||
std::array<std::unique_ptr<RendererStack>, 8> renderers;
|
std::array<std::unique_ptr<RendererStack>, 8> renderers;
|
||||||
|
|||||||
Reference in New Issue
Block a user