xfreerdp: partially migrate RAIL to callback interface

This commit is contained in:
Marc-André Moreau 2014-11-11 17:49:29 -05:00
parent b2f7c488ab
commit f3d1830eb4
4 changed files with 364 additions and 319 deletions

View File

@ -1099,30 +1099,6 @@ int xf_logon_error_info(freerdp *instance, UINT32 data, UINT32 type)
return 1; return 1;
} }
void xf_process_channel_event(rdpChannels* channels, freerdp* instance)
{
xfContext* xfc;
wMessage* event;
xfc = (xfContext*) instance->context;
event = freerdp_channels_pop_event(channels);
if (event)
{
switch(GetMessageClass(event->id))
{
case RailChannel_Class:
xf_process_rail_event(xfc, channels, event);
break;
default:
break;
}
freerdp_event_free(event);
}
}
void xf_window_free(xfContext *xfc) void xf_window_free(xfContext *xfc)
{ {
rdpContext* context = (rdpContext*) xfc; rdpContext* context = (rdpContext*) xfc;
@ -1261,8 +1237,6 @@ void* xf_channels_thread(void *arg)
if (!status) if (!status)
break; break;
xf_process_channel_event(channels, instance);
} }
ExitThread(0); ExitThread(0);
@ -1395,27 +1369,30 @@ void* xf_thread(void *param)
xf_keyboard_focus_in(xfc); xf_keyboard_focus_in(xfc);
xf_keyboard_focus_in(xfc); xf_keyboard_focus_in(xfc);
} }
if (!async_transport) if (!async_transport)
{ {
if(freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) if (!freerdp_get_fds(instance, rfds, &rcount, wfds, &wcount))
{ {
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor"); WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
exit_code = XF_EXIT_CONN_FAILED; exit_code = XF_EXIT_CONN_FAILED;
break; break;
} }
} }
if (!async_channels) if (!async_channels)
{ {
if(freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount) != TRUE) if (!freerdp_channels_get_fds(channels, instance, rfds, &rcount, wfds, &wcount))
{ {
WLog_ERR(TAG, "Failed to get channel manager file descriptor"); WLog_ERR(TAG, "Failed to get channel manager file descriptor");
exit_code = XF_EXIT_CONN_FAILED; exit_code = XF_EXIT_CONN_FAILED;
break; break;
} }
} }
if (!async_input) if (!async_input)
{ {
if(xf_get_fds(instance, rfds, &rcount, wfds, &wcount) != TRUE) if (!xf_get_fds(instance, rfds, &rcount, wfds, &wcount))
{ {
WLog_ERR(TAG, "Failed to get xfreerdp file descriptor"); WLog_ERR(TAG, "Failed to get xfreerdp file descriptor");
exit_code = XF_EXIT_CONN_FAILED; exit_code = XF_EXIT_CONN_FAILED;
@ -1428,27 +1405,33 @@ void* xf_thread(void *param)
fd_input_event = GetEventFileDescriptor(input_event); fd_input_event = GetEventFileDescriptor(input_event);
rfds[rcount++] = (void *)(long) fd_input_event; rfds[rcount++] = (void *)(long) fd_input_event;
} }
max_fds = 0; max_fds = 0;
FD_ZERO(&rfds_set); FD_ZERO(&rfds_set);
FD_ZERO(&wfds_set); FD_ZERO(&wfds_set);
for (i = 0; i < rcount; i++) for (i = 0; i < rcount; i++)
{ {
fds = (int)(long)(rfds[i]); fds = (int)(long)(rfds[i]);
if (fds > max_fds) if (fds > max_fds)
max_fds = fds; max_fds = fds;
FD_SET(fds, &rfds_set); FD_SET(fds, &rfds_set);
} }
if (max_fds == 0) if (max_fds == 0)
break; break;
timeout.tv_sec = 1; timeout.tv_sec = 1;
timeout.tv_usec = 0; timeout.tv_usec = 0;
select_status = select(max_fds + 1, &rfds_set, NULL, NULL, &timeout); select_status = select(max_fds + 1, &rfds_set, NULL, NULL, &timeout);
if (select_status == 0) if (select_status == 0)
{ {
continue; /* select timeout */ continue; /* select timeout */
} }
else else if (select_status == -1)
if(select_status == -1)
{ {
/* these are not really errors */ /* these are not really errors */
if (!((errno == EAGAIN) || (errno == EWOULDBLOCK) || if (!((errno == EAGAIN) || (errno == EWOULDBLOCK) ||
@ -1458,28 +1441,31 @@ void* xf_thread(void *param)
break; break;
} }
} }
if (!async_transport) if (!async_transport)
{ {
if(freerdp_check_fds(instance) != TRUE) if (!freerdp_check_fds(instance))
{ {
if (xf_auto_reconnect(instance)) if (xf_auto_reconnect(instance))
continue; continue;
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor"); WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
break; break;
} }
} }
if (!async_channels) if (!async_channels)
{ {
if(freerdp_channels_check_fds(channels, instance) != TRUE) if (!freerdp_channels_check_fds(channels, instance))
{ {
WLog_ERR(TAG, "Failed to check channel manager file descriptor"); WLog_ERR(TAG, "Failed to check channel manager file descriptor");
break; break;
} }
xf_process_channel_event(channels, instance);
} }
if (!async_input) if (!async_input)
{ {
if(xf_process_x_events(instance) != TRUE) if (!xf_process_x_events(instance))
{ {
WLog_INFO(TAG, "Closed from X11"); WLog_INFO(TAG, "Closed from X11");
break; break;
@ -1509,16 +1495,20 @@ void* xf_thread(void *param)
WaitForSingleObject(input_thread, INFINITE); WaitForSingleObject(input_thread, INFINITE);
CloseHandle(input_thread); CloseHandle(input_thread);
} }
if (async_channels) if (async_channels)
{ {
WaitForSingleObject(channels_thread, INFINITE); WaitForSingleObject(channels_thread, INFINITE);
CloseHandle(channels_thread); CloseHandle(channels_thread);
} }
if (!exit_code) if (!exit_code)
exit_code = freerdp_error_info(instance); exit_code = freerdp_error_info(instance);
freerdp_channels_free(channels); freerdp_channels_free(channels);
freerdp_disconnect(instance); freerdp_disconnect(instance);
gdi_free(instance); gdi_free(instance);
ExitThread(exit_code); ExitThread(exit_code);
return NULL; return NULL;
} }

View File

@ -36,12 +36,6 @@
#define TAG CLIENT_TAG("x11") #define TAG CLIENT_TAG("x11")
#ifdef WITH_DEBUG_X11_LOCAL_MOVESIZE
#define DEBUG_X11_LMS(fmt, ...) WLog_DBG(TAG, fmt, ## __VA_ARGS__)
#else
#define DEBUG_X11_LMS(fmt, ...) do { } while (0)
#endif
const char* error_code_names[] = const char* error_code_names[] =
{ {
"RAIL_EXEC_S_OK", "RAIL_EXEC_S_OK",
@ -185,8 +179,7 @@ static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
return; return;
} }
xf_MoveWindow(xfc, xfw, xf_MoveWindow(xfc, xfw, window->visibleOffsetX, window->visibleOffsetY,
window->visibleOffsetX, window->visibleOffsetY,
window->windowWidth, window->windowHeight); window->windowWidth, window->windowHeight);
} }
@ -362,14 +355,6 @@ void xf_rail_adjust_position(xfContext* xfc, rdpWindow* window)
window_move.right = window_move.left + xfw->width; window_move.right = window_move.left + xfw->width;
window_move.bottom = window_move.top + xfw->height; window_move.bottom = window_move.top + xfw->height;
DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%u h=%u"
" RDP=0x%X rc={l=%d t=%d} w=%d h=%d",
(UINT32) xfw->handle, window_move.left, window_move.top,
window_move.right, window_move.bottom, xfw->width, xfw->height,
window->windowId,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight);
xf_send_rail_client_event(channels, RailChannel_ClientWindowMove, &window_move); xf_send_rail_client_event(channels, RailChannel_ClientWindowMove, &window_move);
} }
} }
@ -389,10 +374,6 @@ void xf_rail_end_local_move(xfContext* xfc, rdpWindow* window)
xfw = (xfWindow*) window->extra; xfw = (xfWindow*) window->extra;
channels = ((rdpContext*) xfc)->channels; channels = ((rdpContext*) xfc)->channels;
DEBUG_X11_LMS("window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d",
(UINT32) xfw->handle,
xfw->left, xfw->top, xfw->right, xfw->bottom,
xfw->width, xfw->height);
/* /*
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY, * Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when * we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
@ -433,7 +414,6 @@ void xf_rail_end_local_move(xfContext* xfc, rdpWindow* window)
(xfw->local_move.direction != _NET_WM_MOVERESIZE_SIZE_KEYBOARD)) (xfw->local_move.direction != _NET_WM_MOVERESIZE_SIZE_KEYBOARD))
{ {
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y); input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
DEBUG_X11_LMS("Mouse coordinates. x= %i, y= %i", x, y);
} }
/* /*
@ -448,236 +428,285 @@ void xf_rail_end_local_move(xfContext* xfc, rdpWindow* window)
xfw->local_move.state = LMS_TERMINATING; xfw->local_move.state = LMS_TERMINATING;
} }
void xf_process_rail_get_sysparams_event(xfContext* xfc, rdpChannels* channels, wMessage* event) void xf_rail_invalidate_region(xfContext* xfc, REGION16* invalidRegion)
{ {
RAIL_SYSPARAM_ORDER* sysparam; int index;
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam; int count;
sysparam->workArea.left = xfc->workArea.x; RECTANGLE_16 updateRect;
sysparam->workArea.top = xfc->workArea.y; RECTANGLE_16 windowRect;
sysparam->workArea.right = xfc->workArea.x + xfc->workArea.width; ULONG_PTR* pKeys = NULL;
sysparam->workArea.bottom = xfc->workArea.y + xfc->workArea.height; xfRailWindow* railWindow;
sysparam->taskbarPos.left = 0; const RECTANGLE_16* extents;
sysparam->taskbarPos.top = 0; REGION16 windowInvalidRegion;
sysparam->taskbarPos.right = 0;
sysparam->taskbarPos.bottom = 0; region16_init(&windowInvalidRegion);
sysparam->dragFullWindows = FALSE;
xf_send_rail_client_event(channels, RailChannel_ClientSystemParam, sysparam); count = HashTable_GetKeys(xfc->railWindows, &pKeys);
for (index = 0; index < count; index++)
{
railWindow = (xfRailWindow*) HashTable_GetItemValue(xfc->railWindows, (void*) pKeys[index]);
if (railWindow)
{
windowRect.left = railWindow->x;
windowRect.top = railWindow->y;
windowRect.right = railWindow->x + railWindow->width;
windowRect.bottom = railWindow->y + railWindow->height;
region16_clear(&windowInvalidRegion);
region16_intersect_rect(&windowInvalidRegion, invalidRegion, &windowRect);
if (!region16_is_empty(&windowInvalidRegion))
{
extents = region16_extents(&windowInvalidRegion);
updateRect.left = extents->left - railWindow->x;
updateRect.top = extents->top - railWindow->y;
updateRect.right = extents->right - railWindow->x;
updateRect.bottom = extents->bottom - railWindow->y;
//InvalidateRect(railWindow->hWnd, &updateRect, FALSE);
}
}
} }
void xf_process_rail_exec_result_event(xfContext* xfc, rdpChannels* channels, wMessage* event) region16_uninit(&windowInvalidRegion);
{ }
RAIL_EXEC_RESULT_ORDER* exec_result;
exec_result = (RAIL_EXEC_RESULT_ORDER*) event->wParam;
if (exec_result->execResult != RAIL_EXEC_S_OK) /* RemoteApp Virtual Channel Extension */
static int xf_rail_server_execute_result(RailClientContext* context, RAIL_EXEC_RESULT_ORDER* execResult)
{
xfContext* xfc = (xfContext*) context->custom;
if (execResult->execResult != RAIL_EXEC_S_OK)
{ {
WLog_ERR(TAG, "RAIL exec error: execResult=%s NtError=0x%X\n", WLog_ERR(TAG, "RAIL exec error: execResult=%s NtError=0x%X\n",
error_code_names[exec_result->execResult], exec_result->rawResult); error_code_names[execResult->execResult], execResult->rawResult);
xfc->disconnect = True; xfc->disconnect = TRUE;
} }
else else
{ {
xf_rail_enable_remoteapp_mode(xfc); xf_rail_enable_remoteapp_mode(xfc);
} }
return 1;
} }
void xf_process_rail_server_sysparam_event(xfContext* xfc, rdpChannels* channels, wMessage* event) static int xf_rail_server_system_param(RailClientContext* context, RAIL_SYSPARAM_ORDER* sysparam)
{ {
RAIL_SYSPARAM_ORDER* sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam; return 1;
}
switch (sysparam->param) static int xf_rail_server_handshake(RailClientContext* context, RAIL_HANDSHAKE_ORDER* handshake)
{ {
case SPI_SET_SCREEN_SAVE_ACTIVE: RAIL_EXEC_ORDER exec;
break; RAIL_SYSPARAM_ORDER sysparam;
RAIL_HANDSHAKE_ORDER clientHandshake;
RAIL_CLIENT_STATUS_ORDER clientStatus;
xfContext* xfc = (xfContext*) context->custom;
rdpSettings* settings = xfc->settings;
case SPI_SET_SCREEN_SAVE_SECURE: clientHandshake.buildNumber = 0x00001DB0;
break; context->ClientHandshake(context, &clientHandshake);
}
ZeroMemory(&clientStatus, sizeof(RAIL_CLIENT_STATUS_ORDER));
clientStatus.flags = RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
context->ClientInformation(context, &clientStatus);
if (settings->RemoteAppLanguageBarSupported)
{
RAIL_LANGBAR_INFO_ORDER langBarInfo;
langBarInfo.languageBarStatus = 0x00000008; /* TF_SFT_HIDDEN */
context->ClientLanguageBarInfo(context, &langBarInfo);
} }
void xf_process_rail_server_minmaxinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event) ZeroMemory(&sysparam, sizeof(RAIL_SYSPARAM_ORDER));
sysparam.params = 0;
sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
sysparam.highContrast.colorScheme.string = NULL;
sysparam.highContrast.colorScheme.length = 0;
sysparam.highContrast.flags = 0x7E;
sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
sysparam.mouseButtonSwap = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
sysparam.keyboardPref = FALSE;
sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
sysparam.dragFullWindows = FALSE;
sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
sysparam.keyboardCues = FALSE;
sysparam.params |= SPI_MASK_SET_WORK_AREA;
sysparam.workArea.left = 0;
sysparam.workArea.top = 0;
sysparam.workArea.right = settings->DesktopWidth;
sysparam.workArea.bottom = settings->DesktopHeight;
sysparam.dragFullWindows = FALSE;
context->ClientSystemParam(context, &sysparam);
ZeroMemory(&exec, sizeof(RAIL_EXEC_ORDER));
exec.RemoteApplicationProgram = settings->RemoteApplicationProgram;
exec.RemoteApplicationWorkingDir = settings->ShellWorkingDirectory;
exec.RemoteApplicationArguments = settings->RemoteApplicationCmdLine;
context->ClientExecute(context, &exec);
return 1;
}
static int xf_rail_server_handshake_ex(RailClientContext* context, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
{
return 1;
}
static int xf_rail_server_local_move_size(RailClientContext* context, RAIL_LOCALMOVESIZE_ORDER* localMoveSize)
{ {
rdpRail* rail; rdpRail* rail;
rdpWindow* rail_window = NULL; xfWindow* window;
RAIL_MINMAXINFO_ORDER* minmax = (RAIL_MINMAXINFO_ORDER*) event->wParam;
rail = ((rdpContext*) xfc)->rail;
rail_window = window_list_get_by_id(rail->list, minmax->windowId);
if (rail_window)
{
xfWindow* window = NULL;
window = (xfWindow*) rail_window->extra;
DEBUG_X11_LMS("windowId=0x%X maxWidth=%d maxHeight=%d maxPosX=%d maxPosY=%d "
"minTrackWidth=%d minTrackHeight=%d maxTrackWidth=%d maxTrackHeight=%d",
minmax->windowId, minmax->maxWidth, minmax->maxHeight,
(INT16)minmax->maxPosX, (INT16)minmax->maxPosY,
minmax->minTrackWidth, minmax->minTrackHeight,
minmax->maxTrackWidth, minmax->maxTrackHeight);
xf_SetWindowMinMaxInfo(xfc, window, minmax->maxWidth, minmax->maxHeight, minmax->maxPosX, minmax->maxPosY,
minmax->minTrackWidth, minmax->minTrackHeight, minmax->maxTrackWidth, minmax->maxTrackHeight);
}
}
void xf_process_rail_server_localmovesize_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
int x = 0, y = 0; int x = 0, y = 0;
rdpRail* rail;
int direction = 0; int direction = 0;
Window child_window; Window child_window;
rdpWindow* rail_window = NULL; rdpWindow* rail_window;
RAIL_LOCALMOVESIZE_ORDER* movesize = (RAIL_LOCALMOVESIZE_ORDER*) event->wParam; xfContext* xfc = (xfContext*) context->custom;
rail = ((rdpContext*) xfc)->rail; rail = ((rdpContext*) xfc)->rail;
rail_window = window_list_get_by_id(rail->list, movesize->windowId);
if (rail_window) rail_window = window_list_get_by_id(rail->list, localMoveSize->windowId);
{
xfWindow* xfw = NULL;
xfw = (xfWindow*) rail_window->extra;
DEBUG_X11_LMS("windowId=0x%X isMoveSizeStart=%d moveSizeType=%s PosX=%d PosY=%d", if (!rail_window)
movesize->windowId, movesize->isMoveSizeStart, return -1;
movetype_names[movesize->moveSizeType], (INT16) movesize->posX, (INT16) movesize->posY);
switch (movesize->moveSizeType) window = (xfWindow*) rail_window->extra;
switch (localMoveSize->moveSizeType)
{ {
case RAIL_WMSZ_LEFT: case RAIL_WMSZ_LEFT:
direction = _NET_WM_MOVERESIZE_SIZE_LEFT; direction = _NET_WM_MOVERESIZE_SIZE_LEFT;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_RIGHT: case RAIL_WMSZ_RIGHT:
direction = _NET_WM_MOVERESIZE_SIZE_RIGHT; direction = _NET_WM_MOVERESIZE_SIZE_RIGHT;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_TOP: case RAIL_WMSZ_TOP:
direction = _NET_WM_MOVERESIZE_SIZE_TOP; direction = _NET_WM_MOVERESIZE_SIZE_TOP;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_TOPLEFT: case RAIL_WMSZ_TOPLEFT:
direction = _NET_WM_MOVERESIZE_SIZE_TOPLEFT; direction = _NET_WM_MOVERESIZE_SIZE_TOPLEFT;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_TOPRIGHT: case RAIL_WMSZ_TOPRIGHT:
direction = _NET_WM_MOVERESIZE_SIZE_TOPRIGHT; direction = _NET_WM_MOVERESIZE_SIZE_TOPRIGHT;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_BOTTOM: case RAIL_WMSZ_BOTTOM:
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOM; direction = _NET_WM_MOVERESIZE_SIZE_BOTTOM;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_BOTTOMLEFT: case RAIL_WMSZ_BOTTOMLEFT:
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT; direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_BOTTOMRIGHT: case RAIL_WMSZ_BOTTOMRIGHT:
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT; direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
break; break;
case RAIL_WMSZ_MOVE: case RAIL_WMSZ_MOVE:
direction = _NET_WM_MOVERESIZE_MOVE; direction = _NET_WM_MOVERESIZE_MOVE;
XTranslateCoordinates(xfc->display, xfw->handle, XTranslateCoordinates(xfc->display, window->handle,
RootWindowOfScreen(xfc->screen), RootWindowOfScreen(xfc->screen),
movesize->posX, movesize->posY, &x, &y, &child_window); localMoveSize->posX, localMoveSize->posY, &x, &y, &child_window);
break; break;
case RAIL_WMSZ_KEYMOVE: case RAIL_WMSZ_KEYMOVE:
direction = _NET_WM_MOVERESIZE_MOVE_KEYBOARD; direction = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
/* FIXME: local keyboard moves not working */ /* FIXME: local keyboard moves not working */
return; return 1;
break;
case RAIL_WMSZ_KEYSIZE: case RAIL_WMSZ_KEYSIZE:
direction = _NET_WM_MOVERESIZE_SIZE_KEYBOARD; direction = _NET_WM_MOVERESIZE_SIZE_KEYBOARD;
x = movesize->posX; x = localMoveSize->posX;
y = movesize->posY; y = localMoveSize->posY;
/* FIXME: local keyboard moves not working */ /* FIXME: local keyboard moves not working */
return; return 1;
break;
} }
if (movesize->isMoveSizeStart) if (localMoveSize->isMoveSizeStart)
{ {
xf_StartLocalMoveSize(xfc, xfw, direction, x, y); xf_StartLocalMoveSize(xfc, window, direction, x, y);
} }
else else
{ {
xf_EndLocalMoveSize(xfc, xfw); xf_EndLocalMoveSize(xfc, window);
}
}
} }
void xf_process_rail_appid_resp_event(xfContext* xfc, rdpChannels* channels, wMessage* event) return 1;
}
static int xf_rail_server_min_max_info(RailClientContext* context, RAIL_MINMAXINFO_ORDER* minMaxInfo)
{ {
RAIL_GET_APPID_RESP_ORDER* appid_resp = rdpRail* rail;
(RAIL_GET_APPID_RESP_ORDER*) event->wParam; xfWindow* window;
rdpWindow* rail_window;
xfContext* xfc = (xfContext*) context->custom;
WLog_ERR(TAG, "Server Application ID Response PDU: windowId=0x%X " rail = ((rdpContext*) xfc)->rail;
"applicationId=(length=%d dump)\n",
appid_resp->windowId, 512);
winpr_HexDump(TAG, WLOG_ERROR, (BYTE*) &appid_resp->applicationId, 512); rail_window = window_list_get_by_id(rail->list, minMaxInfo->windowId);
if (!rail_window)
return -1;
window = (xfWindow*) rail_window->extra;
xf_SetWindowMinMaxInfo(xfc, window,
minMaxInfo->maxWidth, minMaxInfo->maxHeight,
minMaxInfo->maxPosX, minMaxInfo->maxPosY,
minMaxInfo->minTrackWidth, minMaxInfo->minTrackHeight,
minMaxInfo->maxTrackWidth, minMaxInfo->maxTrackHeight);
return 1;
} }
void xf_process_rail_langbarinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event) static int xf_rail_server_language_bar_info(RailClientContext* context, RAIL_LANGBAR_INFO_ORDER* langBarInfo)
{ {
RAIL_LANGBAR_INFO_ORDER* langbar = (RAIL_LANGBAR_INFO_ORDER*) event->wParam; return 1;
WLog_ERR(TAG, "Language Bar Information PDU: languageBarStatus=0x%X\n",
langbar->languageBarStatus);
} }
void xf_process_rail_event(xfContext* xfc, rdpChannels* channels, wMessage* event) static int xf_rail_server_get_appid_response(RailClientContext* context, RAIL_GET_APPID_RESP_ORDER* getAppIdResp)
{ {
switch (GetMessageType(event->id)) return 1;
{
case RailChannel_GetSystemParam:
xf_process_rail_get_sysparams_event(xfc, channels, event);
break;
case RailChannel_ServerExecuteResult:
xf_process_rail_exec_result_event(xfc, channels, event);
break;
case RailChannel_ServerSystemParam:
xf_process_rail_server_sysparam_event(xfc, channels, event);
break;
case RailChannel_ServerMinMaxInfo:
xf_process_rail_server_minmaxinfo_event(xfc, channels, event);
break;
case RailChannel_ServerLocalMoveSize:
xf_process_rail_server_localmovesize_event(xfc, channels, event);
break;
case RailChannel_ServerGetAppIdResponse:
xf_process_rail_appid_resp_event(xfc, channels, event);
break;
case RailChannel_ServerLanguageBarInfo:
xf_process_rail_langbarinfo_event(xfc, channels, event);
break;
default:
break;
}
} }
int xf_rail_init(xfContext* xfc, RailClientContext* rail) int xf_rail_init(xfContext* xfc, RailClientContext* rail)
@ -691,9 +720,18 @@ int xf_rail_init(xfContext* xfc, RailClientContext* rail)
xf_rail_register_callbacks(xfc, context->rail); xf_rail_register_callbacks(xfc, context->rail);
if (0) if (1)
{ {
rail->custom = (void*) xfc; rail->custom = (void*) xfc;
rail->ServerExecuteResult = xf_rail_server_execute_result;
rail->ServerSystemParam = xf_rail_server_system_param;
rail->ServerHandshake = xf_rail_server_handshake;
rail->ServerHandshakeEx = xf_rail_server_handshake_ex;
rail->ServerLocalMoveSize = xf_rail_server_local_move_size;
rail->ServerMinMaxInfo = xf_rail_server_min_max_info;
rail->ServerLanguageBarInfo = xf_rail_server_language_bar_info;
rail->ServerGetAppIdResponse = xf_rail_server_get_appid_response;
} }
return 1; return 1;

