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. */
|
||||
if (scancode != 0xFFFF)
|
||||
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) &&
|
||||
!(lpKdhs->flags & (LLKHF_UP | LLKHF_EXTENDED)))
|
||||
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))
|
||||
ret = TRUE;
|
||||
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. */
|
||||
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::initRendererMonitorForNonQtThread, this, &MainWindow::initRendererMonitorSlot, Qt::BlockingQueuedConnection);
|
||||
connect(this, &MainWindow::destroyRendererMonitor, this, &MainWindow::destroyRendererMonitorSlot);
|
||||
@@ -696,6 +703,22 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
});
|
||||
#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->addAction(ui->actionCursor_Puck);
|
||||
actGroup->addAction(ui->actionPen);
|
||||
@@ -833,6 +856,11 @@ MainWindow::initRendererMonitorSlot(int monitor_index)
|
||||
});
|
||||
secondaryRenderer->setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
|
||||
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)
|
||||
secondaryRenderer->setFixedSize(fixed_size_x, fixed_size_y);
|
||||
@@ -1360,18 +1388,9 @@ MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
#endif
|
||||
}
|
||||
|
||||
checkFullscreenHotkey();
|
||||
|
||||
if (keyboard_ismsexit())
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -1403,28 +1422,6 @@ MainWindow::keyReleaseEvent(QKeyEvent *event)
|
||||
processKeyboardInput(false, event->nativeScanCode());
|
||||
#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
|
||||
|
||||
@@ -31,7 +31,6 @@ public:
|
||||
void blitToWidget(int x, int y, int w, int h, int monitor_index);
|
||||
QSize getRenderWidgetSize();
|
||||
void setSendKeyboardInput(bool enabled);
|
||||
void checkFullscreenHotkey();
|
||||
void reloadAllRenderers();
|
||||
|
||||
std::array<std::unique_ptr<RendererStack>, 8> renderers;
|
||||
|
||||
Reference in New Issue
Block a user