mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 00:26:32 +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
|
target_link_libraries(spice
|
||||||
lg_common
|
lg_common
|
||||||
${SPICE_PKGCONFIG_LIBRARIES}
|
${SPICE_PKGCONFIG_LIBRARIES}
|
||||||
|
gmp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(spice
|
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);
|
bool spice_connect(const char * host, const unsigned short port, const char * password);
|
||||||
void spice_disconnect();
|
void spice_disconnect();
|
||||||
bool spice_process();
|
bool spice_process(int timeout);
|
||||||
bool spice_ready();
|
bool spice_ready();
|
||||||
|
|
||||||
bool spice_key_down (uint32_t code);
|
bool spice_key_down (uint32_t code);
|
||||||
@ -61,4 +61,4 @@ bool spice_set_clipboard_cb(
|
|||||||
SpiceClipboardNotice cbNoticeFn,
|
SpiceClipboardNotice cbNoticeFn,
|
||||||
SpiceClipboardData cbDataFn,
|
SpiceClipboardData cbDataFn,
|
||||||
SpiceClipboardRelease cbReleaseFn,
|
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_set readSet;
|
||||||
FD_ZERO(&readSet);
|
FD_ZERO(&readSet);
|
||||||
FD_SET(spice.scMain.socket , &readSet);
|
FD_SET(spice.scMain.socket , &readSet);
|
||||||
FD_SET(spice.scInputs.socket, &readSet);
|
FD_SET(spice.scInputs.socket, &readSet);
|
||||||
|
|
||||||
struct timeval timeout;
|
struct timeval tv;
|
||||||
timeout.tv_sec = 1;
|
tv.tv_sec = timeout / 1000;
|
||||||
timeout.tv_usec = 0;
|
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)
|
if (rc < 0)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("select failure");
|
DEBUG_ERROR("select failure");
|
||||||
|
@ -464,7 +464,7 @@ static int frameThread(void * unused)
|
|||||||
int spiceThread(void * arg)
|
int spiceThread(void * arg)
|
||||||
{
|
{
|
||||||
while(state.running)
|
while(state.running)
|
||||||
if (!spice_process())
|
if (!spice_process(1000))
|
||||||
{
|
{
|
||||||
if (state.running)
|
if (state.running)
|
||||||
{
|
{
|
||||||
@ -1215,7 +1215,7 @@ static int lg_run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
while(state.running && !spice_ready())
|
while(state.running && !spice_ready())
|
||||||
if (!spice_process())
|
if (!spice_process(1000))
|
||||||
{
|
{
|
||||||
state.running = false;
|
state.running = false;
|
||||||
DEBUG_ERROR("Failed to process spice messages");
|
DEBUG_ERROR("Failed to process spice messages");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user