View File

@ -23,6 +23,23 @@
#include "xf_client.h" #include "xf_client.h"
#include "xfreerdp.h" #include "xfreerdp.h"
struct xf_rail_window
{
xfContext* wfc;
HWND hWnd;
DWORD dwStyle;
DWORD dwExStyle;
int x;
int y;
int width;
int height;
char* title;
};
typedef struct xf_rail_window xfRailWindow;
#include <freerdp/client/rail.h> #include <freerdp/client/rail.h>
void xf_rail_paint(xfContext* xfc, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom); void xf_rail_paint(xfContext* xfc, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom);
@ -33,8 +50,6 @@ void xf_rail_end_local_move(xfContext* xfc, rdpWindow* window);
void xf_rail_enable_remoteapp_mode(xfContext* xfc); void xf_rail_enable_remoteapp_mode(xfContext* xfc);
void xf_rail_disable_remoteapp_mode(xfContext* xfc); void xf_rail_disable_remoteapp_mode(xfContext* xfc);
void xf_process_rail_event(xfContext* xfc, rdpChannels* channels, wMessage* event);
int xf_rail_init(xfContext* xfc, RailClientContext* rail); int xf_rail_init(xfContext* xfc, RailClientContext* rail);
int xf_rail_uninit(xfContext* xfc, RailClientContext* rail); int xf_rail_uninit(xfContext* xfc, RailClientContext* rail);

View File

@ -190,7 +190,9 @@ struct xf_context
RdpeiClientContext* rdpei; RdpeiClientContext* rdpei;
RdpgfxClientContext* gfx; RdpgfxClientContext* gfx;
EncomspClientContext* encomsp; EncomspClientContext* encomsp;
RailClientContext* rail; RailClientContext* rail;
wHashTable* railWindows;
BOOL xkbAvailable; BOOL xkbAvailable;
}; };