qt: Port fullscreen key detection behavior from Win32

This commit is contained in:
RichardG867
2023-07-24 17:16:01 -03:00
parent 8d46224893
commit 0d1d069af4
3 changed files with 24 additions and 27 deletions

View File

@@ -1252,7 +1252,7 @@ MainWindow::keyPressEvent(QKeyEvent *event)
#endif
}
checkFullscreenHotkey(true);
checkFullscreenHotkey();
if (keyboard_ismsexit())
plat_mouse_capture(0);
@@ -1288,37 +1288,34 @@ MainWindow::keyReleaseEvent(QKeyEvent *event)
}
}
checkFullscreenHotkey(false);
if (!send_keyboard_input || event->isAutoRepeat())
return;
if (send_keyboard_input && !event->isAutoRepeat()) {
#ifdef Q_OS_MACOS
processMacKeyboardInput(false, event);
processMacKeyboardInput(false, event);
#else
processKeyboardInput(false, event->nativeScanCode());
processKeyboardInput(false, event->nativeScanCode());
#endif
}
checkFullscreenHotkey();
}
void
MainWindow::checkFullscreenHotkey(bool down)
MainWindow::checkFullscreenHotkey()
{
if (down) {
if (!fs_off_signal && (video_fullscreen > 0) && keyboard_isfsexit())
fs_off_signal = true;
if (!fs_off_signal && video_fullscreen && keyboard_isfsexit()) {
/* Signal "exit fullscreen mode". */
fs_off_signal = 1;
} else if (fs_off_signal && video_fullscreen && keyboard_isfsexit_up()) {
ui->actionFullscreen->trigger();
fs_off_signal = 0;
}
if (!fs_on_signal && (video_fullscreen == 0) && keyboard_isfsenter())
fs_on_signal = true;
} else {
if (fs_off_signal && (video_fullscreen > 0) && keyboard_isfsexit()) {
ui->actionFullscreen->trigger();
fs_off_signal = false;
}
if (fs_on_signal && (video_fullscreen == 0) && keyboard_isfsenter()) {
ui->actionFullscreen->trigger();
fs_on_signal = false;
}
if (!fs_on_signal && !video_fullscreen && keyboard_isfsenter()) {
/* Signal "enter fullscreen mode". */
fs_on_signal = 1;
} else if (fs_on_signal && !video_fullscreen && keyboard_isfsenter_up()) {
ui->actionFullscreen->trigger();
fs_on_signal = 0;
}
}