mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-03-30 16:08:26 -04:00
fix(hotkey): unlock framerate hotkey during gameplay
Signed-off-by: Collecting <collecting@noreply.localhost>
This commit is contained in:
@@ -602,6 +602,10 @@ int GRenderWindow::QtModifierToSwitchModifier(Qt::KeyboardModifiers qt_modifiers
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::keyPressEvent(QKeyEvent* event) {
|
void GRenderWindow::keyPressEvent(QKeyEvent* event) {
|
||||||
|
if (!first_frame) {
|
||||||
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (event->isAutoRepeat()) {
|
if (event->isAutoRepeat()) {
|
||||||
return; // Ignore auto-repeated key presses
|
return; // Ignore auto-repeated key presses
|
||||||
}
|
}
|
||||||
@@ -621,6 +625,12 @@ void GRenderWindow::keyPressEvent(QKeyEvent* event) {
|
|||||||
return; // Stop processing
|
return; // Stop processing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key_sequence == hotkey_registry.GetKeySequence(main_window_id, "Toggle Framerate Limit")) {
|
||||||
|
emit UnlockFramerateHotkeyPressed(); // Signal the main window
|
||||||
|
event->accept(); // Consume the event
|
||||||
|
return; // Stop processing
|
||||||
|
}
|
||||||
|
|
||||||
// --- If not a critical hotkey, pass to game as normal ---
|
// --- If not a critical hotkey, pass to game as normal ---
|
||||||
const auto modifier = QtModifierToSwitchModifier(event->modifiers());
|
const auto modifier = QtModifierToSwitchModifier(event->modifiers());
|
||||||
const auto key = QtKeyToSwitchKey(static_cast<Qt::Key>(event->key()));
|
const auto key = QtKeyToSwitchKey(static_cast<Qt::Key>(event->key()));
|
||||||
@@ -630,6 +640,10 @@ void GRenderWindow::keyPressEvent(QKeyEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::keyReleaseEvent(QKeyEvent* event) {
|
void GRenderWindow::keyReleaseEvent(QKeyEvent* event) {
|
||||||
|
if (!first_frame) {
|
||||||
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This feature can be enhanced with the following functions, but they do not provide
|
* This feature can be enhanced with the following functions, but they do not provide
|
||||||
* cross-platform behavior.
|
* cross-platform behavior.
|
||||||
|
|||||||
Reference in New Issue
Block a user