From 2b66fa61365fb332f17ea3f080fa6e844cc2a21c Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 21 Dec 2017 06:38:56 +1100 Subject: [PATCH] [client] warn about unreliable cursor scaling This also logs the scaling information to assist with reports about improper mouse alignment --- client/main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/client/main.c b/client/main.c index f15f44b0..670b7ba3 100644 --- a/client/main.c +++ b/client/main.c @@ -154,11 +154,18 @@ static inline void updatePositionInfo() state.dstRect.h = h; } - if (state.started) - { - state.scaleX = (float)state.srcSize.y / (float)state.dstRect.h; - state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w; - } + state.scaleX = (float)state.srcSize.y / (float)state.dstRect.h; + state.scaleY = (float)state.srcSize.x / (float)state.dstRect.w; + + DEBUG_INFO("client %dx%d, guest %dx%d, target %dx%d, scaleX: %.2f, scaleY %.2f", + w, h, + state.srcSize.x, state.srcSize.y, + state.dstRect.w, state.dstRect.h, + state.scaleX , state.scaleY + ); + + if (w != state.srcSize.x || h != state.srcSize.y) + DEBUG_WARN("Window size doesn't match guest resolution, cursor alignment may not be reliable"); if (state.lgr) state.lgr->on_resize(state.lgrData, w, h, state.dstRect);