mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 00:28:20 +00:00
[client] spice: update submodule and refactor calls & types
This commit is contained in:
parent
e7fdf7e77a
commit
65ba2e8df9
@ -154,7 +154,7 @@ void app_clipboardRelease(void)
|
||||
if (!g_params.clipboardToVM)
|
||||
return;
|
||||
|
||||
spice_clipboard_release();
|
||||
purespice_clipboardRelease();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
spice_clipboard_release();
|
||||
purespice_clipboardRelease();
|
||||
return;
|
||||
}
|
||||
|
||||
SpiceDataType conv[count];
|
||||
PSDataType conv[count];
|
||||
for(int i = 0; i < count; ++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)
|
||||
@ -182,7 +182,7 @@ void app_clipboardNotifySize(const LG_ClipboardData type, size_t size)
|
||||
|
||||
if (type == LG_CLIPBOARD_DATA_NONE)
|
||||
{
|
||||
spice_clipboard_release();
|
||||
purespice_clipboardRelease();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ void app_clipboardNotifySize(const LG_ClipboardData type, size_t size)
|
||||
g_state.cbChunked = size > 0;
|
||||
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)
|
||||
@ -205,9 +205,9 @@ void app_clipboardData(const LG_ClipboardData type, uint8_t * data, size_t size)
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ void app_clipboardRequest(const LG_ClipboardReplyFn replyFn, void * opaque)
|
||||
cbr->opaque = opaque;
|
||||
ll_push(g_state.cbRequestList, cbr);
|
||||
|
||||
spice_clipboard_request(g_state.cbType);
|
||||
purespice_clipboardRequest(g_state.cbType);
|
||||
}
|
||||
|
||||
static int mapSpiceToImGuiButton(uint32_t button)
|
||||
@ -256,7 +256,7 @@ void app_handleButtonPress(int button)
|
||||
if (!core_inputEnabled() || !g_cursor.inView)
|
||||
return;
|
||||
|
||||
if (!spice_mouse_press(button))
|
||||
if (!purespice_mousePress(button))
|
||||
DEBUG_ERROR("app_handleButtonPress: failed to send message");
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ void app_handleButtonRelease(int button)
|
||||
if (!core_inputEnabled())
|
||||
return;
|
||||
|
||||
if (!spice_mouse_release(button))
|
||||
if (!purespice_mouseRelease(button))
|
||||
DEBUG_ERROR("app_handleButtonRelease: failed to send message");
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ void app_handleKeyPress(int sc)
|
||||
if (!ps2)
|
||||
return;
|
||||
|
||||
if (spice_key_down(ps2))
|
||||
if (purespice_keyDown(ps2))
|
||||
g_state.keyDown[sc] = true;
|
||||
else
|
||||
{
|
||||
@ -378,7 +378,7 @@ void app_handleKeyRelease(int sc)
|
||||
if (!ps2)
|
||||
return;
|
||||
|
||||
if (spice_key_up(ps2))
|
||||
if (purespice_keyUp(ps2))
|
||||
g_state.keyDown[sc] = false;
|
||||
else
|
||||
{
|
||||
@ -410,7 +410,7 @@ void app_handleKeyboardLEDs(bool numLock, bool capsLock, bool scrollLock)
|
||||
(numLock ? 2 /* SPICE_NUM_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");
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ void app_handleMouseBasic()
|
||||
g_cursor.projected.x += x;
|
||||
g_cursor.projected.y += y;
|
||||
|
||||
if (!spice_mouse_motion(x, y))
|
||||
if (!purespice_mouseMotion(x, y))
|
||||
DEBUG_ERROR("failed to send mouse motion message");
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
LG_ClipboardData cb_spiceTypeToLGType(const SpiceDataType type)
|
||||
LG_ClipboardData cb_spiceTypeToLGType(const PSDataType 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)
|
||||
{
|
||||
@ -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)
|
||||
return;
|
||||
@ -67,7 +67,7 @@ void cb_spiceNotice(const SpiceDataType 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)
|
||||
return;
|
||||
@ -107,7 +107,7 @@ void cb_spiceRelease(void)
|
||||
g_state.ds->cbRelease();
|
||||
}
|
||||
|
||||
void cb_spiceRequest(const SpiceDataType type)
|
||||
void cb_spiceRequest(const PSDataType type)
|
||||
{
|
||||
if (!g_params.clipboardToVM)
|
||||
return;
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include "spice/spice.h"
|
||||
#include "interface/displayserver.h"
|
||||
|
||||
LG_ClipboardData cb_spiceTypeToLGType(const SpiceDataType type);
|
||||
SpiceDataType cb_lgTypeToSpiceType(const LG_ClipboardData type);
|
||||
LG_ClipboardData cb_spiceTypeToLGType(const PSDataType type);
|
||||
PSDataType cb_lgTypeToSpiceType(const LG_ClipboardData type);
|
||||
|
||||
void cb_spiceNotice(const SpiceDataType type);
|
||||
void cb_spiceData(const SpiceDataType type, uint8_t * buffer, uint32_t size);
|
||||
void cb_spiceNotice(const PSDataType type);
|
||||
void cb_spiceData(const PSDataType type, uint8_t * buffer, uint32_t size);
|
||||
void cb_spiceRelease(void);
|
||||
void cb_spiceRequest(const SpiceDataType type);
|
||||
void cb_spiceRequest(const PSDataType type);
|
||||
|
@ -411,7 +411,7 @@ void core_handleMouseGrabbed(double ex, double ey)
|
||||
if (x == 0 && y == 0)
|
||||
return;
|
||||
|
||||
if (!spice_mouse_motion(x, y))
|
||||
if (!purespice_mouseMotion(x, y))
|
||||
DEBUG_ERROR("failed to send mouse motion message");
|
||||
}
|
||||
|
||||
@ -612,7 +612,7 @@ void core_handleMouseNormal(double ex, double ey)
|
||||
g_cursor.guest.y += y;
|
||||
}
|
||||
|
||||
if (!spice_mouse_motion(x, y))
|
||||
if (!purespice_mouseMotion(x, y))
|
||||
DEBUG_ERROR("failed to send mouse motion message");
|
||||
}
|
||||
|
||||
|
@ -113,20 +113,20 @@ static void bind_ctrlAltFn(int sc, void * opaque)
|
||||
const uint32_t ctrl = linux_to_ps2[KEY_LEFTCTRL];
|
||||
const uint32_t alt = linux_to_ps2[KEY_LEFTALT ];
|
||||
const uint32_t fn = linux_to_ps2[sc];
|
||||
spice_key_down(ctrl);
|
||||
spice_key_down(alt );
|
||||
spice_key_down(fn );
|
||||
purespice_keyDown(ctrl);
|
||||
purespice_keyDown(alt );
|
||||
purespice_keyDown(fn );
|
||||
|
||||
spice_key_up(ctrl);
|
||||
spice_key_up(alt );
|
||||
spice_key_up(fn );
|
||||
purespice_keyUp(ctrl);
|
||||
purespice_keyUp(alt );
|
||||
purespice_keyUp(fn );
|
||||
}
|
||||
|
||||
static void bind_passthrough(int sc, void * opaque)
|
||||
{
|
||||
sc = linux_to_ps2[sc];
|
||||
spice_key_down(sc);
|
||||
spice_key_up (sc);
|
||||
purespice_keyDown(sc);
|
||||
purespice_keyUp (sc);
|
||||
}
|
||||
|
||||
static void bind_toggleOverlay(int sc, void * opaque)
|
||||
|
@ -768,7 +768,7 @@ int main_frameThread(void * unused)
|
||||
int spiceThread(void * arg)
|
||||
{
|
||||
while(g_state.state != APP_STATE_SHUTDOWN)
|
||||
if (!spice_process(100))
|
||||
if (!purespice_process(100))
|
||||
{
|
||||
if (g_state.state != APP_STATE_SHUTDOWN)
|
||||
{
|
||||
@ -1004,36 +1004,36 @@ static int lg_run(void)
|
||||
g_params.useSpiceAudio)
|
||||
{
|
||||
if (g_params.useSpiceClipboard)
|
||||
spice_set_clipboard_cb(
|
||||
purespice_setClipboardCb(
|
||||
cb_spiceNotice,
|
||||
cb_spiceData,
|
||||
cb_spiceRelease,
|
||||
cb_spiceRequest);
|
||||
|
||||
if (g_params.useSpiceAudio)
|
||||
spice_set_audio_cb(
|
||||
purespice_setAudioCb(
|
||||
audioStart,
|
||||
audioVolume,
|
||||
audioMute,
|
||||
audioStop,
|
||||
audioData);
|
||||
|
||||
if (!spice_connect(g_params.spiceHost, g_params.spicePort, "",
|
||||
if (!purespice_connect(g_params.spiceHost, g_params.spicePort, "",
|
||||
g_params.useSpiceAudio))
|
||||
{
|
||||
DEBUG_ERROR("Failed to connect to spice server");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(g_state.state != APP_STATE_SHUTDOWN && !spice_ready())
|
||||
if (!spice_process(1000))
|
||||
while(g_state.state != APP_STATE_SHUTDOWN && !purespice_ready())
|
||||
if (!purespice_process(1000))
|
||||
{
|
||||
g_state.state = APP_STATE_SHUTDOWN;
|
||||
DEBUG_ERROR("Failed to process spice messages");
|
||||
return -1;
|
||||
}
|
||||
|
||||
spice_mouse_mode(true);
|
||||
purespice_mouseMode(true);
|
||||
if (!lgCreateThread("spiceThread", spiceThread, NULL, &t_spice))
|
||||
{
|
||||
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 (g_params.useSpiceInput && spice_ready())
|
||||
if (g_params.useSpiceInput && purespice_ready())
|
||||
{
|
||||
for(int scancode = 0; scancode < KEY_MAX; ++scancode)
|
||||
if (g_state.keyDown[scancode])
|
||||
{
|
||||
g_state.keyDown[scancode] = false;
|
||||
spice_key_up(scancode);
|
||||
purespice_keyUp(scancode);
|
||||
}
|
||||
|
||||
spice_disconnect();
|
||||
purespice_disconnect();
|
||||
if (t_spice)
|
||||
lgJoinThread(t_spice, NULL);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ struct AppState
|
||||
bool useDMA;
|
||||
|
||||
bool cbAvailable;
|
||||
SpiceDataType cbType;
|
||||
PSDataType cbType;
|
||||
bool cbChunked;
|
||||
size_t cbXfer;
|
||||
struct ll * cbRequestList;
|
||||
@ -201,7 +201,7 @@ struct AppParams
|
||||
|
||||
struct CBRequest
|
||||
{
|
||||
SpiceDataType type;
|
||||
PSDataType type;
|
||||
LG_ClipboardReplyFn replyFn;
|
||||
void * opaque;
|
||||
};
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1178cbb400719c026749a64e2f7f7992c49140d2
|
||||
Subproject commit b85e30fc2c416d5044612d472017b4e168ea3ff5
|
Loading…
Reference in New Issue
Block a user