Commit 323539bd authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

remoteosd: factor code

parent 23930b32
......@@ -625,6 +625,25 @@ static bool handshaking ( filter_t *p_filter )
}
static int write_update_request(filter_t *p_filter, bool incremental)
{
filter_sys_t *p_sys = p_filter->p_sys;
rfbFramebufferUpdateRequestMsg udr;
udr.type = rfbFramebufferUpdateRequest;
udr.incremental = incremental;
udr.x = 0;
udr.y = 0;
udr.w = htons(p_sys->i_vnc_width);
udr.h = htons(p_sys->i_vnc_height);
int w = write_exact(p_filter, p_sys->i_socket, (char*)&udr,
sz_rfbFramebufferUpdateRequestMsg);
if( !w )
msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
return w;
}
static void* vnc_worker_thread( void *obj )
{
filter_t* p_filter = (filter_t*)obj;
......@@ -758,37 +777,16 @@ static void* update_request_thread( void *obj )
filter_sys_t *p_sys = p_filter->p_sys;
msg_Dbg( p_filter, "VNC update request thread started" );
rfbFramebufferUpdateRequestMsg udr;
udr.type = rfbFramebufferUpdateRequest;
udr.incremental = 0;
udr.x = 0;
udr.y = 0;
udr.w = htons(p_sys->i_vnc_width);
udr.h = htons(p_sys->i_vnc_height);
int w = write_exact(p_filter, p_sys->i_socket, (char*)&udr,
sz_rfbFramebufferUpdateRequestMsg);
if( !w )
{
msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
if( !write_update_request( p_filter, false ) )
return NULL;
}
udr.incremental = 1;
if( p_sys->b_vnc_poll)
{
for( ;; )
{
msleep( p_sys->i_vnc_poll_interval * 1000 );
if( !write_exact(p_filter, p_sys->i_socket, (char*)&udr,
sz_rfbFramebufferUpdateRequestMsg))
{
msg_Err( p_filter, "Could not write rfbFramebufferUpdateRequestMsg." );
break;
}
if( !write_update_request( p_filter, true ) )
return NULL;
}
}
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment