qt: Port fullscreen key detection behavior from Win32
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
void blitToWidget(int x, int y, int w, int h, int monitor_index);
|
||||
QSize getRenderWidgetSize();
|
||||
void setSendKeyboardInput(bool enabled);
|
||||
void checkFullscreenHotkey(bool down);
|
||||
void checkFullscreenHotkey();
|
||||
|
||||
std::array<std::unique_ptr<RendererStack>, 8> renderers;
|
||||
signals:
|
||||
|
@@ -237,8 +237,6 @@ WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
||||
break;
|
||||
}
|
||||
|
||||
window->checkFullscreenHotkey(!(rawKB.Flags & RI_KEY_BREAK));
|
||||
|
||||
/* Translate right CTRL to left ALT if the user has so
|
||||
chosen. */
|
||||
if ((scancode == 0x11d) && rctrl_is_lalt)
|
||||
@@ -248,6 +246,8 @@ WindowsRawInputFilter::keyboard_handle(PRAWINPUT raw)
|
||||
it's not an invalid scan code. */
|
||||
if (scancode != 0xFFFF)
|
||||
keyboard_input(!(rawKB.Flags & RI_KEY_BREAK), scancode);
|
||||
|
||||
window->checkFullscreenHotkey();
|
||||
}
|
||||
} else {
|
||||
if (rawKB.MakeCode == 0x1D) {
|
||||
|
Reference in New Issue
Block a user