xfreerdp-server: change event queue
This commit is contained in:
parent
aa8851fb45
commit
f12e4ff89d
@ -85,6 +85,7 @@ void xf_xdamage_subtract_region(xfPeerContext* xfp, int x, int y, int width, int
|
||||
void* xf_frame_rate_thread(void* param)
|
||||
{
|
||||
xfInfo* xfi;
|
||||
HGDI_RGN region;
|
||||
xfPeerContext* xfp;
|
||||
freerdp_peer* client;
|
||||
UINT32 wait_interval;
|
||||
@ -93,6 +94,7 @@ void* xf_frame_rate_thread(void* param)
|
||||
xfp = (xfPeerContext*) client->context;
|
||||
xfi = xfp->info;
|
||||
|
||||
region = xfp->hdc->hwnd->invalid;
|
||||
wait_interval = 1000000 / xfp->fps;
|
||||
|
||||
while (1)
|
||||
@ -100,11 +102,27 @@ void* xf_frame_rate_thread(void* param)
|
||||
/* check if we should terminate */
|
||||
pthread_testcancel();
|
||||
|
||||
if (!region->null)
|
||||
{
|
||||
UINT32 xy, wh;
|
||||
|
||||
pthread_mutex_lock(&(xfp->mutex));
|
||||
|
||||
xy = (region->x << 16) | region->y;
|
||||
wh = (region->w << 16) | region->h;
|
||||
region->null = 1;
|
||||
|
||||
pthread_mutex_unlock(&(xfp->mutex));
|
||||
|
||||
MessageQueue_Post(xfp->queue, (void*) xfp,
|
||||
MakeMessageId(PeerEvent, FrameRateTick), NULL, NULL);
|
||||
MakeMessageId(PeerEvent, EncodeRegion),
|
||||
(void*) (size_t) xy, (void*) (size_t) wh);
|
||||
}
|
||||
|
||||
USleep(wait_interval);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* xf_monitor_updates(void* param)
|
||||
@ -127,7 +145,7 @@ void* xf_monitor_updates(void* param)
|
||||
xfi = xfp->info;
|
||||
|
||||
fds = xfi->xfds;
|
||||
wait_interval = (1000000 / 2500);
|
||||
wait_interval = 1000000 / xfp->fps;
|
||||
ZeroMemory(&timeout, sizeof(struct timeval));
|
||||
|
||||
pthread_create(&(xfp->frame_rate_thread), 0, xf_frame_rate_thread, (void*) client);
|
||||
@ -150,7 +168,7 @@ void* xf_monitor_updates(void* param)
|
||||
}
|
||||
else if (select_status == 0)
|
||||
{
|
||||
//printf("select timeout\n");
|
||||
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&(xfp->mutex));
|
||||
@ -166,7 +184,6 @@ void* xf_monitor_updates(void* param)
|
||||
|
||||
if (xevent.type == xfi->xdamage_notify_event)
|
||||
{
|
||||
UINT32 xy, wh;
|
||||
notify = (XDamageNotifyEvent*) &xevent;
|
||||
|
||||
x = notify->area.x;
|
||||
@ -176,12 +193,9 @@ void* xf_monitor_updates(void* param)
|
||||
|
||||
xf_xdamage_subtract_region(xfp, x, y, width, height);
|
||||
|
||||
xy = (x << 16) | y;
|
||||
wh = (width << 16) | height;
|
||||
|
||||
MessageQueue_Post(xfp->queue, (void*) xfp,
|
||||
MakeMessageId(PeerEvent, InvalidRegion),
|
||||
(void*) (size_t) xy, (void*) (size_t) wh);
|
||||
pthread_mutex_lock(&(xfp->mutex));
|
||||
gdi_InvalidateRegion(xfp->hdc, x, y, width, height);
|
||||
pthread_mutex_unlock(&(xfp->mutex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ void xf_peer_init(freerdp_peer* client)
|
||||
|
||||
xfp = (xfPeerContext*) client->context;
|
||||
|
||||
xfp->fps = 24;
|
||||
xfp->fps = 16;
|
||||
xfp->thread = 0;
|
||||
xfp->activations = 0;
|
||||
|
||||
@ -507,7 +507,6 @@ BOOL xf_peer_check_fds(freerdp_peer* client)
|
||||
xfInfo* xfi;
|
||||
wMessage message;
|
||||
xfPeerContext* xfp;
|
||||
HGDI_RGN invalid_region;
|
||||
|
||||
xfp = (xfPeerContext*) client->context;
|
||||
xfi = xfp->info;
|
||||
@ -517,7 +516,7 @@ BOOL xf_peer_check_fds(freerdp_peer* client)
|
||||
|
||||
if (MessageQueue_Peek(xfp->queue, &message, TRUE))
|
||||
{
|
||||
if (message.id == MakeMessageId(PeerEvent, InvalidRegion))
|
||||
if (message.id == MakeMessageId(PeerEvent, EncodeRegion))
|
||||
{
|
||||
UINT32 xy, wh;
|
||||
UINT16 x, y, w, h;
|
||||
@ -531,20 +530,8 @@ BOOL xf_peer_check_fds(freerdp_peer* client)
|
||||
w = ((wh & 0xFFFF0000) >> 16);
|
||||
h = (wh & 0x0000FFFF);
|
||||
|
||||
gdi_InvalidateRegion(xfp->hdc, x, y, w, h);
|
||||
}
|
||||
else if (message.id == MakeMessageId(PeerEvent, FrameRateTick))
|
||||
{
|
||||
invalid_region = xfp->hdc->hwnd->invalid;
|
||||
|
||||
if (!invalid_region->null)
|
||||
{
|
||||
xf_peer_rfx_update(client, invalid_region->x, invalid_region->y,
|
||||
invalid_region->w, invalid_region->h);
|
||||
}
|
||||
|
||||
invalid_region->null = 1;
|
||||
xfp->hdc->hwnd->ninvalid = 0;
|
||||
if (w * h > 0)
|
||||
xf_peer_rfx_update(client, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,7 @@ typedef struct xf_peer_context xfPeerContext;
|
||||
|
||||
#define PeerEvent_Class (PeerEvent_Base + 1)
|
||||
|
||||
#define PeerEvent_InvalidRegion 1
|
||||
#define PeerEvent_FrameRateTick 2
|
||||
#define PeerEvent_EncodeRegion 1
|
||||
|
||||
struct xf_peer_context
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user