[client] spice: update submodule and refactor calls & types

This commit is contained in:
Geoffrey McRae 2021-12-28 22:03:48 +11:00
parent e7fdf7e77a
commit 65ba2e8df9
8 changed files with 48 additions and 48 deletions

View File

@ -154,7 +154,7 @@ void app_clipboardRelease(void)
if (!g_params.clipboardToVM) if (!g_params.clipboardToVM)
return; return;
spice_clipboard_release(); purespice_clipboardRelease();
} }
void app_clipboardNotifyTypes(const LG_ClipboardData types[], int count) void app_clipboardNotifyTypes(const LG_ClipboardData types[], int count)
@ -164,15 +164,15 @@ void app_clipboardNotifyTypes(const LG_ClipboardData types[], int count)
if (count == 0) if (count == 0)
{ {
spice_clipboard_release(); purespice_clipboardRelease();
return; return;
} }
SpiceDataType conv[count]; PSDataType conv[count];
for(int i = 0; i < count; ++i) for(int i = 0; i < count; ++i)
conv[i] = cb_lgTypeToSpiceType(types[i]); conv[i] = cb_lgTypeToSpiceType(types[i]);
spice_clipboard_grab(conv, count); purespice_clipboardGrab(conv, count);
} }
void app_clipboardNotifySize(const LG_ClipboardData type, size_t size) void app_clipboardNotifySize(const LG_ClipboardData type, size_t size)
@ -182,7 +182,7 @@ void app_clipboardNotifySize(const LG_ClipboardData type, size_t size)
if (type == LG_CLIPBOARD_DATA_NONE) if (type == LG_CLIPBOARD_DATA_NONE)
{ {
spice_clipboard_release(); purespice_clipboardRelease();
return; return;
} }
@ -190,7 +190,7 @@ void app_clipboardNotifySize(const LG_ClipboardData type, size_t size)
g_state.cbChunked = size > 0; g_state.cbChunked = size > 0;
g_state.cbXfer = size; g_state.cbXfer = size;
spice_clipboard_data_start(g_state.cbType, size); purespice_clipboardDataStart(g_state.cbType, size);
} }
void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size) void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size)
@ -205,9 +205,9 @@ void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size)
} }
if (!g_state.cbChunked) if (!g_state.cbChunked)
spice_clipboard_data_start(g_state.cbType, size); purespice_clipboardDataStart(g_state.cbType, size);
spice_clipboard_data(g_state.cbType, data, (uint32_t)size); purespice_clipboardData(g_state.cbType, data, (uint32_t)size);
g_state.cbXfer -= size; g_state.cbXfer -= size;
} }
@ -223,7 +223,7 @@ void app_clipboardRequest(const LG_ClipboardReplyFn replyFn, void * opaque)
cbr->opaque = opaque; cbr->opaque = opaque;
ll_push(g_state.cbRequestList, cbr); ll_push(g_state.cbRequestList, cbr);
spice_clipboard_request(g_state.cbType); purespice_clipboardRequest(g_state.cbType);
} }
static int mapSpiceToImGuiButton(uint32_t button) static int mapSpiceToImGuiButton(uint32_t button)
@ -256,7 +256,7 @@ void app_handleButtonPress(int button)
if (!core_inputEnabled() || !g_cursor.inView) if (!core_inputEnabled() || !g_cursor.inView)
return; return;
if (!spice_mouse_press(button)) if (!purespice_mousePress(button))
DEBUG_ERROR("app_handleButtonPress: failed to send message"); DEBUG_ERROR("app_handleButtonPress: failed to send message");
} }
@ -275,7 +275,7 @@ void app_handleButtonRelease(int button)
if (!core_inputEnabled()) if (!core_inputEnabled())
return; return;
if (!spice_mouse_release(button)) if (!purespice_mouseRelease(button))
DEBUG_ERROR("app_handleButtonRelease: failed to send message"); DEBUG_ERROR("app_handleButtonRelease: failed to send message");
} }
@ -325,7 +325,7 @@ void app_handleKeyPress(int sc)
if (!ps2) if (!ps2)
return; return;
if (spice_key_down(ps2)) if (purespice_keyDown(ps2))
g_state.keyDown[sc] = true; g_state.keyDown[sc] = true;
else else
{ {
@ -378,7 +378,7 @@ void app_handleKeyRelease(int sc)
if (!ps2) if (!ps2)
return; return;
if (spice_key_up(ps2)) if (purespice_keyUp(ps2))
g_state.keyDown[sc] = false; g_state.keyDown[sc] = false;
else else
{ {
@ -410,7 +410,7 @@ void app_handleKeyboardLEDs(bool numLock, bool capsLock, bool scrollLock)
(numLock ? 2 /* SPICE_NUM_LOCK_MODIFIER */ : 0) | (numLock ? 2 /* SPICE_NUM_LOCK_MODIFIER */ : 0) |
(capsLock ? 4 /* SPICE_CAPS_LOCK_MODIFIER */ : 0); (capsLock ? 4 /* SPICE_CAPS_LOCK_MODIFIER */ : 0);
if (!spice_key_modifiers(modifiers)) if (!purespice_keyModifiers(modifiers))
DEBUG_ERROR("app_handleKeyboardLEDs: failed to send message"); DEBUG_ERROR("app_handleKeyboardLEDs: failed to send message");
} }
@ -468,7 +468,7 @@ void app_handleMouseBasic()
g_cursor.projected.x += x; g_cursor.projected.x += x;
g_cursor.projected.y += y; g_cursor.projected.y += y;
if (!spice_mouse_motion(x, y)) if (!purespice_mouseMotion(x, y))
DEBUG_ERROR("failed to send mouse motion message"); DEBUG_ERROR("failed to send mouse motion message");
} }

