mirror of https://github.com/FreeRDP/FreeRDP
Fixed clearcodec and codecs reset.
This commit is contained in:
parent
dc12641b23
commit
8fffda5740
|
@ -152,7 +152,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
{
|
||||
XSetRegion(xfc->display, xfc->gc, reg1);
|
||||
XFillRectangle(xfc->display, xfc->window->handle, xfc->gc, 0, 0,
|
||||
xfc->window->width, xfc->window->height);
|
||||
xfc->window->width, xfc->window->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
|
||||
|
@ -162,9 +162,9 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
picFormat = XRenderFindVisualFormat(xfc->display, xfc->visual);
|
||||
pa.subwindow_mode = IncludeInferiors;
|
||||
primaryPicture = XRenderCreatePicture(xfc->display, xfc->primary, picFormat,
|
||||
CPSubwindowMode, &pa);
|
||||
CPSubwindowMode, &pa);
|
||||
windowPicture = XRenderCreatePicture(xfc->display, xfc->window->handle,
|
||||
picFormat, CPSubwindowMode, &pa);
|
||||
picFormat, CPSubwindowMode, &pa);
|
||||
XRenderSetPictureFilter(xfc->display, primaryPicture, FilterBilinear, 0, 0);
|
||||
transform.matrix[0][0] = XDoubleToFixed(xScalingFactor);
|
||||
transform.matrix[0][1] = XDoubleToFixed(0.0);
|
||||
|
@ -184,7 +184,7 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
h = ceil(y2 / yScalingFactor) + 1 - y;
|
||||
XRenderSetPictureTransform(xfc->display, primaryPicture, &transform);
|
||||
XRenderComposite(xfc->display, PictOpSrc, primaryPicture, 0, windowPicture, x,
|
||||
y, 0, 0, xfc->offset_x + x, xfc->offset_y + y, w, h);
|
||||
y, 0, 0, xfc->offset_x + x, xfc->offset_y + y, w, h);
|
||||
XRenderFreePicture(xfc->display, primaryPicture);
|
||||
XRenderFreePicture(xfc->display, windowPicture);
|
||||
}
|
||||
|
@ -192,8 +192,8 @@ static void xf_draw_screen_scaled(xfContext* xfc, int x, int y, int w, int h)
|
|||
BOOL xf_picture_transform_required(xfContext* xfc)
|
||||
{
|
||||
if (xfc->offset_x || xfc->offset_y ||
|
||||
xfc->scaledWidth != xfc->sessionWidth ||
|
||||
xfc->scaledHeight != xfc->sessionHeight)
|
||||
xfc->scaledWidth != xfc->sessionWidth ||
|
||||
xfc->scaledHeight != xfc->sessionHeight)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ void xf_draw_screen(xfContext* xfc, int x, int y, int w, int h)
|
|||
|
||||
#endif
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->window->handle, xfc->gc, x, y, w, h,
|
||||
x, y);
|
||||
x, y);
|
||||
}
|
||||
|
||||
static BOOL xf_desktop_resize(rdpContext* context)
|
||||
|
@ -235,8 +235,8 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
|||
XFreePixmap(xfc->display, xfc->primary);
|
||||
|
||||
if (!(xfc->primary = XCreatePixmap(
|
||||
xfc->display, xfc->drawable,
|
||||
xfc->sessionWidth, xfc->sessionHeight, xfc->depth)))
|
||||
xfc->display, xfc->drawable,
|
||||
xfc->sessionWidth, xfc->sessionHeight, xfc->depth)))
|
||||
return FALSE;
|
||||
|
||||
if (same)
|
||||
|
@ -256,7 +256,7 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
|||
if (!xfc->fullscreen)
|
||||
{
|
||||
xf_ResizeDesktopWindow(xfc, xfc->window, settings->DesktopWidth,
|
||||
settings->DesktopHeight);
|
||||
settings->DesktopHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ static BOOL xf_desktop_resize(rdpContext* context)
|
|||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, 0);
|
||||
XFillRectangle(xfc->display, xfc->drawable, xfc->gc, 0, 0, xfc->window->width,
|
||||
xfc->window->height);
|
||||
xfc->window->height);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -314,7 +314,7 @@ static BOOL xf_sw_end_paint(rdpContext* context)
|
|||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image,
|
||||
x, y, x, y, w, h);
|
||||
x, y, x, y, w, h);
|
||||
xf_draw_screen(xfc, x, y, w, h);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ static BOOL xf_sw_end_paint(rdpContext* context)
|
|||
w = cinvalid[i].w;
|
||||
h = cinvalid[i].h;
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc,
|
||||
xfc->image, x, y, x, y, w, h);
|
||||
xfc->image, x, y, x, y, w, h);
|
||||
xf_draw_screen(xfc, x, y, w, h);
|
||||
}
|
||||
|
||||
|
@ -372,8 +372,8 @@ static BOOL xf_sw_desktop_resize(rdpContext* context)
|
|||
}
|
||||
|
||||
if (!(xfc->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap,
|
||||
0,
|
||||
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0)))
|
||||
0,
|
||||
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfc->scanline_pad, 0)))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
|
@ -469,16 +469,7 @@ static BOOL xf_hw_desktop_resize(rdpContext* context)
|
|||
return ret;
|
||||
}
|
||||
|
||||
BOOL xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds,
|
||||
int* wcount)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) instance->context;
|
||||
rfds[*rcount] = (void*)(long)(xfc->xfds);
|
||||
(*rcount)++;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL xf_process_x_events(freerdp* instance)
|
||||
static BOOL xf_process_x_events(freerdp* instance)
|
||||
{
|
||||
BOOL status;
|
||||
XEvent xevent;
|
||||
|
@ -546,15 +537,15 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
else if (settings->ServerPort == 3389)
|
||||
{
|
||||
windowTitle = malloc(1 + sizeof("FreeRDP: ") + strlen(
|
||||
settings->ServerHostname));
|
||||
settings->ServerHostname));
|
||||
sprintf(windowTitle, "FreeRDP: %s", settings->ServerHostname);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowTitle = malloc(1 + sizeof("FreeRDP: ") + strlen(settings->ServerHostname)
|
||||
+ sizeof(":00000"));
|
||||
+ sizeof(":00000"));
|
||||
sprintf(windowTitle, "FreeRDP: %s:%i", settings->ServerHostname,
|
||||
settings->ServerPort);
|
||||
settings->ServerPort);
|
||||
}
|
||||
|
||||
#ifdef WITH_XRENDER
|
||||
|
@ -599,7 +590,7 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
|
||||
if (!xfc->primary)
|
||||
xfc->primary = XCreatePixmap(xfc->display, xfc->drawable, xfc->sessionWidth,
|
||||
xfc->sessionHeight, xfc->depth);
|
||||
xfc->sessionHeight, xfc->depth);
|
||||
|
||||
xfc->drawing = xfc->primary;
|
||||
|
||||
|
@ -608,29 +599,29 @@ BOOL xf_create_window(xfContext* xfc)
|
|||
|
||||
if (!xfc->gc_mono)
|
||||
xfc->gc_mono = XCreateGC(xfc->display, xfc->bitmap_mono, GCGraphicsExposures,
|
||||
&gcv);
|
||||
&gcv);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, BlackPixelOfScreen(xfc->screen));
|
||||
XFillRectangle(xfc->display, xfc->primary, xfc->gc, 0, 0, xfc->sessionWidth,
|
||||
xfc->sessionHeight);
|
||||
xfc->sessionHeight);
|
||||
XFlush(xfc->display);
|
||||
|
||||
if (!xfc->image)
|
||||
{
|
||||
rdpGdi* gdi = xfc->context.gdi;
|
||||
xfc->image = XCreateImage(xfc->display, xfc->visual,
|
||||
xfc->depth,
|
||||
ZPixmap, 0, (char*) gdi->primary_buffer,
|
||||
xfc->sessionWidth, xfc->sessionHeight,
|
||||
xfc->scanline_pad, 0);
|
||||
xfc->depth,
|
||||
ZPixmap, 0, (char*) gdi->primary_buffer,
|
||||
xfc->sessionWidth, xfc->sessionHeight,
|
||||
xfc->scanline_pad, 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_window_free(xfContext* xfc)
|
||||
static void xf_window_free(xfContext* xfc)
|
||||
{
|
||||
if (xfc->gc_mono)
|
||||
{
|
||||
|
@ -725,8 +716,8 @@ void xf_toggle_control(xfContext* xfc)
|
|||
*
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
UINT xf_encomsp_participant_created(EncomspClientContext* context,
|
||||
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
|
||||
static UINT xf_encomsp_participant_created(EncomspClientContext* context,
|
||||
ENCOMSP_PARTICIPANT_CREATED_PDU* participantCreated)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
@ -778,7 +769,7 @@ static void xf_calculate_color_shifts(UINT32 mask, UINT8* rsh, UINT8* lsh)
|
|||
(*rsh)--;
|
||||
}
|
||||
|
||||
BOOL xf_get_pixmap_info(xfContext* xfc)
|
||||
static BOOL xf_get_pixmap_info(xfContext* xfc)
|
||||
{
|
||||
int i;
|
||||
int vi_count;
|
||||
|
@ -815,14 +806,14 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
|
|||
template.screen = xfc->screen_number;
|
||||
|
||||
if (XGetWindowAttributes(xfc->display, RootWindowOfScreen(xfc->screen),
|
||||
&window_attributes) == 0)
|
||||
&window_attributes) == 0)
|
||||
{
|
||||
WLog_ERR(TAG, "XGetWindowAttributes failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
vis = XGetVisualInfo(xfc->display, VisualClassMask | VisualScreenMask,
|
||||
&template, &vi_count);
|
||||
&template, &vi_count);
|
||||
|
||||
if (!vis)
|
||||
{
|
||||
|
@ -857,9 +848,9 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
|
|||
/* calculate color shifts required for rdp order color conversion */
|
||||
xf_calculate_color_shifts(vi->red_mask, &xfc->red_shift_r, &xfc->red_shift_l);
|
||||
xf_calculate_color_shifts(vi->green_mask, &xfc->green_shift_r,
|
||||
&xfc->green_shift_l);
|
||||
&xfc->green_shift_l);
|
||||
xf_calculate_color_shifts(vi->blue_mask, &xfc->blue_shift_r,
|
||||
&xfc->blue_shift_l);
|
||||
&xfc->blue_shift_l);
|
||||
}
|
||||
|
||||
XFree(vis);
|
||||
|
@ -872,7 +863,7 @@ BOOL xf_get_pixmap_info(xfContext* xfc)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
int xf_error_handler(Display* d, XErrorEvent* ev)
|
||||
static int xf_error_handler(Display* d, XErrorEvent* ev)
|
||||
{
|
||||
char buf[256];
|
||||
int do_abort = TRUE;
|
||||
|
@ -886,7 +877,7 @@ int xf_error_handler(Display* d, XErrorEvent* ev)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int _xf_error_handler(Display* d, XErrorEvent* ev)
|
||||
static int _xf_error_handler(Display* d, XErrorEvent* ev)
|
||||
{
|
||||
/*
|
||||
* ungrab the keyboard, in case a debugger is running in
|
||||
|
@ -898,22 +889,22 @@ int _xf_error_handler(Display* d, XErrorEvent* ev)
|
|||
}
|
||||
|
||||
static BOOL xf_play_sound(rdpContext* context,
|
||||
const PLAY_SOUND_UPDATE* play_sound)
|
||||
const PLAY_SOUND_UPDATE* play_sound)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
XkbBell(xfc->display, None, 100, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_check_extensions(xfContext* context)
|
||||
static void xf_check_extensions(xfContext* context)
|
||||
{
|
||||
int xkb_opcode, xkb_event, xkb_error;
|
||||
int xkb_major = XkbMajorVersion;
|
||||
int xkb_minor = XkbMinorVersion;
|
||||
|
||||
if (XkbLibraryVersion(&xkb_major, &xkb_minor)
|
||||
&& XkbQueryExtension(context->display, &xkb_opcode, &xkb_event,
|
||||
&xkb_error, &xkb_major, &xkb_minor))
|
||||
&& XkbQueryExtension(context->display, &xkb_opcode, &xkb_event,
|
||||
&xkb_error, &xkb_major, &xkb_minor))
|
||||
{
|
||||
context->xkbAvailable = TRUE;
|
||||
}
|
||||
|
@ -924,7 +915,7 @@ void xf_check_extensions(xfContext* context)
|
|||
int xrender_error_base;
|
||||
|
||||
if (XRenderQueryExtension(context->display, &xrender_event_base,
|
||||
&xrender_error_base))
|
||||
&xrender_error_base))
|
||||
{
|
||||
context->xrenderAvailable = TRUE;
|
||||
}
|
||||
|
@ -970,7 +961,7 @@ static void xf_get_x11_button_map(xfContext* xfc, unsigned char* x11_map)
|
|||
for (i = 0; i < num_devices; ++i)
|
||||
{
|
||||
if ((devices2[i].use == XISlavePointer) &&
|
||||
(strncmp(devices2[i].name, TEST_PTR_STR, TEST_PTR_LEN) != 0))
|
||||
(strncmp(devices2[i].name, TEST_PTR_STR, TEST_PTR_LEN) != 0))
|
||||
{
|
||||
xid = devices2[i].deviceid;
|
||||
break;
|
||||
|
@ -990,7 +981,7 @@ static void xf_get_x11_button_map(xfContext* xfc, unsigned char* x11_map)
|
|||
for (i = 0; i < num_devices; ++i)
|
||||
{
|
||||
if ((devices1[i].use == IsXExtensionPointer) &&
|
||||
(strncmp(devices1[i].name, TEST_PTR_STR, TEST_PTR_LEN) != 0))
|
||||
(strncmp(devices1[i].name, TEST_PTR_STR, TEST_PTR_LEN) != 0))
|
||||
{
|
||||
xid = devices1[i].id;
|
||||
break;
|
||||
|
@ -1068,7 +1059,7 @@ static void xf_button_map_init(xfContext* xfc)
|
|||
else
|
||||
{
|
||||
WLog_ERR(TAG, "Mouse physical button %d is mapped to logical button %d",
|
||||
physical, logical);
|
||||
physical, logical);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1083,7 +1074,7 @@ static void xf_button_map_init(xfContext* xfc)
|
|||
* @return TRUE if successful. FALSE otherwise.
|
||||
* Can exit with error code XF_EXIT_PARSE_ARGUMENTS if there is an error in the parameters.
|
||||
*/
|
||||
BOOL xf_pre_connect(freerdp* instance)
|
||||
static BOOL xf_pre_connect(freerdp* instance)
|
||||
{
|
||||
rdpChannels* channels;
|
||||
rdpSettings* settings;
|
||||
|
@ -1091,7 +1082,6 @@ BOOL xf_pre_connect(freerdp* instance)
|
|||
xfContext* xfc = (xfContext*) instance->context;
|
||||
UINT32 maxWidth = 0;
|
||||
UINT32 maxHeight = 0;
|
||||
xfc->codecs = context->codecs;
|
||||
xfc->settings = instance->settings;
|
||||
xfc->instance = instance;
|
||||
settings = instance->settings;
|
||||
|
@ -1127,9 +1117,9 @@ BOOL xf_pre_connect(freerdp* instance)
|
|||
settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
|
||||
settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
|
||||
PubSub_SubscribeChannelConnected(instance->context->pubSub,
|
||||
(pChannelConnectedEventHandler) xf_OnChannelConnectedEventHandler);
|
||||
(pChannelConnectedEventHandler) xf_OnChannelConnectedEventHandler);
|
||||
PubSub_SubscribeChannelDisconnected(instance->context->pubSub,
|
||||
(pChannelDisconnectedEventHandler) xf_OnChannelDisconnectedEventHandler);
|
||||
(pChannelDisconnectedEventHandler) xf_OnChannelDisconnectedEventHandler);
|
||||
|
||||
if (!freerdp_client_load_addins(channels, instance->settings))
|
||||
return FALSE;
|
||||
|
@ -1182,7 +1172,7 @@ BOOL xf_pre_connect(freerdp* instance)
|
|||
* we run the session in the /smart-sizing dimensions scaled to full screen
|
||||
*/
|
||||
if (settings->Fullscreen && settings->SmartSizing &&
|
||||
settings->SmartSizingWidth && settings->SmartSizingHeight)
|
||||
settings->SmartSizingWidth && settings->SmartSizingHeight)
|
||||
{
|
||||
settings->DesktopWidth = settings->SmartSizingWidth;
|
||||
settings->DesktopHeight = settings->SmartSizingHeight;
|
||||
|
@ -1202,7 +1192,7 @@ BOOL xf_pre_connect(freerdp* instance)
|
|||
* It will be called only if the connection was initialized properly, and will continue the initialization based on the
|
||||
* newly created connection.
|
||||
*/
|
||||
BOOL xf_post_connect(freerdp* instance)
|
||||
static BOOL xf_post_connect(freerdp* instance)
|
||||
{
|
||||
rdpUpdate* update;
|
||||
rdpContext* context;
|
||||
|
@ -1330,18 +1320,17 @@ static void xf_post_disconnect(freerdp* instance)
|
|||
}
|
||||
|
||||
xf_window_free(xfc);
|
||||
|
||||
xf_keyboard_free(xfc);
|
||||
}
|
||||
|
||||
int xf_logon_error_info(freerdp* instance, UINT32 data, UINT32 type)
|
||||
static int xf_logon_error_info(freerdp* instance, UINT32 data, UINT32 type)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) instance->context;
|
||||
xf_rail_disable_remoteapp_mode(xfc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void* xf_input_thread(void* arg)
|
||||
static void* xf_input_thread(void* arg)
|
||||
{
|
||||
DWORD status;
|
||||
DWORD nCount;
|
||||
|
@ -1403,7 +1392,7 @@ void* xf_input_thread(void* arg)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
BOOL xf_auto_reconnect(freerdp* instance)
|
||||
static BOOL xf_auto_reconnect(freerdp* instance)
|
||||
{
|
||||
UINT32 maxRetries;
|
||||
UINT32 numRetries = 0;
|
||||
|
@ -1456,7 +1445,7 @@ BOOL xf_auto_reconnect(freerdp* instance)
|
|||
* @param instance - pointer to the rdp_freerdp structure that contains the session's settings
|
||||
* @return A code from the enum XF_EXIT_CODE (0 if successful)
|
||||
*/
|
||||
void* xf_client_thread(void* param)
|
||||
static void* xf_client_thread(void* param)
|
||||
{
|
||||
BOOL status;
|
||||
int exit_code;
|
||||
|
@ -1484,7 +1473,7 @@ void* xf_client_thread(void* param)
|
|||
if (!status)
|
||||
{
|
||||
if (freerdp_get_last_error(instance->context) ==
|
||||
FREERDP_ERROR_AUTHENTICATION_FAILED)
|
||||
FREERDP_ERROR_AUTHENTICATION_FAILED)
|
||||
exit_code = XF_EXIT_AUTH_FAILURE;
|
||||
else
|
||||
exit_code = XF_EXIT_CONN_FAILED;
|
||||
|
@ -1501,7 +1490,7 @@ void* xf_client_thread(void* param)
|
|||
exit_code = freerdp_error_info(instance);
|
||||
|
||||
if (freerdp_get_last_error(instance->context) ==
|
||||
FREERDP_ERROR_AUTHENTICATION_FAILED)
|
||||
FREERDP_ERROR_AUTHENTICATION_FAILED)
|
||||
exit_code = XF_EXIT_AUTH_FAILURE;
|
||||
else
|
||||
exit_code = XF_EXIT_CONN_FAILED;
|
||||
|
@ -1519,7 +1508,7 @@ void* xf_client_thread(void* param)
|
|||
else
|
||||
{
|
||||
if (!(inputEvent = freerdp_get_message_queue_event_handle(instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE)))
|
||||
FREERDP_INPUT_MESSAGE_QUEUE)))
|
||||
{
|
||||
WLog_ERR(TAG, "async input: failed to get input event handle");
|
||||
exit_code = XF_EXIT_UNKNOWN;
|
||||
|
@ -1527,7 +1516,7 @@ void* xf_client_thread(void* param)
|
|||
}
|
||||
|
||||
if (!(inputThread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) xf_input_thread, instance, 0, NULL)))
|
||||
(LPTHREAD_START_ROUTINE) xf_input_thread, instance, 0, NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "async input: failed to create input thread");
|
||||
exit_code = XF_EXIT_UNKNOWN;
|
||||
|
@ -1591,7 +1580,7 @@ void* xf_client_thread(void* param)
|
|||
if (WaitForSingleObject(inputEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
if (!freerdp_message_queue_process_pending_messages(instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE))
|
||||
FREERDP_INPUT_MESSAGE_QUEUE))
|
||||
{
|
||||
WLog_INFO(TAG, "User Disconnect");
|
||||
xfc->disconnect = TRUE;
|
||||
|
@ -1604,7 +1593,7 @@ void* xf_client_thread(void* param)
|
|||
if (settings->AsyncInput)
|
||||
{
|
||||
wMessageQueue* inputQueue = freerdp_get_message_queue(instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
|
||||
if (MessageQueue_PostQuit(inputQueue, 0))
|
||||
WaitForSingleObject(inputThread, INFINITE);
|
||||
|
@ -1624,22 +1613,22 @@ disconnect:
|
|||
DWORD xf_exit_code_from_disconnect_reason(DWORD reason)
|
||||
{
|
||||
if (reason == 0 || (reason >= XF_EXIT_PARSE_ARGUMENTS
|
||||
&& reason <= XF_EXIT_AUTH_FAILURE))
|
||||
return reason;
|
||||
&& reason <= XF_EXIT_AUTH_FAILURE))
|
||||
return reason;
|
||||
/* License error set */
|
||||
else if (reason >= 0x100 && reason <= 0x10A)
|
||||
reason -= 0x100 + XF_EXIT_LICENSE_INTERNAL;
|
||||
reason -= 0x100 + XF_EXIT_LICENSE_INTERNAL;
|
||||
/* RDP protocol error set */
|
||||
else if (reason >= 0x10c9 && reason <= 0x1193)
|
||||
reason = XF_EXIT_RDP;
|
||||
reason = XF_EXIT_RDP;
|
||||
/* There's no need to test protocol-independent codes: they match */
|
||||
else if (!(reason <= 0xC))
|
||||
reason = XF_EXIT_UNKNOWN;
|
||||
reason = XF_EXIT_UNKNOWN;
|
||||
|
||||
return reason;
|
||||
}
|
||||
|
||||
void xf_TerminateEventHandler(rdpContext* context, TerminateEventArgs* e)
|
||||
static void xf_TerminateEventHandler(rdpContext* context, TerminateEventArgs* e)
|
||||
{
|
||||
wMessageQueue* queue;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
@ -1647,7 +1636,7 @@ void xf_TerminateEventHandler(rdpContext* context, TerminateEventArgs* e)
|
|||
if (context->settings->AsyncInput)
|
||||
{
|
||||
queue = freerdp_get_message_queue(context->instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
|
||||
if (queue)
|
||||
MessageQueue_PostQuit(queue, 0);
|
||||
|
@ -1660,7 +1649,7 @@ void xf_TerminateEventHandler(rdpContext* context, TerminateEventArgs* e)
|
|||
|
||||
#ifdef WITH_XRENDER
|
||||
static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
||||
ZoomingChangeEventArgs* e)
|
||||
ZoomingChangeEventArgs* e)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
int w = xfc->scaledWidth + e->dx;
|
||||
|
@ -1670,10 +1659,10 @@ static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
|||
return;
|
||||
|
||||
if (w < 10)
|
||||
w = 10;
|
||||
w = 10;
|
||||
|
||||
if (h < 10)
|
||||
h = 10;
|
||||
h = 10;
|
||||
|
||||
if (w == xfc->scaledWidth && h == xfc->scaledHeight)
|
||||
return;
|
||||
|
@ -1684,7 +1673,7 @@ static void xf_ZoomingChangeEventHandler(rdpContext* context,
|
|||
}
|
||||
|
||||
static void xf_PanningChangeEventHandler(rdpContext* context,
|
||||
PanningChangeEventArgs* e)
|
||||
PanningChangeEventArgs* e)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
|
@ -1723,15 +1712,15 @@ static int xfreerdp_client_start(rdpContext* context)
|
|||
if (!settings->ServerHostname)
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"error: server hostname was not specified with /v:<server>[:port]");
|
||||
"error: server hostname was not specified with /v:<server>[:port]");
|
||||
return -1;
|
||||
}
|
||||
|
||||
xfc->disconnect = FALSE;
|
||||
|
||||
if (!(xfc->thread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) xf_client_thread,
|
||||
context->instance, 0, NULL)))
|
||||
(LPTHREAD_START_ROUTINE) xf_client_thread,
|
||||
context->instance, 0, NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "failed to create client thread");
|
||||
return -1;
|
||||
|
@ -1748,7 +1737,7 @@ static int xfreerdp_client_stop(rdpContext* context)
|
|||
{
|
||||
wMessageQueue* queue;
|
||||
queue = freerdp_get_message_queue(context->instance,
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
FREERDP_INPUT_MESSAGE_QUEUE);
|
||||
|
||||
if (queue)
|
||||
MessageQueue_PostQuit(queue, 0);
|
||||
|
@ -1793,12 +1782,12 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
|||
settings = instance->settings;
|
||||
xfc->settings = instance->context->settings;
|
||||
PubSub_SubscribeTerminate(context->pubSub,
|
||||
(pTerminateEventHandler) xf_TerminateEventHandler);
|
||||
(pTerminateEventHandler) xf_TerminateEventHandler);
|
||||
#ifdef WITH_XRENDER
|
||||
PubSub_SubscribeZoomingChange(context->pubSub,
|
||||
(pZoomingChangeEventHandler) xf_ZoomingChangeEventHandler);
|
||||
(pZoomingChangeEventHandler) xf_ZoomingChangeEventHandler);
|
||||
PubSub_SubscribePanningChange(context->pubSub,
|
||||
(pPanningChangeEventHandler) xf_PanningChangeEventHandler);
|
||||
(pPanningChangeEventHandler) xf_PanningChangeEventHandler);
|
||||
#endif
|
||||
xfc->UseXThreads = TRUE;
|
||||
//xfc->debug = TRUE;
|
||||
|
@ -1818,7 +1807,7 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
|||
{
|
||||
WLog_ERR(TAG, "failed to open display: %s", XDisplayName(NULL));
|
||||
WLog_ERR(TAG,
|
||||
"Please check that the $DISPLAY environment variable is properly set.");
|
||||
"Please check that the $DISPLAY environment variable is properly set.");
|
||||
goto fail_open_display;
|
||||
}
|
||||
|
||||
|
@ -1833,39 +1822,39 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
|||
xfc->_NET_WM_ICON = XInternAtom(xfc->display, "_NET_WM_ICON", False);
|
||||
xfc->_MOTIF_WM_HINTS = XInternAtom(xfc->display, "_MOTIF_WM_HINTS", False);
|
||||
xfc->_NET_CURRENT_DESKTOP = XInternAtom(xfc->display, "_NET_CURRENT_DESKTOP",
|
||||
False);
|
||||
False);
|
||||
xfc->_NET_WORKAREA = XInternAtom(xfc->display, "_NET_WORKAREA", False);
|
||||
xfc->_NET_WM_STATE = XInternAtom(xfc->display, "_NET_WM_STATE", False);
|
||||
xfc->_NET_WM_STATE_FULLSCREEN = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_FULLSCREEN", False);
|
||||
"_NET_WM_STATE_FULLSCREEN", False);
|
||||
xfc->_NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
"_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||
xfc->_NET_WM_STATE_MAXIMIZED_VERT = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
"_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||
xfc->_NET_WM_FULLSCREEN_MONITORS = XInternAtom(xfc->display,
|
||||
"_NET_WM_FULLSCREEN_MONITORS", False);
|
||||
"_NET_WM_FULLSCREEN_MONITORS", False);
|
||||
xfc->_NET_WM_NAME = XInternAtom(xfc->display, "_NET_WM_NAME", False);
|
||||
xfc->_NET_WM_PID = XInternAtom(xfc->display, "_NET_WM_PID", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE = XInternAtom(xfc->display, "_NET_WM_WINDOW_TYPE",
|
||||
False);
|
||||
False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_NORMAL = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_NORMAL", False);
|
||||
"_NET_WM_WINDOW_TYPE_NORMAL", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_DIALOG = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
"_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_POPUP = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_POPUP", False);
|
||||
"_NET_WM_WINDOW_TYPE_POPUP", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_UTILITY = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_UTILITY", False);
|
||||
"_NET_WM_WINDOW_TYPE_UTILITY", False);
|
||||
xfc->_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = XInternAtom(xfc->display,
|
||||
"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", False);
|
||||
"_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", False);
|
||||
xfc->_NET_WM_STATE_SKIP_TASKBAR = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_SKIP_TASKBAR", False);
|
||||
"_NET_WM_STATE_SKIP_TASKBAR", False);
|
||||
xfc->_NET_WM_STATE_SKIP_PAGER = XInternAtom(xfc->display,
|
||||
"_NET_WM_STATE_SKIP_PAGER", False);
|
||||
"_NET_WM_STATE_SKIP_PAGER", False);
|
||||
xfc->_NET_WM_MOVERESIZE = XInternAtom(xfc->display, "_NET_WM_MOVERESIZE",
|
||||
False);
|
||||
False);
|
||||
xfc->_NET_MOVERESIZE_WINDOW = XInternAtom(xfc->display,
|
||||
"_NET_MOVERESIZE_WINDOW", False);
|
||||
"_NET_MOVERESIZE_WINDOW", False);
|
||||
xfc->UTF8_STRING = XInternAtom(xfc->display, "UTF8_STRING", FALSE);
|
||||
xfc->WM_PROTOCOLS = XInternAtom(xfc->display, "WM_PROTOCOLS", False);
|
||||
xfc->WM_DELETE_WINDOW = XInternAtom(xfc->display, "WM_DELETE_WINDOW", False);
|
||||
|
@ -1878,7 +1867,7 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context)
|
|||
xfc->invert = (ImageByteOrder(xfc->display) == MSBFirst) ? TRUE : FALSE;
|
||||
xfc->complex_regions = TRUE;
|
||||
xfc->x11event = CreateFileDescriptorEvent(NULL, FALSE, FALSE, xfc->xfds,
|
||||
WINPR_FD_READ);
|
||||
WINPR_FD_READ);
|
||||
|
||||
if (!xfc->x11event)
|
||||
{
|
||||
|
|
|
@ -227,8 +227,8 @@ UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color)
|
|||
case 32:
|
||||
case 24:
|
||||
if (xfc->visual->red_mask == 0xFF0000 &&
|
||||
xfc->visual->green_mask == 0xFF00 &&
|
||||
xfc->visual->blue_mask == 0xFF)
|
||||
xfc->visual->green_mask == 0xFF00 &&
|
||||
xfc->visual->blue_mask == 0xFF)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
@ -240,8 +240,8 @@ UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color)
|
|||
color = (color & 0xFF00) | ((color >> 16) & 0xFF);
|
||||
|
||||
if (xfc->visual->red_mask == 0xF800 &&
|
||||
xfc->visual->green_mask == 0x07E0 &&
|
||||
xfc->visual->blue_mask == 0x001F)
|
||||
xfc->visual->green_mask == 0x07E0 &&
|
||||
xfc->visual->blue_mask == 0x001F)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
@ -256,11 +256,9 @@ UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color)
|
|||
|
||||
case 8:
|
||||
color = (color >> 16) & (UINT32) 0xFF;
|
||||
|
||||
UINT32 dstColor = xfc->palette.palette[color];
|
||||
SplitColor(dstColor, xfc->format, &r, &g, &b,
|
||||
NULL, NULL);
|
||||
|
||||
NULL, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -268,8 +266,8 @@ UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color)
|
|||
}
|
||||
|
||||
return (((r >> xfc->red_shift_r) << xfc->red_shift_l) |
|
||||
((g >> xfc->green_shift_r) << xfc->green_shift_l) |
|
||||
((b >> xfc->blue_shift_r) << xfc->blue_shift_l));
|
||||
((g >> xfc->green_shift_r) << xfc->green_shift_l) |
|
||||
((b >> xfc->blue_shift_r) << xfc->blue_shift_l));
|
||||
}
|
||||
|
||||
Pixmap xf_brush_new(xfContext* xfc, int width, int height, int bpp, BYTE* data)
|
||||
|
@ -286,10 +284,10 @@ Pixmap xf_brush_new(xfContext* xfc, int width, int height, int bpp, BYTE* data)
|
|||
brushFormat = gdi_get_pixel_format(bpp, FALSE);
|
||||
cdata = (BYTE*) _aligned_malloc(width * height * 4, 16);
|
||||
freerdp_image_copy(cdata, xfc->format, -1, 0, 0,
|
||||
width, height, data, brushFormat, -1, 0, 0,
|
||||
&xfc->palette);
|
||||
width, height, data, brushFormat, -1, 0, 0,
|
||||
&xfc->palette);
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
|
||||
ZPixmap, 0, (char*) cdata, width, height, xfc->scanline_pad, 0);
|
||||
ZPixmap, 0, (char*) cdata, width, height, xfc->scanline_pad, 0);
|
||||
gc = XCreateGC(xfc->display, xfc->drawable, 0, NULL);
|
||||
XPutImage(xfc->display, bitmap, gc, image, 0, 0, 0, 0, width, height);
|
||||
XFree(image);
|
||||
|
@ -311,14 +309,14 @@ Pixmap xf_mono_bitmap_new(xfContext* xfc, int width, int height, BYTE* data)
|
|||
scanline = (width + 7) / 8;
|
||||
bitmap = XCreatePixmap(xfc->display, xfc->drawable, width, height, 1);
|
||||
image = XCreateImage(xfc->display, xfc->visual, 1,
|
||||
ZPixmap, 0, (char*) data, width, height, 8, scanline);
|
||||
ZPixmap, 0, (char*) data, width, height, 8, scanline);
|
||||
XPutImage(xfc->display, bitmap, xfc->gc_mono, image, 0, 0, 0, 0, width, height);
|
||||
XFree(image);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
BOOL xf_gdi_bitmap_update(rdpContext* context,
|
||||
const BITMAP_UPDATE* bitmapUpdate)
|
||||
const BITMAP_UPDATE* bitmapUpdate)
|
||||
{
|
||||
int status;
|
||||
int nXDst;
|
||||
|
@ -361,29 +359,19 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
|
|||
|
||||
if (bitsPerPixel < 32)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED,
|
||||
xfc->settings->DesktopWidth,
|
||||
xfc->settings->DesktopHeight))
|
||||
return FALSE;
|
||||
|
||||
status = interleaved_decompress(codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bitsPerPixel,
|
||||
pDstData,
|
||||
xfc->format, -1,
|
||||
0, 0,
|
||||
nWidth, nHeight,
|
||||
&xfc->palette);
|
||||
pSrcData, SrcSize,
|
||||
bitsPerPixel,
|
||||
pDstData,
|
||||
xfc->format, -1,
|
||||
0, 0,
|
||||
nWidth, nHeight,
|
||||
&xfc->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_PLANAR,
|
||||
xfc->settings->DesktopWidth,
|
||||
xfc->settings->DesktopHeight))
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress(codecs->planar, pSrcData, SrcSize, pDstData,
|
||||
xfc->format, -1, 0, 0, nWidth, nHeight, TRUE);
|
||||
xfc->format, -1, 0, 0, nWidth, nHeight, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
|
@ -398,15 +386,15 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
|
|||
{
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
nWidth, nHeight, pSrcData, SrcFormat,
|
||||
-1, 0, 0, &xfc->palette);
|
||||
nWidth, nHeight, pSrcData, SrcFormat,
|
||||
-1, 0, 0, &xfc->palette);
|
||||
pSrcData = xfc->bitmap_buffer;
|
||||
}
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pSrcData, nWidth, nHeight, xfc->scanline_pad, 0);
|
||||
(char*) pSrcData, nWidth, nHeight, xfc->scanline_pad, 0);
|
||||
|
||||
if (!image)
|
||||
{
|
||||
|
@ -417,7 +405,7 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
|
|||
nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
|
||||
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc,
|
||||
image, 0, 0, nXDst, nYDst, nWidth, nHeight);
|
||||
image, 0, 0, nXDst, nYDst, nWidth, nHeight);
|
||||
XFree(image);
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, nXDst, nYDst, nWidth, nHeight);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
@ -430,19 +418,19 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_palette_update(rdpContext* context,
|
||||
const PALETTE_UPDATE* palette)
|
||||
const PALETTE_UPDATE* palette)
|
||||
{
|
||||
int index;
|
||||
const PALETTE_ENTRY* pe;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xfc->palette.format = xfc->format;
|
||||
|
||||
for (index = 0; index < palette->number; index++)
|
||||
{
|
||||
pe = &(palette->entries[index]);
|
||||
xfc->palette.palette[index] = GetColor(xfc->format,
|
||||
pe->red, pe->green, pe->blue, 0xFF);
|
||||
pe->red, pe->green, pe->blue, 0xFF);
|
||||
}
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
@ -450,7 +438,7 @@ static BOOL xf_gdi_palette_update(rdpContext* context,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_set_bounds(rdpContext* context,
|
||||
const rdpBounds* bounds)
|
||||
const rdpBounds* bounds)
|
||||
{
|
||||
XRectangle clip;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
@ -481,12 +469,12 @@ static BOOL xf_gdi_dstblt(rdpContext* context, const DSTBLT_ORDER* dstblt)
|
|||
xf_set_rop3(xfc, gdi_rop3_code(dstblt->bRop));
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
dstblt->nLeftRect, dstblt->nTopRect,
|
||||
dstblt->nWidth, dstblt->nHeight);
|
||||
dstblt->nLeftRect, dstblt->nTopRect,
|
||||
dstblt->nWidth, dstblt->nHeight);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, dstblt->nLeftRect, dstblt->nTopRect,
|
||||
dstblt->nWidth, dstblt->nHeight);
|
||||
dstblt->nWidth, dstblt->nHeight);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
@ -512,19 +500,19 @@ static BOOL xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
|||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, foreColor);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
}
|
||||
else if (brush->style == GDI_BS_HATCHED)
|
||||
{
|
||||
pattern = xf_mono_bitmap_new(xfc, 8, 8,
|
||||
GDI_BS_HATCHED_PATTERNS + 8 * brush->hatch);
|
||||
GDI_BS_HATCHED_PATTERNS + 8 * brush->hatch);
|
||||
XSetForeground(xfc->display, xfc->gc, backColor);
|
||||
XSetBackground(xfc->display, xfc->gc, foreColor);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
|
||||
XSetStipple(xfc->display, xfc->gc, pattern);
|
||||
XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
XFreePixmap(xfc->display, pattern);
|
||||
}
|
||||
else if (brush->style == GDI_BS_PATTERN)
|
||||
|
@ -536,7 +524,7 @@ static BOOL xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
|||
XSetTile(xfc->display, xfc->gc, pattern);
|
||||
XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
XSetTile(xfc->display, xfc->gc, xfc->primary);
|
||||
XFreePixmap(xfc->display, pattern);
|
||||
}
|
||||
|
@ -549,7 +537,7 @@ static BOOL xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
|||
XSetStipple(xfc->display, xfc->gc, pattern);
|
||||
XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
|
||||
XFreePixmap(xfc->display, pattern);
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +548,7 @@ static BOOL xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
|||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, patblt->nLeftRect, patblt->nTopRect,
|
||||
patblt->nWidth, patblt->nHeight);
|
||||
patblt->nWidth, patblt->nHeight);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
@ -578,12 +566,12 @@ static BOOL xf_gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt)
|
|||
xf_lock_x11(xfc, FALSE);
|
||||
xf_set_rop3(xfc, gdi_rop3_code(scrblt->bRop));
|
||||
XCopyArea(xfc->display, xfc->primary, xfc->drawing, xfc->gc, scrblt->nXSrc,
|
||||
scrblt->nYSrc,
|
||||
scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect);
|
||||
scrblt->nYSrc,
|
||||
scrblt->nWidth, scrblt->nHeight, scrblt->nLeftRect, scrblt->nTopRect);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, scrblt->nLeftRect, scrblt->nTopRect,
|
||||
scrblt->nWidth, scrblt->nHeight);
|
||||
scrblt->nWidth, scrblt->nHeight);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
@ -591,7 +579,7 @@ static BOOL xf_gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt)
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_opaque_rect(rdpContext* context,
|
||||
const OPAQUE_RECT_ORDER* opaque_rect)
|
||||
const OPAQUE_RECT_ORDER* opaque_rect)
|
||||
{
|
||||
UINT32 color;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
@ -602,20 +590,20 @@ static BOOL xf_gdi_opaque_rect(rdpContext* context,
|
|||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, color);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight);
|
||||
opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, opaque_rect->nLeftRect,
|
||||
opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight);
|
||||
opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL xf_gdi_multi_opaque_rect(rdpContext* context,
|
||||
const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
||||
const MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
|
||||
{
|
||||
UINT32 i;
|
||||
UINT32 color;
|
||||
|
@ -632,13 +620,13 @@ static BOOL xf_gdi_multi_opaque_rect(rdpContext* context,
|
|||
{
|
||||
rectangle = &multi_opaque_rect->rectangles[i];
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
|
||||
rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height);
|
||||
rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
if (!(ret = gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height)))
|
||||
rectangle->width, rectangle->height)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -648,7 +636,7 @@ static BOOL xf_gdi_multi_opaque_rect(rdpContext* context,
|
|||
}
|
||||
|
||||
void xf_gdi_draw_nine_grid(rdpContext* context,
|
||||
DRAW_NINE_GRID_ORDER* draw_nine_grid)
|
||||
DRAW_NINE_GRID_ORDER* draw_nine_grid)
|
||||
{
|
||||
WLog_ERR(TAG, "DrawNineGrid");
|
||||
}
|
||||
|
@ -664,7 +652,7 @@ static BOOL xf_gdi_line_to(rdpContext* context, const LINE_TO_ORDER* line_to)
|
|||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, color);
|
||||
XDrawLine(xfc->display, xfc->drawing, xfc->gc,
|
||||
line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);
|
||||
line_to->nXStart, line_to->nYStart, line_to->nXEnd, line_to->nYEnd);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
|
@ -682,7 +670,7 @@ static BOOL xf_gdi_line_to(rdpContext* context, const LINE_TO_ORDER* line_to)
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points,
|
||||
int npoints)
|
||||
int npoints)
|
||||
{
|
||||
int x, y, x1, y1, x2, y2;
|
||||
|
||||
|
@ -717,7 +705,7 @@ static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_polyline(rdpContext* context,
|
||||
const POLYLINE_ORDER* polyline)
|
||||
const POLYLINE_ORDER* polyline)
|
||||
{
|
||||
int i;
|
||||
int npoints;
|
||||
|
@ -749,7 +737,7 @@ static BOOL xf_gdi_polyline(rdpContext* context,
|
|||
}
|
||||
|
||||
XDrawLines(xfc->display, xfc->drawing, xfc->gc, points, npoints,
|
||||
CoordModePrevious);
|
||||
CoordModePrevious);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
|
@ -777,13 +765,13 @@ static BOOL xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
|
|||
if (xf_set_rop3(xfc, gdi_rop3_code(memblt->bRop)))
|
||||
{
|
||||
XCopyArea(xfc->display, bitmap->pixmap, xfc->drawing, xfc->gc,
|
||||
memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight,
|
||||
memblt->nLeftRect, memblt->nTopRect);
|
||||
memblt->nXSrc, memblt->nYSrc, memblt->nWidth, memblt->nHeight,
|
||||
memblt->nLeftRect, memblt->nTopRect);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, memblt->nLeftRect,
|
||||
memblt->nTopRect, memblt->nWidth,
|
||||
memblt->nHeight);
|
||||
memblt->nTopRect, memblt->nWidth,
|
||||
memblt->nHeight);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
}
|
||||
|
@ -844,12 +832,12 @@ static BOOL xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
|||
}
|
||||
|
||||
XCopyArea(xfc->display, bitmap->pixmap, xfc->drawing, xfc->gc,
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight,
|
||||
mem3blt->nLeftRect, mem3blt->nTopRect);
|
||||
mem3blt->nXSrc, mem3blt->nYSrc, mem3blt->nWidth, mem3blt->nHeight,
|
||||
mem3blt->nLeftRect, mem3blt->nTopRect);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, mem3blt->nLeftRect, mem3blt->nTopRect,
|
||||
mem3blt->nWidth, mem3blt->nHeight);
|
||||
mem3blt->nWidth, mem3blt->nHeight);
|
||||
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetTSOrigin(xfc->display, xfc->gc, 0, 0);
|
||||
|
@ -864,7 +852,7 @@ static BOOL xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
|||
|
||||
|
||||
static BOOL xf_gdi_polygon_sc(rdpContext* context,
|
||||
const POLYGON_SC_ORDER* polygon_sc)
|
||||
const POLYGON_SC_ORDER* polygon_sc)
|
||||
{
|
||||
int i, npoints;
|
||||
XPoint* points;
|
||||
|
@ -910,7 +898,7 @@ static BOOL xf_gdi_polygon_sc(rdpContext* context,
|
|||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetForeground(xfc->display, xfc->gc, brush_color);
|
||||
XFillPolygon(xfc->display, xfc->drawing, xfc->gc,
|
||||
points, npoints, Complex, CoordModePrevious);
|
||||
points, npoints, Complex, CoordModePrevious);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
{
|
||||
|
@ -925,7 +913,7 @@ static BOOL xf_gdi_polygon_sc(rdpContext* context,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_polygon_cb(rdpContext* context,
|
||||
POLYGON_CB_ORDER* polygon_cb)
|
||||
POLYGON_CB_ORDER* polygon_cb)
|
||||
{
|
||||
int i, npoints;
|
||||
XPoint* points;
|
||||
|
@ -997,7 +985,7 @@ static BOOL xf_gdi_polygon_cb(rdpContext* context,
|
|||
|
||||
XSetTSOrigin(xfc->display, xfc->gc, brush->x, brush->y);
|
||||
XFillPolygon(xfc->display, xfc->drawing, xfc->gc,
|
||||
points, npoints, Complex, CoordModePrevious);
|
||||
points, npoints, Complex, CoordModePrevious);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetTSOrigin(xfc->display, xfc->gc, 0, 0);
|
||||
XFreePixmap(xfc->display, pattern);
|
||||
|
@ -1020,27 +1008,27 @@ static BOOL xf_gdi_polygon_cb(rdpContext* context,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_ellipse_sc(rdpContext* context,
|
||||
const ELLIPSE_SC_ORDER* ellipse_sc)
|
||||
const ELLIPSE_SC_ORDER* ellipse_sc)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented: EllipseSC");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_gdi_ellipse_cb(rdpContext* context,
|
||||
const ELLIPSE_CB_ORDER* ellipse_cb)
|
||||
const ELLIPSE_CB_ORDER* ellipse_cb)
|
||||
{
|
||||
WLog_ERR(TAG, "Not implemented: EllipseCB");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_gdi_frame_marker(rdpContext* context,
|
||||
const FRAME_MARKER_ORDER* frameMarker)
|
||||
const FRAME_MARKER_ORDER* frameMarker)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_gdi_surface_frame_marker(rdpContext* context,
|
||||
const SURFACE_FRAME_MARKER* surface_frame_marker)
|
||||
const SURFACE_FRAME_MARKER* surface_frame_marker)
|
||||
{
|
||||
rdpSettings* settings;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
@ -1063,12 +1051,12 @@ static BOOL xf_gdi_surface_frame_marker(rdpContext* context,
|
|||
|
||||
if ((xfc->frame_x2 > xfc->frame_x1) && (xfc->frame_y2 > xfc->frame_y1))
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, xfc->frame_x1, xfc->frame_y1,
|
||||
xfc->frame_x2 - xfc->frame_x1, xfc->frame_y2 - xfc->frame_y1);
|
||||
xfc->frame_x2 - xfc->frame_x1, xfc->frame_y2 - xfc->frame_y1);
|
||||
|
||||
if (settings->FrameAcknowledge > 0)
|
||||
{
|
||||
IFCALL(xfc->instance->update->SurfaceFrameAcknowledge, context,
|
||||
surface_frame_marker->frameId);
|
||||
surface_frame_marker->frameId);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -1079,7 +1067,7 @@ static BOOL xf_gdi_surface_frame_marker(rdpContext* context,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_surface_update_frame(xfContext* xfc, UINT16 tx, UINT16 ty,
|
||||
UINT16 width, UINT16 height)
|
||||
UINT16 width, UINT16 height)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
|
@ -1116,7 +1104,7 @@ static BOOL xf_gdi_surface_update_frame(xfContext* xfc, UINT16 tx, UINT16 ty,
|
|||
}
|
||||
|
||||
static BOOL xf_gdi_surface_bits(rdpContext* context,
|
||||
const SURFACE_BITS_COMMAND* cmd)
|
||||
const SURFACE_BITS_COMMAND* cmd)
|
||||
{
|
||||
XImage* image;
|
||||
BYTE* pSrcData;
|
||||
|
@ -1127,97 +1115,83 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
|
|||
REGION16 invalidRegion;
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (cmd->codecID == RDP_CODEC_ID_REMOTEFX)
|
||||
switch (cmd->codecID)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_REMOTEFX,
|
||||
xfc->settings->DesktopWidth,
|
||||
xfc->settings->DesktopHeight))
|
||||
{
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
case RDP_CODEC_ID_REMOTEFX:
|
||||
if (!rfx_process_message(context->codecs->rfx, cmd->bitmapData,
|
||||
PIXEL_FORMAT_XRGB32, cmd->bitmapDataLength,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
gdi->primary_buffer, gdi->dstFormat, gdi->stride,
|
||||
gdi->height, &invalidRegion))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!rfx_process_message(xfc->codecs->rfx, cmd->bitmapData,
|
||||
PIXEL_FORMAT_XRGB32, cmd->bitmapDataLength,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
gdi->primary_buffer, gdi->dstFormat, gdi->stride,
|
||||
gdi->height, &invalidRegion))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
XRectangle rect;
|
||||
rect.x = cmd->destLeft;
|
||||
rect.y = cmd->destTop;
|
||||
rect.width = cmd->width;
|
||||
rect.height = cmd->height;
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetClipRectangles(xfc->display, xfc->gc, cmd->destLeft, cmd->destTop,
|
||||
&rect, 1, YXBanded);
|
||||
|
||||
XRectangle rect;
|
||||
rect.x = cmd->destLeft;
|
||||
rect.y = cmd->destTop;
|
||||
rect.width = cmd->width;
|
||||
rect.height = cmd->height;
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
XSetClipRectangles(xfc->display, xfc->gc, cmd->destLeft, cmd->destTop,
|
||||
&rect, 1, YXBanded);
|
||||
/* Invalidate the updated region */
|
||||
if (!xf_gdi_surface_update_frame(xfc, rect.x, rect.y,
|
||||
rect.width, rect.height))
|
||||
ret = FALSE;
|
||||
|
||||
/* Invalidate the updated region */
|
||||
if (!xf_gdi_surface_update_frame(xfc, rect.x, rect.y,
|
||||
rect.width, rect.height))
|
||||
ret = FALSE;
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
break;
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
else if (cmd->codecID == RDP_CODEC_ID_NSCODEC)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_NSCODEC,
|
||||
xfc->settings->DesktopWidth,
|
||||
xfc->settings->DesktopHeight))
|
||||
{
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
case RDP_CODEC_ID_NSCODEC:
|
||||
if (!nsc_process_message(context->codecs->nsc, cmd->bpp, cmd->width,
|
||||
cmd->height,
|
||||
cmd->bitmapData, cmd->bitmapDataLength,
|
||||
xfc->bitmap_buffer, xfc->format, 0, 0, 0, cmd->width, cmd->height))
|
||||
{
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!nsc_process_message(xfc->codecs->nsc, cmd->bpp, cmd->width, cmd->height,
|
||||
cmd->bitmapData, cmd->bitmapDataLength,
|
||||
xfc->bitmap_buffer, xfc->format, 0, 0, 0, cmd->width, cmd->height))
|
||||
{
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
pSrcData = context->codecs->nsc->BitmapData;
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width,
|
||||
cmd->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
break;
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
pSrcData = xfc->codecs->nsc->BitmapData;
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop, cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width,
|
||||
cmd->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
else if (cmd->codecID == RDP_CODEC_ID_NONE)
|
||||
{
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
pSrcData = cmd->bitmapData;
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData,
|
||||
PIXEL_FORMAT_BGRX32_VF, -1, 0, 0, &xfc->palette);
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width,
|
||||
cmd->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
|
||||
case RDP_CODEC_ID_NONE:
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
pSrcData = cmd->bitmapData;
|
||||
pDstData = xfc->bitmap_buffer;
|
||||
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
cmd->width, cmd->height, pSrcData,
|
||||
PIXEL_FORMAT_BGRX32_VF, -1, 0, 0, &xfc->palette);
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
|
||||
cmd->destLeft, cmd->destTop,
|
||||
cmd->width, cmd->height);
|
||||
XFree(image);
|
||||
ret = xf_gdi_surface_update_frame(xfc, cmd->destLeft, cmd->destTop, cmd->width,
|
||||
cmd->height);
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
break;
|
||||
|
||||
default:
|
||||
WLog_ERR(TAG, "Unsupported codecID %d", cmd->codecID);
|
||||
}
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
|
|
@ -34,15 +34,12 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
|||
UINT32 surfaceX, surfaceY;
|
||||
RECTANGLE_16 surfaceRect;
|
||||
const RECTANGLE_16* extents;
|
||||
|
||||
surfaceX = surface->gdi.outputOriginX;
|
||||
surfaceY = surface->gdi.outputOriginY;
|
||||
|
||||
surfaceRect.left = surfaceX;
|
||||
surfaceRect.top = surfaceY;
|
||||
surfaceRect.right = surfaceX + surface->gdi.width;
|
||||
surfaceRect.bottom = surfaceY + surface->gdi.height;
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
|
||||
|
@ -50,7 +47,6 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
|||
if (!region16_is_empty(&surface->gdi.invalidRegion))
|
||||
{
|
||||
extents = region16_extents(&surface->gdi.invalidRegion);
|
||||
|
||||
width = extents->right - extents->left;
|
||||
height = extents->bottom - extents->top;
|
||||
|
||||
|
@ -63,35 +59,34 @@ static UINT xf_OutputUpdate(xfContext* xfc, xfGfxSurface* surface)
|
|||
if (surface->stage)
|
||||
{
|
||||
freerdp_image_copy(surface->stage, xfc->format,
|
||||
surface->stageScanline, 0, 0,
|
||||
surface->gdi.width, surface->gdi.height,
|
||||
surface->gdi.data, surface->gdi.format,
|
||||
surface->gdi.scanline, 0, 0, NULL);
|
||||
surface->stageScanline, 0, 0,
|
||||
surface->gdi.width, surface->gdi.height,
|
||||
surface->gdi.data, surface->gdi.format,
|
||||
surface->gdi.scanline, 0, 0, NULL);
|
||||
}
|
||||
|
||||
#ifdef WITH_XRENDER
|
||||
|
||||
if (xfc->settings->SmartSizing || xfc->settings->MultiTouchGestures)
|
||||
{
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc, surface->image,
|
||||
extents->left, extents->top, extents->left + surfaceX, extents->top + surfaceY, width, height);
|
||||
|
||||
extents->left, extents->top, extents->left + surfaceX, extents->top + surfaceY,
|
||||
width, height);
|
||||
xf_draw_screen(xfc, extents->left, extents->top, width, height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XPutImage(xfc->display, xfc->drawable, xfc->gc,
|
||||
surface->image, extents->left, extents->top,
|
||||
extents->left + surfaceX, extents->top + surfaceY,
|
||||
width, height);
|
||||
surface->image, extents->left, extents->top,
|
||||
extents->left + surfaceX, extents->top + surfaceY,
|
||||
width, height);
|
||||
}
|
||||
}
|
||||
|
||||
region16_clear(&surface->gdi.invalidRegion);
|
||||
|
||||
XSetClipMask(xfc->display, xfc->gc, None);
|
||||
XSync(xfc->display, False);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -127,12 +122,11 @@ static UINT xf_UpdateSurfaces(RdpgfxClientContext* context)
|
|||
}
|
||||
|
||||
free(pSurfaceIds);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
|
||||
UINT32 width, UINT32 height)
|
||||
UINT32 width, UINT32 height)
|
||||
{
|
||||
UINT16 count;
|
||||
UINT32 index;
|
||||
|
@ -143,12 +137,10 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
|
|||
RECTANGLE_16 intersection;
|
||||
UINT16* pSurfaceIds = NULL;
|
||||
RdpgfxClientContext* context = xfc->gfx;
|
||||
|
||||
invalidRect.left = x;
|
||||
invalidRect.top = y;
|
||||
invalidRect.right = x + width;
|
||||
invalidRect.bottom = y + height;
|
||||
|
||||
context->GetSurfaceIds(context, &pSurfaceIds, &count);
|
||||
|
||||
for (index = 0; index < count; index++)
|
||||
|
@ -170,16 +162,15 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
|
|||
intersection.top -= surfaceRect.top;
|
||||
intersection.right -= surfaceRect.left;
|
||||
intersection.bottom -= surfaceRect.top;
|
||||
|
||||
region16_union_rect(&surface->gdi.invalidRegion,
|
||||
&surface->gdi.invalidRegion,
|
||||
&intersection);
|
||||
&surface->gdi.invalidRegion,
|
||||
&intersection);
|
||||
}
|
||||
}
|
||||
|
||||
free(pSurfaceIds);
|
||||
|
||||
IFCALLRET(context->UpdateSurfaces, status, context);
|
||||
|
||||
if (status < 0)
|
||||
status = -1;
|
||||
|
||||
|
@ -192,50 +183,54 @@ UINT xf_OutputExpose(xfContext* xfc, UINT32 x, UINT32 y,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
||||
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
||||
{
|
||||
size_t size;
|
||||
xfGfxSurface* surface;
|
||||
rdpGdi* gdi = (rdpGdi*)context->custom;
|
||||
xfContext* xfc = (xfContext*) gdi->context;
|
||||
|
||||
surface = (xfGfxSurface*) calloc(1, sizeof(xfGfxSurface));
|
||||
|
||||
if (!surface)
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
|
||||
surface->gdi.codecs = codecs_new((rdpContext*) xfc);
|
||||
surface->gdi.codecs = codecs_new(gdi->context);
|
||||
|
||||
if (!surface->gdi.codecs)
|
||||
{
|
||||
free (surface);
|
||||
free(surface);
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (!freerdp_client_codecs_reset(surface->gdi.codecs, FREERDP_CODEC_ALL,
|
||||
createSurface->width, createSurface->height))
|
||||
if (!freerdp_client_codecs_prepare(surface->gdi.codecs, FREERDP_CODEC_ALL,
|
||||
createSurface->width, createSurface->height))
|
||||
{
|
||||
free (surface);
|
||||
free(surface);
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
surface->gdi.surfaceId = createSurface->surfaceId;
|
||||
surface->gdi.width = (UINT32) createSurface->width;
|
||||
surface->gdi.height = (UINT32) createSurface->height;
|
||||
switch(createSurface->pixelFormat)
|
||||
|
||||
switch (createSurface->pixelFormat)
|
||||
{
|
||||
case GFX_PIXEL_FORMAT_ARGB_8888:
|
||||
surface->gdi.format = PIXEL_FORMAT_BGRA32;
|
||||
break;
|
||||
case GFX_PIXEL_FORMAT_XRGB_8888:
|
||||
surface->gdi.format = PIXEL_FORMAT_BGRX32;
|
||||
break;
|
||||
default:
|
||||
free (surface);
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
case GFX_PIXEL_FORMAT_ARGB_8888:
|
||||
surface->gdi.format = PIXEL_FORMAT_BGRA32;
|
||||
break;
|
||||
|
||||
case GFX_PIXEL_FORMAT_XRGB_8888:
|
||||
surface->gdi.format = PIXEL_FORMAT_BGRX32;
|
||||
break;
|
||||
|
||||
default:
|
||||
free(surface);
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
surface->gdi.scanline = surface->gdi.width * GetBytesPerPixel(surface->gdi.format);
|
||||
surface->gdi.scanline = surface->gdi.width * GetBytesPerPixel(
|
||||
surface->gdi.format);
|
||||
|
||||
if (xfc->scanline_pad > 0)
|
||||
{
|
||||
surface->gdi.scanline += (xfc->scanline_pad / 8);
|
||||
|
@ -252,17 +247,19 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
|||
}
|
||||
|
||||
ZeroMemory(surface->gdi.data, size);
|
||||
|
||||
if (xfc->format == surface->gdi.format)
|
||||
{
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
|
||||
(char*) surface->gdi.data, surface->gdi.width, surface->gdi.height, xfc->scanline_pad, surface->gdi.scanline);
|
||||
(char*) surface->gdi.data, surface->gdi.width, surface->gdi.height,
|
||||
xfc->scanline_pad, surface->gdi.scanline);
|
||||
}
|
||||
else
|
||||
{
|
||||
UINT32 width = surface->gdi.width;
|
||||
UINT32 bytes = GetBytesPerPixel(xfc->format);
|
||||
|
||||
surface->stageScanline = width * bytes;
|
||||
|
||||
if (xfc->scanline_pad > 0)
|
||||
{
|
||||
surface->stageScanline += (xfc->scanline_pad / 8);
|
||||
|
@ -270,7 +267,6 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
|||
}
|
||||
|
||||
size = surface->stageScanline * surface->gdi.height;
|
||||
|
||||
surface->stage = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
if (!surface->stage)
|
||||
|
@ -281,19 +277,15 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
|||
}
|
||||
|
||||
ZeroMemory(surface->stage, size);
|
||||
|
||||
surface->image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
|
||||
ZPixmap, 0, (char*) surface->stage,
|
||||
surface->gdi.width, surface->gdi.height,
|
||||
xfc->scanline_pad, surface->gdi.scanline);
|
||||
ZPixmap, 0, (char*) surface->stage,
|
||||
surface->gdi.width, surface->gdi.height,
|
||||
xfc->scanline_pad, surface->gdi.scanline);
|
||||
}
|
||||
|
||||
surface->gdi.outputMapped = FALSE;
|
||||
|
||||
region16_init(&surface->gdi.invalidRegion);
|
||||
|
||||
context->SetSurfaceData(context, surface->gdi.surfaceId, (void*) surface);
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
|
@ -303,12 +295,12 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT xf_DeleteSurface(RdpgfxClientContext* context,
|
||||
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
|
||||
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
|
||||
{
|
||||
rdpCodecs* codecs = NULL;
|
||||
xfGfxSurface* surface = NULL;
|
||||
|
||||
surface = (xfGfxSurface*) context->GetSurfaceData(context, deleteSurface->surfaceId);
|
||||
surface = (xfGfxSurface*) context->GetSurfaceData(context,
|
||||
deleteSurface->surfaceId);
|
||||
|
||||
if (surface)
|
||||
{
|
||||
|
@ -323,19 +315,17 @@ static UINT xf_DeleteSurface(RdpgfxClientContext* context,
|
|||
context->SetSurfaceData(context, deleteSurface->surfaceId, NULL);
|
||||
|
||||
if (codecs && codecs->progressive)
|
||||
progressive_delete_surface_context(codecs->progressive, deleteSurface->surfaceId);
|
||||
progressive_delete_surface_context(codecs->progressive,
|
||||
deleteSurface->surfaceId);
|
||||
|
||||
codecs_free(codecs);
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
void xf_graphics_pipeline_init(xfContext* xfc, RdpgfxClientContext* gfx)
|
||||
{
|
||||
rdpGdi* gdi = xfc->context.gdi;
|
||||
|
||||
gdi_graphics_pipeline_init(gdi, gfx);
|
||||
|
||||
gfx->UpdateSurfaces = xf_UpdateSurfaces;
|
||||
gfx->CreateSurface = xf_CreateSurface;
|
||||
gfx->DeleteSurface = xf_DeleteSurface;
|
||||
|
|
|
@ -51,13 +51,11 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
|||
XImage* image;
|
||||
UINT32 SrcFormat;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
data = bitmap->data;
|
||||
depth = GetBitsPerPixel(bitmap->format);
|
||||
|
||||
pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width, bitmap->height, xfc->depth);
|
||||
pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width,
|
||||
bitmap->height, xfc->depth);
|
||||
|
||||
if (bitmap->data)
|
||||
{
|
||||
|
@ -72,28 +70,24 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
|||
}
|
||||
|
||||
SrcFormat = bitmap->format;
|
||||
|
||||
freerdp_image_copy(data, xfc->format, -1, 0, 0,
|
||||
bitmap->width, bitmap->height,
|
||||
bitmap->data, SrcFormat,
|
||||
-1, 0, 0, &xfc->palette);
|
||||
|
||||
bitmap->width, bitmap->height,
|
||||
bitmap->data, SrcFormat,
|
||||
-1, 0, 0, &xfc->palette);
|
||||
_aligned_free(bitmap->data);
|
||||
bitmap->data = data;
|
||||
|
||||
bitmap->format = xfc->format;
|
||||
}
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
|
||||
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);
|
||||
|
||||
XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width, bitmap->height);
|
||||
|
||||
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
|
||||
xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width,
|
||||
bitmap->height);
|
||||
XFree(image);
|
||||
}
|
||||
|
||||
((xfBitmap*) bitmap)->pixmap = pixmap;
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -101,7 +95,6 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
|||
static void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (((xfBitmap*) bitmap)->pixmap != 0)
|
||||
|
@ -116,31 +109,24 @@ static BOOL xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
|
|||
int width, height;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
width = bitmap->right - bitmap->left + 1;
|
||||
height = bitmap->bottom - bitmap->top + 1;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
|
||||
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);
|
||||
|
||||
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
|
||||
xfc->scanline_pad, 0);
|
||||
XPutImage(xfc->display, xfc->primary, xfc->gc,
|
||||
image, 0, 0, bitmap->left, bitmap->top, width, height);
|
||||
|
||||
image, 0, 0, bitmap->left, bitmap->top, width, height);
|
||||
XFree(image);
|
||||
|
||||
ret = gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
const BYTE* data, UINT32 width, UINT32 height, UINT32 bpp, UINT32 length,
|
||||
BOOL compressed, UINT32 codecId)
|
||||
const BYTE* data, UINT32 width, UINT32 height, UINT32 bpp, UINT32 length,
|
||||
BOOL compressed, UINT32 codecId)
|
||||
{
|
||||
int status;
|
||||
UINT16 size;
|
||||
|
@ -150,11 +136,10 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
UINT32 SrcFormat;
|
||||
UINT32 bytesPerPixel;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
bytesPerPixel = (bpp + 7) / 8;
|
||||
size = width * height * 4;
|
||||
|
||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
|
||||
if (!bitmap->data)
|
||||
return FALSE;
|
||||
|
||||
|
@ -166,26 +151,16 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
{
|
||||
if (bpp < 32)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_INTERLEAVED,
|
||||
xfc->settings->DesktopWidth,
|
||||
xfc->settings->DesktopHeight))
|
||||
return FALSE;
|
||||
|
||||
status = interleaved_decompress(xfc->codecs->interleaved,
|
||||
pSrcData, SrcSize, bpp,
|
||||
pDstData, xfc->format,
|
||||
-1, 0, 0, width, height,
|
||||
&xfc->palette);
|
||||
status = interleaved_decompress(context->codecs->interleaved,
|
||||
pSrcData, SrcSize, bpp,
|
||||
pDstData, xfc->format,
|
||||
-1, 0, 0, width, height,
|
||||
&xfc->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_PLANAR,
|
||||
xfc->settings->DesktopWidth,
|
||||
xfc->settings->DesktopHeight))
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress(xfc->codecs->planar, pSrcData, SrcSize,
|
||||
pDstData, xfc->format, -1, 0, 0, width, height, TRUE);
|
||||
status = planar_decompress(context->codecs->planar, pSrcData, SrcSize,
|
||||
pDstData, xfc->format, -1, 0, 0, width, height, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
|
@ -197,10 +172,9 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
else
|
||||
{
|
||||
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
|
||||
|
||||
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
|
||||
width, height, pSrcData,
|
||||
SrcFormat, -1, 0, 0, &xfc->palette);
|
||||
width, height, pSrcData,
|
||||
SrcFormat, -1, 0, 0, &xfc->palette);
|
||||
}
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
|
@ -209,10 +183,10 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
|
||||
static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
|
||||
BOOL primary)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (primary)
|
||||
|
@ -230,9 +204,7 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
|||
#ifdef WITH_XCURSOR
|
||||
XcursorImage ci;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
ZeroMemory(&ci, sizeof(ci));
|
||||
ci.version = XCURSOR_IMAGE_VERSION;
|
||||
ci.size = sizeof(ci);
|
||||
|
@ -248,11 +220,11 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
|||
}
|
||||
|
||||
if (freerdp_image_copy_from_pointer_data(
|
||||
(BYTE*) ci.pixels, xfc->format,
|
||||
pointer->width * 4, 0, 0, pointer->width, pointer->height,
|
||||
pointer->xorMaskData, pointer->lengthXorMask,
|
||||
pointer->andMaskData, pointer->lengthAndMask,
|
||||
pointer->xorBpp, &xfc->palette) < 0)
|
||||
(BYTE*) ci.pixels, xfc->format,
|
||||
pointer->width * 4, 0, 0, pointer->width, pointer->height,
|
||||
pointer->xorMaskData, pointer->lengthXorMask,
|
||||
pointer->andMaskData, pointer->lengthAndMask,
|
||||
pointer->xorBpp, &xfc->palette) < 0)
|
||||
{
|
||||
free(ci.pixels);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
|
@ -260,9 +232,7 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
|||
}
|
||||
|
||||
((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfc->display, &ci);
|
||||
|
||||
free(ci.pixels);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
#endif
|
||||
return TRUE;
|
||||
|
@ -272,7 +242,6 @@ static void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
|
|||
{
|
||||
#ifdef WITH_XCURSOR
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (((xfPointer*) pointer)->cursor)
|
||||
|
@ -283,13 +252,11 @@ static void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
|
|||
}
|
||||
|
||||
static BOOL xf_Pointer_Set(rdpContext* context,
|
||||
const rdpPointer* pointer)
|
||||
const rdpPointer* pointer)
|
||||
{
|
||||
#ifdef WITH_XCURSOR
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xfc->pointer = (xfPointer*) pointer;
|
||||
|
||||
/* in RemoteApp mode, window can be null if none has had focus */
|
||||
|
@ -307,7 +274,6 @@ static BOOL xf_Pointer_SetNull(rdpContext* context)
|
|||
#ifdef WITH_XCURSOR
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
static Cursor nullcursor = None;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (nullcursor == None)
|
||||
|
@ -337,9 +303,7 @@ static BOOL xf_Pointer_SetDefault(rdpContext* context)
|
|||
{
|
||||
#ifdef WITH_XCURSOR
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
xfc->pointer = NULL;
|
||||
|
||||
if (xfc->window)
|
||||
|
@ -366,19 +330,18 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
|
|||
goto out;
|
||||
|
||||
tmp.event_mask = (current.your_event_mask & ~(PointerMotionMask));
|
||||
if (XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp) == 0)
|
||||
|
||||
if (XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask,
|
||||
&tmp) == 0)
|
||||
goto out;
|
||||
|
||||
XWarpPointer(xfc->display, None, xfc->window->handle, 0, 0, 0, 0, x, y);
|
||||
|
||||
tmp.event_mask = current.your_event_mask;
|
||||
XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask, &tmp);
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
/* Glyph Class */
|
||||
|
@ -387,26 +350,20 @@ static BOOL xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
|
|||
int scanline;
|
||||
XImage* image;
|
||||
xfGlyph* xf_glyph;
|
||||
|
||||
xf_glyph = (xfGlyph*) glyph;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
scanline = (glyph->cx + 7) / 8;
|
||||
|
||||
xf_glyph->pixmap = XCreatePixmap(xfc->display, xfc->drawing, glyph->cx, glyph->cy, 1);
|
||||
|
||||
xf_glyph->pixmap = XCreatePixmap(xfc->display, xfc->drawing, glyph->cx,
|
||||
glyph->cy, 1);
|
||||
image = XCreateImage(xfc->display, xfc->visual, 1,
|
||||
ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
|
||||
|
||||
ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
|
||||
image->byte_order = MSBFirst;
|
||||
image->bitmap_bit_order = MSBFirst;
|
||||
|
||||
XInitImage(image);
|
||||
XPutImage(xfc->display, xf_glyph->pixmap, xfc->gc_mono, image, 0, 0, 0, 0, glyph->cx, glyph->cy);
|
||||
XPutImage(xfc->display, xf_glyph->pixmap, xfc->gc_mono, image, 0, 0, 0, 0,
|
||||
glyph->cx, glyph->cy);
|
||||
XFree(image);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -414,7 +371,6 @@ static BOOL xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
|
|||
static void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (((xfGlyph*) glyph)->pixmap != 0)
|
||||
|
@ -423,35 +379,29 @@ static void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
|
|||
xf_unlock_x11(xfc, FALSE);
|
||||
}
|
||||
|
||||
static BOOL xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, UINT32 x, UINT32 y)
|
||||
static BOOL xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, UINT32 x,
|
||||
UINT32 y)
|
||||
{
|
||||
xfGlyph* xf_glyph;
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
xf_glyph = (xfGlyph*) glyph;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
XSetStipple(xfc->display, xfc->gc, xf_glyph->pixmap);
|
||||
XSetTSOrigin(xfc->display, xfc->gc, x, y);
|
||||
XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, glyph->cx, glyph->cy);
|
||||
XSetStipple(xfc->display, xfc->gc, xfc->bitmap_mono);
|
||||
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,
|
||||
UINT32 width, UINT32 height, UINT32 bgcolor,
|
||||
UINT32 fgcolor, BOOL fOpRedundant)
|
||||
UINT32 width, UINT32 height, UINT32 bgcolor,
|
||||
UINT32 fgcolor, BOOL fOpRedundant)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
|
||||
bgcolor = xf_convert_rdp_order_color(xfc, bgcolor);
|
||||
fgcolor = xf_convert_rdp_order_color(xfc, fgcolor);
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
XSetFunction(xfc->display, xfc->gc, GXcopy);
|
||||
|
||||
if (width && height)
|
||||
|
@ -463,20 +413,18 @@ static BOOL xf_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,
|
|||
|
||||
XSetForeground(xfc->display, xfc->gc, bgcolor);
|
||||
XSetBackground(xfc->display, xfc->gc, fgcolor);
|
||||
|
||||
XSetFillStyle(xfc->display, xfc->gc, fOpRedundant ? FillOpaqueStippled : FillStippled);
|
||||
|
||||
XSetFillStyle(xfc->display, xfc->gc,
|
||||
fOpRedundant ? FillOpaqueStippled : FillStippled);
|
||||
xf_unlock_x11(xfc, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL xf_Glyph_EndDraw(rdpContext* context, UINT32 x, UINT32 y,
|
||||
UINT32 width, UINT32 height,
|
||||
UINT32 bgcolor, UINT32 fgcolor)
|
||||
UINT32 width, UINT32 height,
|
||||
UINT32 bgcolor, UINT32 fgcolor)
|
||||
{
|
||||
xfContext* xfc = (xfContext*) context;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
xf_lock_x11(xfc, FALSE);
|
||||
|
||||
if (xfc->drawing == xfc->primary)
|
||||
|
@ -510,9 +458,7 @@ BOOL xf_register_graphics(rdpGraphics* graphics)
|
|||
bitmap->Paint = xf_Bitmap_Paint;
|
||||
bitmap->Decompress = xf_Bitmap_Decompress;
|
||||
bitmap->SetSurface = xf_Bitmap_SetSurface;
|
||||
|
||||
graphics_register_bitmap(graphics, bitmap);
|
||||
|
||||
pointer->size = sizeof(xfPointer);
|
||||
pointer->New = xf_Pointer_New;
|
||||
pointer->Free = xf_Pointer_Free;
|
||||
|
@ -520,24 +466,18 @@ BOOL xf_register_graphics(rdpGraphics* graphics)
|
|||
pointer->SetNull = xf_Pointer_SetNull;
|
||||
pointer->SetDefault = xf_Pointer_SetDefault;
|
||||
pointer->SetPosition = xf_Pointer_SetPosition;
|
||||
|
||||
graphics_register_pointer(graphics, pointer);
|
||||
|
||||
glyph->size = sizeof(xfGlyph);
|
||||
glyph->New = xf_Glyph_New;
|
||||
glyph->Free = xf_Glyph_Free;
|
||||
glyph->Draw = xf_Glyph_Draw;
|
||||
glyph->BeginDraw = xf_Glyph_BeginDraw;
|
||||
glyph->EndDraw = xf_Glyph_EndDraw;
|
||||
|
||||
graphics_register_glyph(graphics, glyph);
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
out:
|
||||
free(bitmap);
|
||||
free(pointer);
|
||||
free(glyph);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,6 @@ struct xf_context
|
|||
|
||||
freerdp* instance;
|
||||
rdpSettings* settings;
|
||||
rdpCodecs* codecs;
|
||||
|
||||
GC gc;
|
||||
int xfds;
|
||||
|
@ -136,7 +135,7 @@ struct xf_context
|
|||
HANDLE mutex;
|
||||
BOOL UseXThreads;
|
||||
BOOL cursorHidden;
|
||||
gdiPalette palette;
|
||||
gdiPalette palette;
|
||||
|
||||
HGDI_DC hdc;
|
||||
UINT32 bitmap_size;
|
||||
|
@ -241,7 +240,6 @@ struct xf_context
|
|||
BOOL xf_create_window(xfContext* xfc);
|
||||
void xf_toggle_fullscreen(xfContext* xfc);
|
||||
void xf_toggle_control(xfContext* xfc);
|
||||
BOOL xf_post_connect(freerdp* instance);
|
||||
|
||||
void xf_encomsp_init(xfContext* xfc, EncomspClientContext* encomsp);
|
||||
void xf_encomsp_uninit(xfContext* xfc, EncomspClientContext* encomsp);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -80,6 +80,7 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, BYTE* data, int size)
|
|||
while (left > 0)
|
||||
{
|
||||
s = rdp_send_stream_init(rdp);
|
||||
|
||||
if (!s)
|
||||
return FALSE;
|
||||
|
||||
|
@ -100,11 +101,13 @@ BOOL freerdp_channel_send(rdpRdp* rdp, UINT16 channelId, BYTE* data, int size)
|
|||
|
||||
Stream_Write_UINT32(s, size);
|
||||
Stream_Write_UINT32(s, flags);
|
||||
|
||||
if (!Stream_EnsureCapacity(s, chunkSize))
|
||||
{
|
||||
Stream_Release(s);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Stream_Write(s, data, chunkSize);
|
||||
|
||||
if (!rdp_send(rdp, s, channelId))
|
||||
|
@ -133,14 +136,13 @@ BOOL freerdp_channel_process(freerdp* instance, wStream* s, UINT16 channelId)
|
|||
Stream_Read_UINT32(s, length);
|
||||
Stream_Read_UINT32(s, flags);
|
||||
chunkLength = Stream_GetRemainingLength(s);
|
||||
|
||||
IFCALL(instance->ReceiveChannelData, instance,
|
||||
channelId, Stream_Pointer(s), chunkLength, flags, length);
|
||||
|
||||
channelId, Stream_Pointer(s), chunkLength, flags, length);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 channelId)
|
||||
BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s,
|
||||
UINT16 channelId)
|
||||
{
|
||||
UINT32 length;
|
||||
UINT32 flags;
|
||||
|
@ -177,17 +179,19 @@ BOOL freerdp_channel_peer_process(freerdp_peer* client, wStream* s, UINT16 chann
|
|||
if (!found)
|
||||
return FALSE;
|
||||
|
||||
client->VirtualChannelRead(client, hChannel, Stream_Pointer(s), Stream_GetRemainingLength(s));
|
||||
client->VirtualChannelRead(client, hChannel, Stream_Pointer(s),
|
||||
Stream_GetRemainingLength(s));
|
||||
}
|
||||
else if (client->ReceiveChannelData)
|
||||
{
|
||||
client->ReceiveChannelData(client, channelId, Stream_Pointer(s), chunkLength, flags, length);
|
||||
client->ReceiveChannelData(client, channelId, Stream_Pointer(s), chunkLength,
|
||||
flags, length);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static WtsApiFunctionTable FreeRDP_WtsApiFunctionTable =
|
||||
static const WtsApiFunctionTable FreeRDP_WtsApiFunctionTable =
|
||||
{
|
||||
0, /* dwVersion */
|
||||
0, /* dwFlags */
|
||||
|
|
|
@ -42,7 +42,8 @@ int g_open_handle_sequence = 1;
|
|||
/* For locking the global resources */
|
||||
static CRITICAL_SECTION g_channels_lock;
|
||||
|
||||
CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(rdpChannels* channels, const char* name)
|
||||
CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(
|
||||
rdpChannels* channels, const char* name)
|
||||
{
|
||||
int index;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
@ -59,7 +60,8 @@ CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(rdpChannels*
|
|||
}
|
||||
|
||||
/* returns rdpChannel for the channel name passed in */
|
||||
rdpMcsChannel* freerdp_channels_find_channel_by_name(rdpRdp* rdp, const char* name)
|
||||
rdpMcsChannel* freerdp_channels_find_channel_by_name(rdpRdp* rdp,
|
||||
const char* name)
|
||||
{
|
||||
UINT32 index;
|
||||
rdpMcsChannel* channel;
|
||||
|
@ -81,18 +83,20 @@ rdpMcsChannel* freerdp_channels_find_channel_by_name(rdpRdp* rdp, const char* na
|
|||
rdpChannels* freerdp_channels_new(void)
|
||||
{
|
||||
rdpChannels* channels;
|
||||
|
||||
channels = (rdpChannels*) calloc(1, sizeof(rdpChannels));
|
||||
|
||||
if (!channels)
|
||||
return NULL;
|
||||
|
||||
channels->queue = MessageQueue_New(NULL);
|
||||
|
||||
if (!channels->queue)
|
||||
goto error_queue;
|
||||
|
||||
if (!g_OpenHandles)
|
||||
{
|
||||
g_OpenHandles = HashTable_New(TRUE);
|
||||
|
||||
if (!g_OpenHandles)
|
||||
goto error_open_handles;
|
||||
|
||||
|
@ -101,7 +105,6 @@ rdpChannels* freerdp_channels_new(void)
|
|||
}
|
||||
|
||||
return channels;
|
||||
|
||||
error_open_handles:
|
||||
MessageQueue_Free(channels->queue);
|
||||
error_queue:
|
||||
|
@ -135,8 +138,7 @@ void freerdp_channels_free(rdpChannels* channels)
|
|||
pChannelOpenData->pInterface = NULL;
|
||||
}
|
||||
|
||||
HashTable_Remove(g_OpenHandles, (void*) (UINT_PTR)pChannelOpenData->OpenHandle);
|
||||
|
||||
HashTable_Remove(g_OpenHandles, (void*)(UINT_PTR)pChannelOpenData->OpenHandle);
|
||||
}
|
||||
|
||||
if (g_OpenHandles)
|
||||
|
@ -161,18 +163,17 @@ void freerdp_channels_free(rdpChannels* channels)
|
|||
*
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
UINT freerdp_drdynvc_on_channel_connected(DrdynvcClientContext* context, const char* name, void* pInterface)
|
||||
UINT freerdp_drdynvc_on_channel_connected(DrdynvcClientContext* context,
|
||||
const char* name, void* pInterface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
ChannelConnectedEventArgs e;
|
||||
rdpChannels* channels = (rdpChannels*) context->custom;
|
||||
freerdp* instance = channels->instance;
|
||||
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.name = name;
|
||||
e.pInterface = pInterface;
|
||||
PubSub_OnChannelConnected(instance->context->pubSub, instance->context, &e);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -181,18 +182,17 @@ UINT freerdp_drdynvc_on_channel_connected(DrdynvcClientContext* context, const c
|
|||
*
|
||||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
UINT freerdp_drdynvc_on_channel_disconnected(DrdynvcClientContext* context, const char* name, void* pInterface)
|
||||
UINT freerdp_drdynvc_on_channel_disconnected(DrdynvcClientContext* context,
|
||||
const char* name, void* pInterface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
ChannelDisconnectedEventArgs e;
|
||||
rdpChannels* channels = (rdpChannels*) context->custom;
|
||||
freerdp* instance = channels->instance;
|
||||
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.name = name;
|
||||
e.pInterface = pInterface;
|
||||
PubSub_OnChannelDisconnected(instance->context->pubSub, instance->context, &e);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,6 @@ UINT freerdp_channels_pre_connect(rdpChannels* channels, freerdp* instance)
|
|||
UINT error = CHANNEL_RC_OK;
|
||||
int index;
|
||||
CHANNEL_CLIENT_DATA* pChannelClientData;
|
||||
|
||||
channels->instance = instance;
|
||||
|
||||
for (index = 0; index < channels->clientDataCount; index++)
|
||||
|
@ -214,8 +213,9 @@ UINT freerdp_channels_pre_connect(rdpChannels* channels, freerdp* instance)
|
|||
|
||||
if (pChannelClientData->pChannelInitEventProc)
|
||||
pChannelClientData->pChannelInitEventProc(
|
||||
pChannelClientData->pInitHandle,
|
||||
CHANNEL_EVENT_INITIALIZED, 0, 0);
|
||||
pChannelClientData->pInitHandle,
|
||||
CHANNEL_EVENT_INITIALIZED, 0, 0);
|
||||
|
||||
if (CHANNEL_RC_OK != getChannelError(instance->context))
|
||||
break;
|
||||
}
|
||||
|
@ -236,7 +236,6 @@ UINT freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
|
|||
char* hostname;
|
||||
int hostnameLength;
|
||||
CHANNEL_CLIENT_DATA* pChannelClientData;
|
||||
|
||||
channels->connected = 1;
|
||||
hostname = instance->settings->ServerHostname;
|
||||
hostnameLength = (int) strlen(hostname);
|
||||
|
@ -249,55 +248,56 @@ UINT freerdp_channels_post_connect(rdpChannels* channels, freerdp* instance)
|
|||
{
|
||||
ChannelConnectedEventArgs e;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
||||
pChannelOpenData = &channels->openDataList[index];
|
||||
|
||||
pChannelClientData->pChannelInitEventProc(pChannelClientData->pInitHandle,
|
||||
CHANNEL_EVENT_CONNECTED, hostname, hostnameLength);
|
||||
CHANNEL_EVENT_CONNECTED, hostname, hostnameLength);
|
||||
|
||||
if (getChannelError(instance->context) != CHANNEL_RC_OK)
|
||||
goto fail;
|
||||
|
||||
name = (char*) malloc(9);
|
||||
|
||||
if (!name)
|
||||
{
|
||||
error = CHANNEL_RC_NO_MEMORY;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
CopyMemory(name, pChannelOpenData->name, 8);
|
||||
name[8] = '\0';
|
||||
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.name = name;
|
||||
e.pInterface = pChannelOpenData->pInterface;
|
||||
PubSub_OnChannelConnected(instance->context->pubSub, instance->context, &e);
|
||||
|
||||
free(name);
|
||||
name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
channels->drdynvc = (DrdynvcClientContext*) freerdp_channels_get_static_channel_interface(channels, "drdynvc");
|
||||
channels->drdynvc = (DrdynvcClientContext*)
|
||||
freerdp_channels_get_static_channel_interface(channels, "drdynvc");
|
||||
|
||||
if (channels->drdynvc)
|
||||
{
|
||||
channels->drdynvc->custom = (void*) channels;
|
||||
channels->drdynvc->OnChannelConnected = freerdp_drdynvc_on_channel_connected;
|
||||
channels->drdynvc->OnChannelDisconnected = freerdp_drdynvc_on_channel_disconnected;
|
||||
channels->drdynvc->OnChannelDisconnected =
|
||||
freerdp_drdynvc_on_channel_disconnected;
|
||||
}
|
||||
|
||||
fail:
|
||||
free (name);
|
||||
free(name);
|
||||
return error;
|
||||
}
|
||||
|
||||
int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int dataSize, int flags, int totalSize)
|
||||
int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data,
|
||||
int dataSize, int flags, int totalSize)
|
||||
{
|
||||
UINT32 index;
|
||||
rdpMcs* mcs;
|
||||
rdpChannels* channels;
|
||||
rdpMcsChannel* channel = NULL;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
||||
mcs = instance->context->rdp->mcs;
|
||||
channels = instance->context->channels;
|
||||
|
||||
|
@ -320,7 +320,8 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int d
|
|||
return 1;
|
||||
}
|
||||
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels, channel->Name);
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels,
|
||||
channel->Name);
|
||||
|
||||
if (!pChannelOpenData)
|
||||
{
|
||||
|
@ -330,7 +331,7 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int d
|
|||
if (pChannelOpenData->pChannelOpenEventProc)
|
||||
{
|
||||
pChannelOpenData->pChannelOpenEventProc(pChannelOpenData->OpenHandle,
|
||||
CHANNEL_EVENT_DATA_RECEIVED, data, dataSize, totalSize, flags);
|
||||
CHANNEL_EVENT_DATA_RECEIVED, data, dataSize, totalSize, flags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -339,7 +340,8 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data, int d
|
|||
/**
|
||||
* called only from main thread
|
||||
*/
|
||||
static int freerdp_channels_process_sync(rdpChannels* channels, freerdp* instance)
|
||||
static int freerdp_channels_process_sync(rdpChannels* channels,
|
||||
freerdp* instance)
|
||||
{
|
||||
int status = TRUE;
|
||||
wMessage message;
|
||||
|
@ -363,16 +365,18 @@ static int freerdp_channels_process_sync(rdpChannels* channels, freerdp* instanc
|
|||
break;
|
||||
|
||||
pChannelOpenData = item->pChannelOpenData;
|
||||
|
||||
channel = freerdp_channels_find_channel_by_name(instance->context->rdp, pChannelOpenData->name);
|
||||
channel = freerdp_channels_find_channel_by_name(instance->context->rdp,
|
||||
pChannelOpenData->name);
|
||||
|
||||
if (channel)
|
||||
instance->SendChannelData(instance, channel->ChannelId, item->Data, item->DataLength);
|
||||
instance->SendChannelData(instance, channel->ChannelId, item->Data,
|
||||
item->DataLength);
|
||||
|
||||
if (pChannelOpenData->pChannelOpenEventProc)
|
||||
{
|
||||
pChannelOpenData->pChannelOpenEventProc(pChannelOpenData->OpenHandle,
|
||||
CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, item->DataLength, item->DataLength, 0);
|
||||
CHANNEL_EVENT_WRITE_COMPLETE, item->UserData, item->DataLength,
|
||||
item->DataLength, 0);
|
||||
}
|
||||
|
||||
free(item);
|
||||
|
@ -385,11 +389,11 @@ static int freerdp_channels_process_sync(rdpChannels* channels, freerdp* instanc
|
|||
/**
|
||||
* called only from main thread
|
||||
*/
|
||||
BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** read_fds,
|
||||
int* read_count, void** write_fds, int* write_count)
|
||||
BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance,
|
||||
void** read_fds,
|
||||
int* read_count, void** write_fds, int* write_count)
|
||||
{
|
||||
void* pfd;
|
||||
|
||||
pfd = GetEventWaitObject(MessageQueue_Event(channels->queue));
|
||||
|
||||
if (pfd)
|
||||
|
@ -401,12 +405,13 @@ BOOL freerdp_channels_get_fds(rdpChannels* channels, freerdp* instance, void** r
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void* freerdp_channels_get_static_channel_interface(rdpChannels* channels, const char* name)
|
||||
void* freerdp_channels_get_static_channel_interface(rdpChannels* channels,
|
||||
const char* name)
|
||||
{
|
||||
void* pInterface = NULL;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels, name);
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels,
|
||||
name);
|
||||
|
||||
if (pChannelOpenData)
|
||||
pInterface = pChannelOpenData->pInterface;
|
||||
|
@ -418,22 +423,20 @@ HANDLE freerdp_channels_get_event_handle(freerdp* instance)
|
|||
{
|
||||
HANDLE event = NULL;
|
||||
rdpChannels* channels;
|
||||
|
||||
channels = instance->context->channels;
|
||||
event = MessageQueue_Event(channels->queue);
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
int freerdp_channels_process_pending_messages(freerdp* instance)
|
||||
{
|
||||
rdpChannels* channels;
|
||||
|
||||
channels = instance->context->channels;
|
||||
|
||||
if (WaitForSingleObject(MessageQueue_Event(channels->queue), 0) == WAIT_OBJECT_0)
|
||||
if (WaitForSingleObject(MessageQueue_Event(channels->queue),
|
||||
0) == WAIT_OBJECT_0)
|
||||
{
|
||||
return freerdp_channels_process_sync(channels, instance);
|
||||
return freerdp_channels_process_sync(channels, instance);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -444,7 +447,8 @@ int freerdp_channels_process_pending_messages(freerdp* instance)
|
|||
*/
|
||||
BOOL freerdp_channels_check_fds(rdpChannels* channels, freerdp* instance)
|
||||
{
|
||||
if (WaitForSingleObject(MessageQueue_Event(channels->queue), 0) == WAIT_OBJECT_0)
|
||||
if (WaitForSingleObject(MessageQueue_Event(channels->queue),
|
||||
0) == WAIT_OBJECT_0)
|
||||
{
|
||||
freerdp_channels_process_sync(channels, instance);
|
||||
}
|
||||
|
@ -470,29 +474,28 @@ UINT freerdp_channels_disconnect(rdpChannels* channels, freerdp* instance)
|
|||
for (index = 0; index < channels->clientDataCount; index++)
|
||||
{
|
||||
ChannelDisconnectedEventArgs e;
|
||||
|
||||
pChannelClientData = &channels->clientDataList[index];
|
||||
|
||||
if (pChannelClientData->pChannelInitEventProc)
|
||||
pChannelClientData->pChannelInitEventProc(
|
||||
pChannelClientData->pInitHandle,
|
||||
CHANNEL_EVENT_DISCONNECTED, 0, 0);
|
||||
pChannelClientData->pInitHandle,
|
||||
CHANNEL_EVENT_DISCONNECTED, 0, 0);
|
||||
|
||||
if (getChannelError(instance->context) != CHANNEL_RC_OK)
|
||||
goto fail;
|
||||
|
||||
pChannelOpenData = &channels->openDataList[index];
|
||||
|
||||
name = (char*) malloc(9);
|
||||
|
||||
if (!name)
|
||||
return -1;
|
||||
|
||||
CopyMemory(name, pChannelOpenData->name, 8);
|
||||
name[8] = '\0';
|
||||
|
||||
EventArgsInit(&e, "freerdp");
|
||||
e.name = name;
|
||||
e.pInterface = pChannelOpenData->pInterface;
|
||||
PubSub_OnChannelDisconnected(instance->context->pubSub, instance->context, &e);
|
||||
|
||||
free(name);
|
||||
}
|
||||
|
||||
|
@ -504,7 +507,6 @@ void freerdp_channels_close(rdpChannels* channels, freerdp* instance)
|
|||
{
|
||||
int index;
|
||||
CHANNEL_CLIENT_DATA* pChannelClientData;
|
||||
|
||||
freerdp_channels_check_fds(channels, instance);
|
||||
|
||||
/* tell all libraries we are shutting down */
|
||||
|
@ -513,16 +515,19 @@ void freerdp_channels_close(rdpChannels* channels, freerdp* instance)
|
|||
pChannelClientData = &channels->clientDataList[index];
|
||||
|
||||
if (pChannelClientData->pChannelInitEventProc)
|
||||
pChannelClientData->pChannelInitEventProc(pChannelClientData->pInitHandle, CHANNEL_EVENT_TERMINATED, 0, 0);
|
||||
pChannelClientData->pChannelInitEventProc(pChannelClientData->pInitHandle,
|
||||
CHANNEL_EVENT_TERMINATED, 0, 0);
|
||||
}
|
||||
|
||||
MessageQueue_PostQuit(channels->queue, 0);
|
||||
}
|
||||
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, PCHANNEL_DEF pChannel,
|
||||
INT channelCount, ULONG versionRequested, PCHANNEL_INIT_EVENT_FN pChannelInitEventProc)
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle,
|
||||
PCHANNEL_DEF pChannel,
|
||||
INT channelCount, ULONG versionRequested,
|
||||
PCHANNEL_INIT_EVENT_FN pChannelInitEventProc)
|
||||
{
|
||||
int index;
|
||||
INT index;
|
||||
void* pInterface;
|
||||
DWORD OpenHandle;
|
||||
CHANNEL_DEF* channel;
|
||||
|
@ -536,13 +541,14 @@ UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, PCHANNEL_DEF pCh
|
|||
if (!ppInitHandle)
|
||||
return CHANNEL_RC_BAD_INIT_HANDLE;
|
||||
|
||||
if (!pChannel || (channelCount <= 0) || !pChannelInitEventProc)
|
||||
return CHANNEL_RC_INITIALIZATION_ERROR;
|
||||
|
||||
channels = g_ChannelInitData.channels;
|
||||
pInterface = g_pInterface;
|
||||
|
||||
pChannelInitData = &(channels->initDataList[channels->initDataCount]);
|
||||
*ppInitHandle = pChannelInitData;
|
||||
channels->initDataCount++;
|
||||
|
||||
pChannelInitData->channels = channels;
|
||||
pChannelInitData->pInterface = pInterface;
|
||||
|
||||
|
@ -560,14 +566,14 @@ UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, PCHANNEL_DEF pCh
|
|||
|
||||
if (versionRequested != VIRTUAL_CHANNEL_VERSION_WIN2000)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
for (index = 0; index < channelCount; index++)
|
||||
{
|
||||
pChannelDef = &pChannel[index];
|
||||
|
||||
if (freerdp_channels_find_channel_open_data_by_name(channels, pChannelDef->name) != 0)
|
||||
if (freerdp_channels_find_channel_open_data_by_name(channels,
|
||||
pChannelDef->name) != 0)
|
||||
{
|
||||
return CHANNEL_RC_BAD_CHANNEL;
|
||||
}
|
||||
|
@ -577,21 +583,17 @@ UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, PCHANNEL_DEF pCh
|
|||
pChannelClientData->pChannelInitEventProc = pChannelInitEventProc;
|
||||
pChannelClientData->pInitHandle = *ppInitHandle;
|
||||
channels->clientDataCount++;
|
||||
|
||||
settings = channels->settings;
|
||||
|
||||
for (index = 0; index < channelCount; index++)
|
||||
{
|
||||
pChannelDef = &pChannel[index];
|
||||
pChannelOpenData = &channels->openDataList[channels->openDataCount];
|
||||
|
||||
OpenHandle = g_open_handle_sequence++;
|
||||
|
||||
pChannelOpenData->OpenHandle = OpenHandle;
|
||||
pChannelOpenData->channels = channels;
|
||||
|
||||
HashTable_Add(g_OpenHandles, (void*) (UINT_PTR) OpenHandle, (void*) pChannelOpenData);
|
||||
|
||||
HashTable_Add(g_OpenHandles, (void*)(UINT_PTR) OpenHandle,
|
||||
(void*) pChannelOpenData);
|
||||
pChannelOpenData->flags = 1; /* init */
|
||||
strncpy(pChannelOpenData->name, pChannelDef->name, CHANNEL_NAME_LEN);
|
||||
pChannelOpenData->options = pChannelDef->options;
|
||||
|
@ -610,14 +612,14 @@ UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, PCHANNEL_DEF pCh
|
|||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelOpen(LPVOID pInitHandle, LPDWORD pOpenHandle,
|
||||
PCHAR pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc)
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelOpen(LPVOID pInitHandle,
|
||||
LPDWORD pOpenHandle,
|
||||
PCHAR pChannelName, PCHANNEL_OPEN_EVENT_FN pChannelOpenEventProc)
|
||||
{
|
||||
void* pInterface;
|
||||
rdpChannels* channels;
|
||||
CHANNEL_INIT_DATA* pChannelInitData;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
||||
pChannelInitData = (CHANNEL_INIT_DATA*) pInitHandle;
|
||||
channels = pChannelInitData->channels;
|
||||
pInterface = pChannelInitData->pInterface;
|
||||
|
@ -631,7 +633,8 @@ UINT VCAPITYPE FreeRDP_VirtualChannelOpen(LPVOID pInitHandle, LPDWORD pOpenHandl
|
|||
if (!channels->connected)
|
||||
return CHANNEL_RC_NOT_CONNECTED;
|
||||
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels, pChannelName);
|
||||
pChannelOpenData = freerdp_channels_find_channel_open_data_by_name(channels,
|
||||
pChannelName);
|
||||
|
||||
if (!pChannelOpenData)
|
||||
return CHANNEL_RC_UNKNOWN_CHANNEL_NAME;
|
||||
|
@ -643,15 +646,14 @@ UINT VCAPITYPE FreeRDP_VirtualChannelOpen(LPVOID pInitHandle, LPDWORD pOpenHandl
|
|||
pChannelOpenData->pInterface = pInterface;
|
||||
pChannelOpenData->pChannelOpenEventProc = pChannelOpenEventProc;
|
||||
*pOpenHandle = pChannelOpenData->OpenHandle;
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelClose(DWORD openHandle)
|
||||
{
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
|
||||
pChannelOpenData = HashTable_GetItemValue(g_OpenHandles, (void*) (UINT_PTR) openHandle);
|
||||
pChannelOpenData = HashTable_GetItemValue(g_OpenHandles,
|
||||
(void*)(UINT_PTR) openHandle);
|
||||
|
||||
if (!pChannelOpenData)
|
||||
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
|
||||
|
@ -660,17 +662,17 @@ UINT VCAPITYPE FreeRDP_VirtualChannelClose(DWORD openHandle)
|
|||
return CHANNEL_RC_NOT_OPEN;
|
||||
|
||||
pChannelOpenData->flags = 0;
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG dataLength, LPVOID pUserData)
|
||||
UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData,
|
||||
ULONG dataLength, LPVOID pUserData)
|
||||
{
|
||||
rdpChannels* channels;
|
||||
CHANNEL_OPEN_DATA* pChannelOpenData;
|
||||
CHANNEL_OPEN_EVENT* pChannelOpenEvent;
|
||||
|
||||
pChannelOpenData = HashTable_GetItemValue(g_OpenHandles, (void*) (UINT_PTR) openHandle);
|
||||
pChannelOpenData = HashTable_GetItemValue(g_OpenHandles,
|
||||
(void*)(UINT_PTR) openHandle);
|
||||
|
||||
if (!pChannelOpenData)
|
||||
return CHANNEL_RC_BAD_CHANNEL_HANDLE;
|
||||
|
@ -702,7 +704,8 @@ UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG
|
|||
pChannelOpenEvent->UserData = pUserData;
|
||||
pChannelOpenEvent->pChannelOpenData = pChannelOpenData;
|
||||
|
||||
if (!MessageQueue_Post(channels->queue, (void*) channels, 0, (void*) pChannelOpenEvent, NULL))
|
||||
if (!MessageQueue_Post(channels->queue, (void*) channels, 0,
|
||||
(void*) pChannelOpenEvent, NULL))
|
||||
{
|
||||
free(pChannelOpenEvent);
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
|
@ -711,11 +714,12 @@ UINT VCAPITYPE FreeRDP_VirtualChannelWrite(DWORD openHandle, LPVOID pData, ULONG
|
|||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static BOOL freerdp_channels_is_loaded(rdpChannels* channels, PVIRTUALCHANNELENTRY entry)
|
||||
static BOOL freerdp_channels_is_loaded(rdpChannels* channels,
|
||||
PVIRTUALCHANNELENTRY entry)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<channels->clientDataCount; i++)
|
||||
for (i = 0; i < channels->clientDataCount; i++)
|
||||
{
|
||||
CHANNEL_CLIENT_DATA* pChannelClientData = &channels->clientDataList[i];
|
||||
|
||||
|
@ -726,7 +730,8 @@ static BOOL freerdp_channels_is_loaded(rdpChannels* channels, PVIRTUALCHANNELENT
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, PVIRTUALCHANNELENTRY entry, void* data)
|
||||
int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings,
|
||||
PVIRTUALCHANNELENTRY entry, void* data)
|
||||
{
|
||||
int status;
|
||||
CHANNEL_ENTRY_POINTS_FREERDP EntryPoints;
|
||||
|
@ -746,33 +751,25 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, P
|
|||
|
||||
pChannelClientData = &channels->clientDataList[channels->clientDataCount];
|
||||
pChannelClientData->entry = entry;
|
||||
|
||||
ZeroMemory(&EntryPoints, sizeof(CHANNEL_ENTRY_POINTS_FREERDP));
|
||||
|
||||
EntryPoints.cbSize = sizeof(EntryPoints);
|
||||
EntryPoints.protocolVersion = VIRTUAL_CHANNEL_VERSION_WIN2000;
|
||||
EntryPoints.pVirtualChannelInit = FreeRDP_VirtualChannelInit;
|
||||
EntryPoints.pVirtualChannelOpen = FreeRDP_VirtualChannelOpen;
|
||||
EntryPoints.pVirtualChannelClose = FreeRDP_VirtualChannelClose;
|
||||
EntryPoints.pVirtualChannelWrite = FreeRDP_VirtualChannelWrite;
|
||||
|
||||
EntryPoints.MagicNumber = FREERDP_CHANNEL_MAGIC_NUMBER;
|
||||
EntryPoints.ppInterface = &g_pInterface;
|
||||
EntryPoints.pExtendedData = data;
|
||||
EntryPoints.context = ((freerdp*)settings->instance)->context;
|
||||
|
||||
/* enable VirtualChannelInit */
|
||||
channels->can_call_init = TRUE;
|
||||
channels->settings = settings;
|
||||
|
||||
EnterCriticalSection(&g_channels_lock);
|
||||
|
||||
g_pInterface = NULL;
|
||||
g_ChannelInitData.channels = channels;
|
||||
status = pChannelClientData->entry((PCHANNEL_ENTRY_POINTS) &EntryPoints);
|
||||
|
||||
LeaveCriticalSection(&g_channels_lock);
|
||||
|
||||
/* disable MyVirtualChannelInit */
|
||||
channels->settings = NULL;
|
||||
channels->can_call_init = FALSE;
|
||||
|
@ -790,11 +787,12 @@ int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, P
|
|||
* this is called when processing the command line parameters
|
||||
* called only from main thread
|
||||
*/
|
||||
int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings, const char* name, void* data)
|
||||
int freerdp_channels_load_plugin(rdpChannels* channels, rdpSettings* settings,
|
||||
const char* name, void* data)
|
||||
{
|
||||
void* entry;
|
||||
|
||||
entry = (PVIRTUALCHANNELENTRY) freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
||||
entry = (PVIRTUALCHANNELENTRY) freerdp_load_channel_addin_entry(name, NULL,
|
||||
NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
|
||||
#define TAG FREERDP_TAG("core.codecs")
|
||||
|
||||
BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width, UINT32 height)
|
||||
BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags,
|
||||
UINT32 width, UINT32 height)
|
||||
{
|
||||
if ((flags & FREERDP_CODEC_INTERLEAVED) && !codecs->interleaved)
|
||||
{
|
||||
|
@ -36,13 +37,6 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create interleaved codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!bitmap_interleaved_context_reset(codecs->interleaved))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset interleaved codec context");
|
||||
bitmap_interleaved_context_free(codecs->interleaved);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & FREERDP_CODEC_PLANAR) && !codecs->planar)
|
||||
|
@ -52,13 +46,6 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create planar bitmap codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!freerdp_bitmap_planar_context_reset(codecs->planar, 64, 64))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset plannar bitmap codec context");
|
||||
freerdp_bitmap_planar_context_free(codecs->planar);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & FREERDP_CODEC_NSCODEC) && !codecs->nsc)
|
||||
|
@ -68,13 +55,6 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create nsc codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!nsc_context_reset(codecs->nsc, width, height))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset nsc codec context");
|
||||
nsc_context_free(codecs->nsc);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & FREERDP_CODEC_REMOTEFX) && !codecs->rfx)
|
||||
|
@ -84,13 +64,6 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create rfx codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!rfx_context_reset(codecs->rfx, width, height))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset rfx codec context");
|
||||
rfx_context_free(codecs->rfx);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & FREERDP_CODEC_CLEARCODEC) && !codecs->clear)
|
||||
|
@ -100,18 +73,10 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create clear codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!clear_context_reset(codecs->clear))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset clear codec context");
|
||||
clear_context_free(codecs->clear);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & FREERDP_CODEC_ALPHACODEC)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if ((flags & FREERDP_CODEC_PROGRESSIVE) && !codecs->progressive)
|
||||
|
@ -121,13 +86,6 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create progressive codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!progressive_context_reset(codecs->progressive))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset progressive codec context");
|
||||
progressive_context_free(codecs->progressive);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((flags & (FREERDP_CODEC_AVC420 | FREERDP_CODEC_AVC444)) && !codecs->h264)
|
||||
|
@ -137,19 +95,13 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
|
|||
WLog_ERR(TAG, "Failed to create h264 codec context");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!h264_context_reset(codecs->h264, width, height))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to reset h264 codec context");
|
||||
h264_context_free(codecs->h264);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return freerdp_client_codecs_reset(codecs, flags, width, height);
|
||||
}
|
||||
|
||||
BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width, UINT32 height)
|
||||
BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
|
||||
UINT32 height)
|
||||
{
|
||||
BOOL rc = TRUE;
|
||||
|
||||
|
@ -195,7 +147,6 @@ BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
|
|||
|
||||
if (flags & FREERDP_CODEC_ALPHACODEC)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (flags & FREERDP_CODEC_PROGRESSIVE)
|
||||
|
@ -220,7 +171,6 @@ BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
|
|||
rdpCodecs* codecs_new(rdpContext* context)
|
||||
{
|
||||
rdpCodecs* codecs;
|
||||
|
||||
codecs = (rdpCodecs*) calloc(1, sizeof(rdpCodecs));
|
||||
|
||||
if (codecs)
|
||||
|
|
|
@ -482,11 +482,6 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
|||
{
|
||||
if (bitsPerPixel < 32)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(codecs,
|
||||
FREERDP_CODEC_INTERLEAVED,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = interleaved_decompress(codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bitsPerPixel,
|
||||
|
@ -498,11 +493,6 @@ static BOOL gdi_bitmap_update(rdpContext* context,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(codecs,
|
||||
FREERDP_CODEC_PLANAR,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress(codecs->planar, pSrcData,
|
||||
SrcSize, gdi->primary_buffer,
|
||||
gdi->dstFormat,
|
||||
|
@ -1279,8 +1269,8 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (!freerdp_client_codecs_reset(context->codecs, FREERDP_CODEC_ALL, gdi->width,
|
||||
gdi->height))
|
||||
if (!freerdp_client_codecs_prepare(context->codecs, FREERDP_CODEC_ALL,
|
||||
gdi->width, gdi->height))
|
||||
goto fail;
|
||||
|
||||
gdi_register_update_callbacks(instance->update);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
|
||||
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics)
|
||||
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics)
|
||||
{
|
||||
UINT32 index;
|
||||
UINT16 count;
|
||||
|
@ -50,7 +50,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
|
|||
DesktopHeight = resetGraphics->height;
|
||||
|
||||
if ((DesktopWidth != settings->DesktopWidth)
|
||||
|| (DesktopHeight != settings->DesktopHeight))
|
||||
|| (DesktopHeight != settings->DesktopHeight))
|
||||
{
|
||||
settings->DesktopWidth = DesktopWidth;
|
||||
settings->DesktopHeight = DesktopHeight;
|
||||
|
@ -69,7 +69,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
|
|||
continue;
|
||||
|
||||
if (!freerdp_client_codecs_reset(surface->codecs, FREERDP_CODEC_ALL,
|
||||
surface->width, surface->height))
|
||||
surface->width, surface->height))
|
||||
{
|
||||
free(pSurfaceIds);
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -81,7 +81,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
|
|||
free(pSurfaceIds);
|
||||
|
||||
if (!freerdp_client_codecs_reset(gdi->context->codecs, FREERDP_CODEC_ALL,
|
||||
gdi->width, gdi->height))
|
||||
gdi->width, gdi->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
gdi->graphicsReset = TRUE;
|
||||
|
@ -104,7 +104,7 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
|
|||
surfaceRect.right = surface->width;
|
||||
surfaceRect.bottom = surface->height;
|
||||
region16_intersect_rect(&(surface->invalidRegion),
|
||||
&(surface->invalidRegion), &surfaceRect);
|
||||
&(surface->invalidRegion), &surfaceRect);
|
||||
|
||||
if (!region16_is_empty(&(surface->invalidRegion)))
|
||||
{
|
||||
|
@ -117,9 +117,9 @@ static UINT gdi_OutputUpdate(rdpGdi* gdi, gdiGfxSurface* surface)
|
|||
height = extents->bottom - extents->top;
|
||||
update->BeginPaint(gdi->context);
|
||||
freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
|
||||
nXDst, nYDst, width, height,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, nXSrc, nYSrc, NULL);
|
||||
nXDst, nYDst, width, height,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, nXSrc, nYSrc, NULL);
|
||||
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, width, height);
|
||||
update->EndPaint(gdi->context);
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ static UINT gdi_UpdateSurfaces(RdpgfxClientContext* context)
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_StartFrame(RdpgfxClientContext* context,
|
||||
const RDPGFX_START_FRAME_PDU* startFrame)
|
||||
const RDPGFX_START_FRAME_PDU* startFrame)
|
||||
{
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
gdi->inGfxFrame = TRUE;
|
||||
|
@ -178,7 +178,7 @@ static UINT gdi_StartFrame(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_EndFrame(RdpgfxClientContext* context,
|
||||
const RDPGFX_END_FRAME_PDU* endFrame)
|
||||
const RDPGFX_END_FRAME_PDU* endFrame)
|
||||
{
|
||||
UINT status = CHANNEL_RC_NOT_INITIALIZED;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
|
@ -193,8 +193,8 @@ static UINT gdi_EndFrame(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
gdiGfxSurface* surface;
|
||||
|
@ -205,8 +205,8 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
|
|||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
||||
cmd->left, cmd->top, cmd->width, cmd->height,
|
||||
cmd->data, cmd->format, 0, 0, 0, NULL))
|
||||
cmd->left, cmd->top, cmd->width, cmd->height,
|
||||
cmd->data, cmd->format, 0, 0, 0, NULL))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
invalidRect.left = cmd->left;
|
||||
|
@ -214,7 +214,7 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
|
|||
invalidRect.right = cmd->right;
|
||||
invalidRect.bottom = cmd->bottom;
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
{
|
||||
|
@ -231,8 +231,8 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi,
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
gdiGfxSurface* surface;
|
||||
|
@ -241,16 +241,11 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_REMOTEFX,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!rfx_process_message(surface->codecs->rfx, cmd->data, cmd->format,
|
||||
cmd->length,
|
||||
cmd->left, cmd->top,
|
||||
surface->data, surface->format, surface->scanline,
|
||||
surface->height, &surface->invalidRegion))
|
||||
cmd->length,
|
||||
cmd->left, cmd->top,
|
||||
surface->data, surface->format, surface->scanline,
|
||||
surface->height, &surface->invalidRegion))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to process RemoteFX message");
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -271,8 +266,8 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
INT32 rc;
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
|
@ -283,16 +278,11 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_CLEARCODEC,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
rc = clear_decompress(surface->codecs->clear, cmd->data, cmd->length,
|
||||
cmd->width, cmd->height,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
surface->width, surface->height, &gdi->palette);
|
||||
cmd->width, cmd->height,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
surface->width, surface->height, &gdi->palette);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
|
@ -305,7 +295,7 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
|
|||
invalidRect.right = cmd->right;
|
||||
invalidRect.bottom = cmd->bottom;
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
{
|
||||
|
@ -322,7 +312,7 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
INT32 rc;
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
|
@ -334,16 +324,11 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_PLANAR,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
DstData = surface->data;
|
||||
rc = planar_decompress(surface->codecs->planar, cmd->data, cmd->length,
|
||||
DstData, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, FALSE);
|
||||
DstData, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, FALSE);
|
||||
|
||||
if (rc < 0)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -353,7 +338,7 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
invalidRect.right = cmd->right;
|
||||
invalidRect.bottom = cmd->bottom;
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
{
|
||||
|
@ -370,8 +355,8 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
INT32 rc;
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
|
@ -384,11 +369,6 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_AVC420,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
bs = (RDPGFX_AVC420_BITMAP_STREAM*) cmd->extra;
|
||||
|
||||
if (!bs)
|
||||
|
@ -396,10 +376,10 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
|
|||
|
||||
meta = &(bs->meta);
|
||||
rc = avc420_decompress(surface->codecs->h264, bs->data, bs->length,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, surface->width,
|
||||
surface->height, meta->regionRects,
|
||||
meta->numRegionRects);
|
||||
surface->data, surface->format,
|
||||
surface->scanline, surface->width,
|
||||
surface->height, meta->regionRects,
|
||||
meta->numRegionRects);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
|
@ -410,7 +390,7 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
|
|||
for (i = 0; i < meta->numRegionRects; i++)
|
||||
{
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
(RECTANGLE_16*) & (meta->regionRects[i]));
|
||||
(RECTANGLE_16*) & (meta->regionRects[i]));
|
||||
}
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
|
@ -428,7 +408,7 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
INT32 rc;
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
|
@ -445,11 +425,6 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_AVC444,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
bs = (RDPGFX_AVC444_BITMAP_STREAM*) cmd->extra;
|
||||
|
||||
if (!bs)
|
||||
|
@ -460,13 +435,13 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
meta1 = &avc1->meta;
|
||||
meta2 = &avc2->meta;
|
||||
rc = avc444_decompress(surface->codecs->h264, bs->LC,
|
||||
meta1->regionRects, meta1->numRegionRects,
|
||||
avc1->data, avc1->length,
|
||||
meta2->regionRects, meta2->numRegionRects,
|
||||
avc2->data, avc2->length,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, surface->width,
|
||||
surface->height);
|
||||
meta1->regionRects, meta1->numRegionRects,
|
||||
avc1->data, avc1->length,
|
||||
meta2->regionRects, meta2->numRegionRects,
|
||||
avc2->data, avc2->length,
|
||||
surface->data, surface->format,
|
||||
surface->scanline, surface->width,
|
||||
surface->height);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
|
@ -477,15 +452,15 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
for (i = 0; i < meta1->numRegionRects; i++)
|
||||
{
|
||||
region16_union_rect(&(surface->invalidRegion),
|
||||
&(surface->invalidRegion),
|
||||
&(meta1->regionRects[i]));
|
||||
&(surface->invalidRegion),
|
||||
&(meta1->regionRects[i]));
|
||||
}
|
||||
|
||||
for (i = 0; i < meta2->numRegionRects; i++)
|
||||
{
|
||||
region16_union_rect(&(surface->invalidRegion),
|
||||
&(surface->invalidRegion),
|
||||
&(meta2->regionRects[i]));
|
||||
&(surface->invalidRegion),
|
||||
&(meta2->regionRects[i]));
|
||||
}
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
|
@ -504,7 +479,7 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
gdiGfxSurface* surface;
|
||||
|
@ -514,16 +489,11 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_ALPHACODEC,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
WLog_DBG(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %d", status);
|
||||
|
||||
/* fill with green for now to distinguish from the rest */
|
||||
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
||||
cmd->left, cmd->top, cmd->width, cmd->height, 0x00FF00))
|
||||
cmd->left, cmd->top, cmd->width, cmd->height, 0x00FF00))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
invalidRect.left = cmd->left;
|
||||
|
@ -531,7 +501,7 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
invalidRect.right = cmd->right;
|
||||
invalidRect.bottom = cmd->bottom;
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
{
|
||||
|
@ -548,8 +518,8 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
INT32 rc;
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
|
@ -560,14 +530,9 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
|||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs,
|
||||
FREERDP_CODEC_PROGRESSIVE,
|
||||
surface->width, surface->height))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
rc = progressive_create_surface_context(surface->codecs->progressive,
|
||||
cmd->surfaceId,
|
||||
surface->width, surface->height);
|
||||
cmd->surfaceId,
|
||||
surface->width, surface->height);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
|
@ -576,9 +541,9 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
|||
}
|
||||
|
||||
rc = progressive_decompress(surface->codecs->progressive, cmd->data,
|
||||
cmd->length, surface->data, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->surfaceId);
|
||||
cmd->length, surface->data, surface->format,
|
||||
surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->surfaceId);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
|
@ -591,7 +556,7 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
|||
invalidRect.right = cmd->right;
|
||||
invalidRect.bottom = cmd->bottom;
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
{
|
||||
|
@ -608,7 +573,7 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceCommand(RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
|
@ -665,7 +630,7 @@ static UINT gdi_SurfaceCommand(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_DeleteEncodingContext(RdpgfxClientContext* context,
|
||||
const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext)
|
||||
const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
@ -676,7 +641,7 @@ static UINT gdi_DeleteEncodingContext(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_CreateSurface(RdpgfxClientContext* context,
|
||||
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
||||
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
|
||||
{
|
||||
gdiGfxSurface* surface;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
|
@ -693,8 +658,8 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
|
|||
return CHANNEL_RC_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (!freerdp_client_codecs_reset(surface->codecs, FREERDP_CODEC_ALL,
|
||||
createSurface->width, createSurface->height))
|
||||
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_ALL,
|
||||
createSurface->width, createSurface->height))
|
||||
{
|
||||
free(surface);
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -740,12 +705,12 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_DeleteSurface(RdpgfxClientContext* context,
|
||||
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
|
||||
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
|
||||
{
|
||||
rdpCodecs* codecs = NULL;
|
||||
gdiGfxSurface* surface = NULL;
|
||||
surface = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
deleteSurface->surfaceId);
|
||||
deleteSurface->surfaceId);
|
||||
|
||||
if (surface)
|
||||
{
|
||||
|
@ -759,7 +724,7 @@ static UINT gdi_DeleteSurface(RdpgfxClientContext* context,
|
|||
|
||||
if (codecs && codecs->progressive)
|
||||
progressive_delete_surface_context(codecs->progressive,
|
||||
deleteSurface->surfaceId);
|
||||
deleteSurface->surfaceId);
|
||||
|
||||
codecs_free(codecs);
|
||||
return CHANNEL_RC_OK;
|
||||
|
@ -771,7 +736,7 @@ static UINT gdi_DeleteSurface(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SolidFill(RdpgfxClientContext* context,
|
||||
const RDPGFX_SOLID_FILL_PDU* solidFill)
|
||||
const RDPGFX_SOLID_FILL_PDU* solidFill)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
UINT16 index;
|
||||
|
@ -783,7 +748,7 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
|
|||
RECTANGLE_16 invalidRect;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
surface = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
solidFill->surfaceId);
|
||||
solidFill->surfaceId);
|
||||
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -794,7 +759,7 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
|
|||
a = solidFill->fillPixel.XA;
|
||||
color = GetColor(PIXEL_FORMAT_ARGB32, r, g, b, a);
|
||||
color = ConvertColor(color, PIXEL_FORMAT_ARGB32, surface->format,
|
||||
&gdi->palette);
|
||||
&gdi->palette);
|
||||
|
||||
for (index = 0; index < solidFill->fillRectCount; index++)
|
||||
{
|
||||
|
@ -806,9 +771,9 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
|
|||
invalidRect.right = rect->right;
|
||||
invalidRect.bottom = rect->bottom;
|
||||
freerdp_image_fill(surface->data, surface->format, surface->scanline,
|
||||
rect->left, rect->top, nWidth, nHeight, color);
|
||||
rect->left, rect->top, nWidth, nHeight, color);
|
||||
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
}
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
|
@ -826,7 +791,7 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface)
|
||||
const RDPGFX_SURFACE_TO_SURFACE_PDU* surfaceToSurface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
UINT16 index;
|
||||
|
@ -840,13 +805,13 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
|
|||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
rectSrc = &(surfaceToSurface->rectSrc);
|
||||
surfaceSrc = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
surfaceToSurface->surfaceIdSrc);
|
||||
surfaceToSurface->surfaceIdSrc);
|
||||
sameSurface = (surfaceToSurface->surfaceIdSrc ==
|
||||
surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
|
||||
surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
|
||||
|
||||
if (!sameSurface)
|
||||
surfaceDst = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
surfaceToSurface->surfaceIdDest);
|
||||
surfaceToSurface->surfaceIdDest);
|
||||
else
|
||||
surfaceDst = surfaceSrc;
|
||||
|
||||
|
@ -860,17 +825,17 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
|
|||
{
|
||||
destPt = &surfaceToSurface->destPts[index];
|
||||
freerdp_image_copy(surfaceDst->data, surfaceDst->format,
|
||||
surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight,
|
||||
surfaceSrc->data, surfaceSrc->format,
|
||||
surfaceSrc->scanline,
|
||||
rectSrc->left, rectSrc->top, NULL);
|
||||
surfaceDst->scanline,
|
||||
destPt->x, destPt->y, nWidth, nHeight,
|
||||
surfaceSrc->data, surfaceSrc->format,
|
||||
surfaceSrc->scanline,
|
||||
rectSrc->left, rectSrc->top, NULL);
|
||||
invalidRect.left = destPt->x;
|
||||
invalidRect.top = destPt->y;
|
||||
invalidRect.right = destPt->x + rectSrc->right;
|
||||
invalidRect.bottom = destPt->y + rectSrc->bottom;
|
||||
region16_union_rect(&surfaceDst->invalidRegion, &surfaceDst->invalidRegion,
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
}
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
|
@ -888,14 +853,14 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
|
||||
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
|
||||
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
|
||||
{
|
||||
const RECTANGLE_16* rect;
|
||||
gdiGfxSurface* surface;
|
||||
gdiGfxCacheEntry* cacheEntry;
|
||||
rect = &(surfaceToCache->rectSrc);
|
||||
surface = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
surfaceToCache->surfaceId);
|
||||
surfaceToCache->surfaceId);
|
||||
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -918,10 +883,10 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
|
|||
}
|
||||
|
||||
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
|
||||
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
|
||||
surface->format, surface->scanline, rect->left, rect->top, NULL);
|
||||
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
|
||||
surface->format, surface->scanline, rect->left, rect->top, NULL);
|
||||
context->SetCacheSlotData(context, surfaceToCache->cacheSlot,
|
||||
(void*) cacheEntry);
|
||||
(void*) cacheEntry);
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
|
@ -931,7 +896,7 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
|
||||
const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface)
|
||||
const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface)
|
||||
{
|
||||
UINT status = CHANNEL_RC_OK;
|
||||
UINT16 index;
|
||||
|
@ -941,9 +906,9 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
|
|||
RECTANGLE_16 invalidRect;
|
||||
rdpGdi* gdi = (rdpGdi*) context->custom;
|
||||
surface = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
cacheToSurface->surfaceId);
|
||||
cacheToSurface->surfaceId);
|
||||
cacheEntry = (gdiGfxCacheEntry*) context->GetCacheSlotData(context,
|
||||
cacheToSurface->cacheSlot);
|
||||
cacheToSurface->cacheSlot);
|
||||
|
||||
if (!surface || !cacheEntry)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -952,14 +917,14 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
|
|||
{
|
||||
destPt = &cacheToSurface->destPts[index];
|
||||
freerdp_image_copy(surface->data, surface->format, surface->scanline,
|
||||
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
|
||||
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
|
||||
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
|
||||
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
|
||||
invalidRect.left = destPt->x;
|
||||
invalidRect.top = destPt->y;
|
||||
invalidRect.right = destPt->x + cacheEntry->width - 1;
|
||||
invalidRect.bottom = destPt->y + cacheEntry->height - 1;
|
||||
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion,
|
||||
&invalidRect);
|
||||
&invalidRect);
|
||||
}
|
||||
|
||||
if (!gdi->inGfxFrame)
|
||||
|
@ -977,7 +942,7 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_CacheImportReply(RdpgfxClientContext* context,
|
||||
const RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply)
|
||||
const RDPGFX_CACHE_IMPORT_REPLY_PDU* cacheImportReply)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
@ -988,11 +953,11 @@ static UINT gdi_CacheImportReply(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_EvictCacheEntry(RdpgfxClientContext* context,
|
||||
const RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry)
|
||||
const RDPGFX_EVICT_CACHE_ENTRY_PDU* evictCacheEntry)
|
||||
{
|
||||
gdiGfxCacheEntry* cacheEntry;
|
||||
cacheEntry = (gdiGfxCacheEntry*) context->GetCacheSlotData(context,
|
||||
evictCacheEntry->cacheSlot);
|
||||
evictCacheEntry->cacheSlot);
|
||||
|
||||
if (cacheEntry)
|
||||
{
|
||||
|
@ -1010,11 +975,11 @@ static UINT gdi_EvictCacheEntry(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_MapSurfaceToOutput(RdpgfxClientContext* context,
|
||||
const RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput)
|
||||
const RDPGFX_MAP_SURFACE_TO_OUTPUT_PDU* surfaceToOutput)
|
||||
{
|
||||
gdiGfxSurface* surface;
|
||||
surface = (gdiGfxSurface*) context->GetSurfaceData(context,
|
||||
surfaceToOutput->surfaceId);
|
||||
surfaceToOutput->surfaceId);
|
||||
|
||||
if (!surface)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
@ -1032,7 +997,7 @@ static UINT gdi_MapSurfaceToOutput(RdpgfxClientContext* context,
|
|||
* @return 0 on success, otherwise a Win32 error code
|
||||
*/
|
||||
static UINT gdi_MapSurfaceToWindow(RdpgfxClientContext* context,
|
||||
const RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow)
|
||||
const RDPGFX_MAP_SURFACE_TO_WINDOW_PDU* surfaceToWindow)
|
||||
{
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
|
|
@ -147,11 +147,6 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
{
|
||||
if (bpp < 32)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(context->codecs,
|
||||
FREERDP_CODEC_INTERLEAVED,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = interleaved_decompress(context->codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bpp,
|
||||
|
@ -161,11 +156,6 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(context->codecs,
|
||||
FREERDP_CODEC_PLANAR,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress(context->codecs->planar, pSrcData, SrcSize,
|
||||
pDstData, gdi->dstFormat, 0, 0, 0,
|
||||
width, height, TRUE);
|
||||
|
|
Loading…
Reference in New Issue