mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 13:37:22 +00:00
[all] convert KVMFR frame bools to flags in a bitfield
This will allow us to add additional flags in the future while remaining backwards compatible with the host.
This commit is contained in:
parent
29698362ed
commit
8b4551c39c
@ -758,16 +758,17 @@ int main_frameThread(void * unused)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frame->requestActivation)
|
if (frame->flags && FRAME_FLAG_REQUEST_ACTIVATION)
|
||||||
g_state.ds->requestActivation();
|
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();
|
g_state.ds->inhibitIdle();
|
||||||
else
|
else
|
||||||
g_state.ds->uninhibitIdle();
|
g_state.ds->uninhibitIdle();
|
||||||
g_state.autoIdleInhibitState = frame->blockScreensaver;
|
g_state.autoIdleInhibitState = blockScreensaver;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t t = nanotime();
|
const uint64_t t = nanotime();
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
#define KVMFR_MAGIC "KVMFR---"
|
#define KVMFR_MAGIC "KVMFR---"
|
||||||
#define KVMFR_VERSION 17
|
#define KVMFR_VERSION 18
|
||||||
|
|
||||||
#define KVMFR_MAX_DAMAGE_RECTS 64
|
#define KVMFR_MAX_DAMAGE_RECTS 64
|
||||||
|
|
||||||
@ -124,6 +124,14 @@ typedef struct KVMFRCursor
|
|||||||
}
|
}
|
||||||
KVMFRCursor;
|
KVMFRCursor;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
FRAME_FLAG_BLOCK_SCREENSAVER = 0x1,
|
||||||
|
FRAME_FLAG_REQUEST_ACTIVATION = 0x2
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef uint32_t KVMFRFrameFlags;
|
||||||
|
|
||||||
typedef struct KVMFRFrame
|
typedef struct KVMFRFrame
|
||||||
{
|
{
|
||||||
uint32_t formatVer; // the frame format version number
|
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 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)
|
uint32_t damageRectsCount; // the number of damage rectangles (zero for full-frame damage)
|
||||||
FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
|
FrameDamageRect damageRects[KVMFR_MAX_DAMAGE_RECTS];
|
||||||
bool blockScreensaver; // whether the guest has requested to block screensavers
|
KVMFRFrameFlags flags; // bit field combination of FRAME_FLAG_*
|
||||||
bool requestActivation; // whether the guest has requested activation since the last frame
|
|
||||||
}
|
}
|
||||||
KVMFRFrame;
|
KVMFRFrame;
|
||||||
|
|
||||||
|
@ -275,8 +275,11 @@ static bool sendFrame(void)
|
|||||||
fi->stride = frame.stride;
|
fi->stride = frame.stride;
|
||||||
fi->pitch = frame.pitch;
|
fi->pitch = frame.pitch;
|
||||||
fi->offset = app.pageSize - FrameBufferStructSize;
|
fi->offset = app.pageSize - FrameBufferStructSize;
|
||||||
fi->blockScreensaver = os_blockScreensaver();
|
fi->flags =
|
||||||
fi->requestActivation = os_getAndClearPendingActivationRequest();
|
(os_blockScreensaver() ?
|
||||||
|
FRAME_FLAG_BLOCK_SCREENSAVER : 0) |
|
||||||
|
(os_getAndClearPendingActivationRequest() ?
|
||||||
|
FRAME_FLAG_REQUEST_ACTIVATION : 0);
|
||||||
app.frameValid = true;
|
app.frameValid = true;
|
||||||
|
|
||||||
fi->damageRectsCount = frame.damageRectsCount;
|
fi->damageRectsCount = frame.damageRectsCount;
|
||||||
|
Loading…
Reference in New Issue
Block a user