View File

@ -25,7 +25,7 @@
#include "common/debug.h" #include "common/debug.h"
LG_ClipboardData cb_spiceTypeToLGType(const SpiceDataType type) LG_ClipboardData cb_spiceTypeToLGType(const PSDataType type)
{ {
switch(type) switch(type)
{ {
@ -40,7 +40,7 @@ LG_ClipboardData cb_spiceTypeToLGType(const SpiceDataType type)
} }
} }
SpiceDataType cb_lgTypeToSpiceType(const LG_ClipboardData type) PSDataType cb_lgTypeToSpiceType(const LG_ClipboardData type)
{ {
switch(type) switch(type)
{ {
@ -55,7 +55,7 @@ SpiceDataType cb_lgTypeToSpiceType(const LG_ClipboardData type)
} }
} }
void cb_spiceNotice(const SpiceDataType type) void cb_spiceNotice(const PSDataType type)
{ {
if (!g_params.clipboardToLocal) if (!g_params.clipboardToLocal)
return; return;
@ -67,7 +67,7 @@ void cb_spiceNotice(const SpiceDataType type)
g_state.ds->cbNotice(cb_spiceTypeToLGType(type)); g_state.ds->cbNotice(cb_spiceTypeToLGType(type));
} }
void cb_spiceData(const SpiceDataType type, uint8_t * buffer, uint32_t size) void cb_spiceData(const PSDataType type, uint8_t * buffer, uint32_t size)
{ {
if (!g_params.clipboardToLocal) if (!g_params.clipboardToLocal)
return; return;
@ -107,7 +107,7 @@ void cb_spiceRelease(void)
g_state.ds->cbRelease(); g_state.ds->cbRelease();
} }
void cb_spiceRequest(const SpiceDataType type) void cb_spiceRequest(const PSDataType type)
{ {
if (!g_params.clipboardToVM) if (!g_params.clipboardToVM)
return; return;

View File

@ -21,10 +21,10 @@
#include "spice/spice.h" #include "spice/spice.h"
#include "interface/displayserver.h" #include "interface/displayserver.h"
LG_ClipboardData cb_spiceTypeToLGType(const SpiceDataType type); LG_ClipboardData cb_spiceTypeToLGType(const PSDataType type);
SpiceDataType cb_lgTypeToSpiceType(const LG_ClipboardData type); PSDataType cb_lgTypeToSpiceType(const LG_ClipboardData type);
void cb_spiceNotice(const SpiceDataType type); void cb_spiceNotice(const PSDataType type);
void cb_spiceData(const SpiceDataType type, uint8_t * buffer, uint32_t size); void cb_spiceData(const PSDataType type, uint8_t * buffer, uint32_t size);
void cb_spiceRelease(void); void cb_spiceRelease(void);
void cb_spiceRequest(const SpiceDataType type); void cb_spiceRequest(const PSDataType type);

View File

@ -411,7 +411,7 @@ void core_handleMouseGrabbed(double ex, double ey)
if (x == 0 && y == 0) if (x == 0 && y == 0)
return; return;
if (!spice_mouse_motion(x, y)) if (!purespice_mouseMotion(x, y))
DEBUG_ERROR("failed to send mouse motion message"); DEBUG_ERROR("failed to send mouse motion message");
} }
@ -612,7 +612,7 @@ void core_handleMouseNormal(double ex, double ey)
g_cursor.guest.y += y; g_cursor.guest.y += y;
} }
if (!spice_mouse_motion(x, y)) if (!purespice_mouseMotion(x, y))
DEBUG_ERROR("failed to send mouse motion message"); DEBUG_ERROR("failed to send mouse motion message");
} }

View File

