mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 14:57:20 +00:00
[spice] prepare spice for external usage
This commit is contained in:
parent
e6154e685f
commit
4d0f019ad5
@ -19,6 +19,7 @@ add_library(spice STATIC
|
||||
target_link_libraries(spice
|
||||
lg_common
|
||||
${SPICE_PKGCONFIG_LIBRARIES}
|
||||
gmp
|
||||
)
|
||||
|
||||
target_include_directories(spice
|
||||
|
@ -40,7 +40,7 @@ typedef void (*SpiceClipboardRequest)(const SpiceDataType type);
|
||||
|
||||
bool spice_connect(const char * host, const unsigned short port, const char * password);
|
||||
void spice_disconnect();
|
||||
bool spice_process();
|
||||
bool spice_process(int timeout);
|
||||
bool spice_ready();
|
||||
|
||||
bool spice_key_down (uint32_t code);
|
||||
@ -61,4 +61,4 @@ bool spice_set_clipboard_cb(
|
||||
SpiceClipboardNotice cbNoticeFn,
|
||||
SpiceClipboardData cbDataFn,
|
||||
SpiceClipboardRelease cbReleaseFn,
|
||||
SpiceClipboardRequest cbRequestFn);
|
||||
SpiceClipboardRequest cbRequestFn);
|
||||
|
@ -236,18 +236,18 @@ bool spice_ready()
|
||||
|
||||
// ============================================================================
|
||||
|
||||
bool spice_process()
|
||||
bool spice_process(int timeout)
|
||||
{
|
||||
fd_set readSet;
|
||||
FD_ZERO(&readSet);
|
||||
FD_SET(spice.scMain.socket , &readSet);
|
||||
FD_SET(spice.scInputs.socket, &readSet);
|
||||
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
struct timeval tv;
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = (timeout % 1000) * 1000;
|
||||
|
||||
int rc = select(FD_SETSIZE, &readSet, NULL, NULL, &timeout);
|
||||
int rc = select(FD_SETSIZE, &readSet, NULL, NULL, &tv);
|
||||
if (rc < 0)
|
||||
{
|
||||
DEBUG_ERROR("select failure");
|
||||
|
@ -464,7 +464,7 @@ static int frameThread(void * unused)
|
||||
int spiceThread(void * arg)
|
||||
{
|
||||
while(state.running)
|
||||
if (!spice_process())
|
||||
if (!spice_process(1000))
|
||||
{
|
||||
if (state.running)
|
||||
{
|
||||
@ -1215,7 +1215,7 @@ static int lg_run()
|
||||
}
|
||||
|
||||
while(state.running && !spice_ready())
|
||||
if (!spice_process())
|
||||
if (!spice_process(1000))
|
||||
{
|
||||
state.running = false;
|
||||
DEBUG_ERROR("Failed to process spice messages");
|
||||
|
Loading…
Reference in New Issue
Block a user