qt: Capture fullscreen shortcuts on Windows raw input, fixes #3434

This commit is contained in:
RichardG867
2023-07-22 17:17:39 -03:00
parent eac6055103
commit 68382ff1b3
3 changed files with 27 additions and 14 deletions

View File

@@ -1249,11 +1249,7 @@ MainWindow::keyPressEvent(QKeyEvent *event)
#endif
}
if (!fs_off_signal && (video_fullscreen > 0) && keyboard_isfsexit())
fs_off_signal = true;
if (!fs_on_signal && (video_fullscreen == 0) && keyboard_isfsenter())
fs_on_signal = true;
checkFullscreenHotkey(true);
if (keyboard_ismsexit())
plat_mouse_capture(0);
@@ -1289,15 +1285,7 @@ MainWindow::keyReleaseEvent(QKeyEvent *event)
}
}
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;
}
checkFullscreenHotkey(false);
if (!send_keyboard_input || event->isAutoRepeat())
return;
@@ -1309,6 +1297,28 @@ MainWindow::keyReleaseEvent(QKeyEvent *event)
#endif
}
void
MainWindow::checkFullscreenHotkey(bool down)
{
if (down) {
if (!fs_off_signal && (video_fullscreen > 0) && keyboard_isfsexit())
fs_off_signal = true;
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;
}
}
}
QSize
MainWindow::getRenderWidgetSize()
{

View File

@@ -32,6 +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);
std::array<std::unique_ptr<RendererStack>, 8> renderers;
signals:

View File

@@ -237,6 +237,8 @@ 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)