@ -113,20 +113,20 @@ static void bind_ctrlAltFn(int sc, void * opaque)
const uint32_t ctrl = linux_to_ps2[KEY_LEFTCTRL]; const uint32_t ctrl = linux_to_ps2[KEY_LEFTCTRL];
const uint32_t alt = linux_to_ps2[KEY_LEFTALT ]; const uint32_t alt = linux_to_ps2[KEY_LEFTALT ];
const uint32_t fn = linux_to_ps2[sc]; const uint32_t fn = linux_to_ps2[sc];
spice_key_down(ctrl); purespice_keyDown(ctrl);
spice_key_down(alt ); purespice_keyDown(alt );
spice_key_down(fn ); purespice_keyDown(fn );
spice_key_up(ctrl); purespice_keyUp(ctrl);
spice_key_up(alt ); purespice_keyUp(alt );
spice_key_up(fn ); purespice_keyUp(fn );
} }
static void bind_passthrough(int sc, void * opaque) static void bind_passthrough(int sc, void * opaque)
{ {
sc = linux_to_ps2[sc]; sc = linux_to_ps2[sc];
spice_key_down(sc); purespice_keyDown(sc);
spice_key_up (sc); purespice_keyUp (sc);
} }
static void bind_toggleOverlay(int sc, void * opaque) static void bind_toggleOverlay(int sc, void * opaque)

View File

@ -768,7 +768,7 @@ int main_frameThread(void * unused)
int spiceThread(void * arg) int spiceThread(void * arg)
{ {
while(g_state.state != APP_STATE_SHUTDOWN) while(g_state.state != APP_STATE_SHUTDOWN)
if (!spice_process(100)) if (!purespice_process(100))
{ {
if (g_state.state != APP_STATE_SHUTDOWN) if (g_state.state != APP_STATE_SHUTDOWN)
{ {
@ -1004,36 +1004,36 @@ static int lg_run(void)
g_params.useSpiceAudio) g_params.useSpiceAudio)
{ {
if (g_params.useSpiceClipboard) if (g_params.useSpiceClipboard)
spice_set_clipboard_cb( purespice_setClipboardCb(
cb_spiceNotice, cb_spiceNotice,
cb_spiceData, cb_spiceData,
cb_spiceRelease, cb_spiceRelease,
cb_spiceRequest); cb_spiceRequest);
if (g_params.useSpiceAudio) if (g_params.useSpiceAudio)
spice_set_audio_cb( purespice_setAudioCb(
audioStart, audioStart,
audioVolume, audioVolume,
audioMute, audioMute,
audioStop, audioStop,
audioData); audioData);
if (!spice_connect(g_params.spiceHost, g_params.spicePort, "", if (!purespice_connect(g_params.spiceHost, g_params.spicePort, "",
g_params.useSpiceAudio)) g_params.useSpiceAudio))
{ {
DEBUG_ERROR("Failed to connect to spice server"); DEBUG_ERROR("Failed to connect to spice server");
return -1; return -1;
} }
while(g_state.state != APP_STATE_SHUTDOWN && !spice_ready()) while(g_state.state != APP_STATE_SHUTDOWN && !purespice_ready())
if (!spice_process(1000)) if (!purespice_process(1000))
{ {
g_state.state = APP_STATE_SHUTDOWN; g_state.state = APP_STATE_SHUTDOWN;
DEBUG_ERROR("Failed to process spice messages"); DEBUG_ERROR("Failed to process spice messages");
return -1; return -1;
} }
spice_mouse_mode(true); purespice_mouseMode(true);
if (!lgCreateThread("spiceThread", spiceThread, NULL, &t_spice)) if (!lgCreateThread("spiceThread", spiceThread, NULL, &t_spice))
{ {
DEBUG_ERROR("spice create thread failed"); DEBUG_ERROR("spice create thread failed");
@ -1330,16 +1330,16 @@ static void lg_shutdown(void)
} }
// if spice is still connected send key up events for any pressed keys // if spice is still connected send key up events for any pressed keys
if (g_params.useSpiceInput && spice_ready()) if (g_params.useSpiceInput && purespice_ready())
{ {
for(int scancode = 0; scancode < KEY_MAX; ++scancode) for(int scancode = 0; scancode < KEY_MAX; ++scancode)
if (g_state.keyDown[scancode]) if (g_state.keyDown[scancode])
{ {
g_state.keyDown[scancode] = false; g_state.keyDown[scancode] = false;
spice_key_up(scancode); purespice_keyUp(scancode);
} }
spice_disconnect(); purespice_disconnect();
if (t_spice) if (t_spice)
lgJoinThread(t_spice, NULL); lgJoinThread(t_spice, NULL);
} }

View File

@ -101,7 +101,7 @@ struct AppState
bool useDMA; bool useDMA;
bool cbAvailable; bool cbAvailable;
SpiceDataType cbType; PSDataType cbType;
bool cbChunked; bool cbChunked;
size_t cbXfer; size_t cbXfer;
struct ll * cbRequestList; struct ll * cbRequestList;
@ -201,7 +201,7 @@ struct AppParams
struct CBRequest struct CBRequest
{ {
SpiceDataType type; PSDataType type;
LG_ClipboardReplyFn replyFn; LG_ClipboardReplyFn replyFn;
void * opaque; void * opaque;
}; };

@ -1 +1 @@
Subproject commit 1178cbb400719c026749a64e2f7f7992c49140d2 Subproject commit b85e30fc2c416d5044612d472017b4e168ea3ff5