diff --git a/client/src/main.c b/client/src/main.c index 54c4bf54..ddafeae2 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -758,16 +758,17 @@ int main_frameThread(void * unused) break; } - if (frame->requestActivation) + if (frame->flags && FRAME_FLAG_REQUEST_ACTIVATION) g_state.ds->requestActivation(); - if (g_params.autoScreensaver && g_state.autoIdleInhibitState != frame->blockScreensaver) + const bool blockScreensaver = frame->flags & FRAME_FLAG_BLOCK_SCREENSAVER; + if (g_params.autoScreensaver && g_state.autoIdleInhibitState != blockScreensaver) { - if (frame->blockScreensaver) + if (blockScreensaver) g_state.ds->inhibitIdle(); else g_state.ds->uninhibitIdle(); - g_state.autoIdleInhibitState = frame->blockScreensaver; + g_state.autoIdleInhibitState = blockScreensaver; } const uint64_t t = nanotime(); diff --git a/common/include/common/KVMFR.h b/common/include/common/KVMFR.h index 7564720e..33b40982 100644 --- a/common/include/common/KVMFR.h +++ b/common/include/common/KVMFR.h @@ -28,7 +28,7 @@ #include "types.h" #define KVMFR_MAGIC "KVMFR---" -#define KVMFR_VERSION 17 +#define KVMFR_VERSION 18 #define KVMFR_MAX_DAMAGE_RECTS 64 @@ -124,6 +124,14 @@ typedef struct KVMFRCursor } KVMFRCursor; +enum +{ + FRAME_FLAG_BLOCK_SCREENSAVER = 0x1, + FRAME_FLAG_REQUEST_ACTIVATION = 0x2 +}; + +typedef uint32_t KVMFRFrameFlags; + typedef struct KVMFRFrame { uint32_t formatVer; // the frame format version number @@ -138,8 +146,7 @@ typedef struct KVMFRFrame uint32_t offset; // offset from the start of this header to the FrameBuffer header uint32_t damageRectsCount; // the number of damage rectangles (zero for full-frame damage) FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS]; - bool blockScreensaver; // whether the guest has requested to block screensavers - bool requestActivation; // whether the guest has requested activation since the last frame + KVMFRFrameFlags flags; // bit field combination of FRAME_FLAG_* } KVMFRFrame; diff --git a/host/src/app.c b/host/src/app.c index 4acabedd..7736fdac 100644 --- a/host/src/app.c +++ b/host/src/app.c @@ -275,8 +275,11 @@ static bool sendFrame(void) fi->stride = frame.stride; fi->pitch = frame.pitch; fi->offset = app.pageSize - FrameBufferStructSize; - fi->blockScreensaver = os_blockScreensaver(); - fi->requestActivation = os_getAndClearPendingActivationRequest(); + fi->flags = + (os_blockScreensaver() ? + FRAME_FLAG_BLOCK_SCREENSAVER : 0) | + (os_getAndClearPendingActivationRequest() ? + FRAME_FLAG_REQUEST_ACTIVATION : 0); app.frameValid = true; fi->damageRectsCount = frame.damageRectsCount;