diff --git a/client/src/core.c b/client/src/core.c index 6fdf618b..30698031 100644 --- a/client/src/core.c +++ b/client/src/core.c @@ -192,7 +192,7 @@ bool core_warpPointer(int x, int y, bool exiting) void core_onWindowSizeChanged(unsigned width, unsigned height) { - if (!g_params.setGuestRes || !g_state.pointerQueue) + if (!g_state.pointerQueue) return; if (g_state.srcSize.x == width && g_state.srcSize.y == height) @@ -214,7 +214,7 @@ void core_onWindowSizeChanged(unsigned width, unsigned height) void core_updatePositionInfo(void) { - if (g_state.kvmfrFeatures & KVMFR_FEATURE_WINDOWSIZE) + if (g_params.setGuestRes && g_state.kvmfrFeatures & KVMFR_FEATURE_WINDOWSIZE) { LGMsg msg = { diff --git a/client/src/keybind.c b/client/src/keybind.c index ffc1db4c..c95e3968 100644 --- a/client/src/keybind.c +++ b/client/src/keybind.c @@ -25,6 +25,7 @@ #include "audio.h" #include "core.h" #include "kb.h" +#include "message.h" #include #include @@ -125,6 +126,26 @@ static void bind_toggleKey(int sc, void * opaque) purespice_keyUp((uintptr_t) opaque); } +static void bind_setGuestRes(int sc, void * opaque) +{ + if (!(g_state.kvmfrFeatures & KVMFR_FEATURE_WINDOWSIZE)) + { + app_alert(LG_ALERT_INFO, "The guest doesn't support this feature"); + return; + } + + LGMsg msg = + { + .type = LG_MSG_WINDOWSIZE, + .windowSize = + { + .width = g_state.windowW, + .height = g_state.windowH + } + }; + lgMessage_post(&msg); +} + void keybind_commonRegister(void) { app_registerKeybind(0, 'F', bind_fullscreen , NULL, @@ -137,6 +158,8 @@ void keybind_commonRegister(void) "Quit"); app_registerKeybind(0, 'O', bind_toggleOverlay, NULL, "Toggle overlay"); + app_registerKeybind(0, '=', bind_setGuestRes, NULL, + "Set guest resolution to match window size"); } #if ENABLE_AUDIO