Merge pull request #2636 from Cacodemon345/qt-keyboard-shortcut-fixes

qt: Shortcut fixes
This commit is contained in:
Miran Grča
2022-10-26 17:17:11 +02:00
committed by GitHub

View File

@@ -1620,7 +1620,18 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
if (send_keyboard_input && !(kbd_req_capture && !mouse_capture && !video_fullscreen))
{
// Windows keys in Qt have one-to-one mapping.
if (event->key() == Qt::Key_Super_L || event->key() == Qt::Key_Super_R) {
if (event->key() == Qt::Key_Pause && !keyboard_recv(0x38) && !keyboard_recv(0x138)) {
if ((keyboard_recv(0x1D) || keyboard_recv(0x11D))) {
keyboard_input(1, 0x46);
} else {
keyboard_input(0, 0xE1);
keyboard_input(0, 0x1D);
keyboard_input(0, 0x45);
keyboard_input(0, 0xE1);
keyboard_input(1, 0x1D);
keyboard_input(1, 0x45);
}
} else if (event->key() == Qt::Key_Super_L || event->key() == Qt::Key_Super_R) {
keyboard_input(1, event->key() == Qt::Key_Super_L ? 0x15B : 0x15C);
} else
#ifdef Q_OS_MACOS
@@ -1637,6 +1648,12 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
if (keyboard_ismsexit()) {
plat_mouse_capture(0);
}
if ((video_fullscreen > 0) && (keyboard_recv(0x1D) || keyboard_recv(0x11D))) {
if (keyboard_recv(0x57)) ui->actionTake_screenshot->trigger();
else if (keyboard_recv(0x58)) pc_send_cad();
}
event->accept();
}
@@ -1651,6 +1668,11 @@ void MainWindow::blitToWidget(int x, int y, int w, int h, int monitor_index)
void MainWindow::keyReleaseEvent(QKeyEvent* event)
{
if (event->key() == Qt::Key_Pause) {
if (keyboard_recv(0x38) && keyboard_recv(0x138)) {
plat_pause(dopause ^ 1);
}
}
if (!send_keyboard_input)
return;