Merge pull request #19902 from hrydgard/imgui-allow-input-when-unfocused

ImDebugger: Send inputs to the game when no windows are focused
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2025-01-21 12:20:29 +01:00
commit a7ce204362
1 file changed
+18 -10
+18 -10
View File
@@ -1023,10 +1023,18 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
// Enable gamepad controls while running imgui (but ignore mouse/keyboard).
switch (key.deviceId) {
case DEVICE_ID_KEYBOARD:
if (!ImGui::GetIO().WantCaptureKeyboard) {
controlMapper_.Key(key, &pauseTrigger_);
}
break;
case DEVICE_ID_MOUSE:
if (!ImGui::GetIO().WantCaptureMouse) {
controlMapper_.Key(key, &pauseTrigger_);
}
break;
default:
controlMapper_.Key(key, &pauseTrigger_);
break;
}
}
@@ -1035,6 +1043,16 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
return controlMapper_.Key(key, &pauseTrigger_);
}
void EmuScreen::UnsyncAxis(const AxisInput *axes, size_t count) {
System_Notify(SystemNotification::ACTIVITY);
if (UI::IsFocusMovementEnabled()) {
return UIScreen::UnsyncAxis(axes, count);
}
return controlMapper_.Axis(axes, count);
}
bool EmuScreen::key(const KeyInput &key) {
bool retval = UIScreen::key(key);
@@ -1062,16 +1080,6 @@ void EmuScreen::touch(const TouchInput &touch) {
}
}
void EmuScreen::UnsyncAxis(const AxisInput *axes, size_t count) {
System_Notify(SystemNotification::ACTIVITY);
if (UI::IsFocusMovementEnabled()) {
return UIScreen::UnsyncAxis(axes, count);
}
return controlMapper_.Axis(axes, count);
}
class GameInfoBGView : public UI::InertView {
public:
GameInfoBGView(const Path &gamePath, UI::LayoutParams *layoutParams) : InertView(layoutParams), gamePath_(gamePath) {}