[client] keybind: add keybind to set the guest resolution
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

This commit is contained in:
Geoffrey McRae 2025-04-04 10:23:00 +11:00
parent 9593301511
commit 54d811e098
2 changed files with 25 additions and 2 deletions

View File

@ -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 =
{

View File

@ -25,6 +25,7 @@
#include "audio.h"
#include "core.h"
#include "kb.h"
#include "message.h"
#include <purespice.h>
#include <stdio.h>
@ -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