mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-07-28 10:52:02 +00:00
[client] spice: separate clipboard state by direction
This commit is contained in:
@@ -289,9 +289,9 @@ void app_clipboardNotifySize(const LG_ClipboardData type, size_t size)
|
||||
return;
|
||||
}
|
||||
|
||||
g_state.cbType = spiceType;
|
||||
g_state.cbChunked = true;
|
||||
g_state.cbXfer = size;
|
||||
g_state.cbWriteType = spiceType;
|
||||
g_state.cbChunked = true;
|
||||
g_state.cbXfer = size;
|
||||
}
|
||||
|
||||
void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size)
|
||||
@@ -311,7 +311,7 @@ void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size)
|
||||
|
||||
if (g_state.cbChunked)
|
||||
{
|
||||
if (spiceType != g_state.cbType)
|
||||
if (spiceType != g_state.cbWriteType)
|
||||
{
|
||||
DEBUG_ERROR("SPICE clipboard transfer type changed");
|
||||
return;
|
||||
@@ -332,8 +332,8 @@ void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size)
|
||||
g_state.cbXfer -= size;
|
||||
if (g_state.cbXfer == 0)
|
||||
{
|
||||
g_state.cbType = SPICE_DATA_NONE;
|
||||
g_state.cbChunked = false;
|
||||
g_state.cbWriteType = SPICE_DATA_NONE;
|
||||
g_state.cbChunked = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -353,7 +353,8 @@ bool app_clipboardRequest(const LG_ClipboardReplyFn replyFn, void * opaque)
|
||||
if (!g_params.clipboardToLocal || !replyFn || !g_state.cbRequestList)
|
||||
return false;
|
||||
|
||||
const PSDataType type = g_state.cbType;
|
||||
const PSDataType type = atomic_load_explicit(
|
||||
&g_state.cbRemoteType, memory_order_acquire);
|
||||
struct CBRequest * cbr = malloc(sizeof(*cbr));
|
||||
if (!cbr)
|
||||
{
|
||||
|
||||
@@ -62,7 +62,8 @@ void cb_spiceNotice(const PSDataType type)
|
||||
if (!g_state.cbAvailable)
|
||||
return;
|
||||
|
||||
g_state.cbType = type;
|
||||
atomic_store_explicit(
|
||||
&g_state.cbRemoteType, type, memory_order_release);
|
||||
g_state.ds->cbNotice(cb_spiceTypeToLGType(type));
|
||||
}
|
||||
|
||||
@@ -113,6 +114,9 @@ void cb_spiceRelease(void)
|
||||
if (!g_params.clipboardToLocal)
|
||||
return;
|
||||
|
||||
atomic_store_explicit(
|
||||
&g_state.cbRemoteType, SPICE_DATA_NONE, memory_order_release);
|
||||
|
||||
if (g_state.cbAvailable)
|
||||
g_state.ds->cbRelease();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,11 @@ static LGEvent *e_spice = NULL;
|
||||
static LGThread *t_spice = NULL;
|
||||
static LGThread *t_render = NULL;
|
||||
|
||||
struct AppState g_state = { 0 };
|
||||
struct AppState g_state =
|
||||
{
|
||||
.cbRemoteType = SPICE_DATA_NONE,
|
||||
.cbWriteType = SPICE_DATA_NONE,
|
||||
};
|
||||
struct CursorState g_cursor;
|
||||
|
||||
// this structure is initialized in config.c
|
||||
|
||||
@@ -123,7 +123,8 @@ struct AppState
|
||||
bool useDMA;
|
||||
|
||||
bool cbAvailable;
|
||||
PSDataType cbType;
|
||||
_Atomic(PSDataType) cbRemoteType;
|
||||
PSDataType cbWriteType;
|
||||
bool cbChunked;
|
||||
size_t cbXfer;
|
||||
struct ll * cbRequestList;
|
||||
|
||||
Reference in New Issue
Block a user