rdp: Stop using deprecated functions

The get file descriptor functions are being deprecated and a two step
process of getting handles and then getting the descriptors for the
handles is being used instead.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
dev
Derek Foreman 2 years ago
parent 5014eb03a3
commit 982e59a942
  1. 28
      libweston/backend-rdp/rdp.c

@ -606,18 +606,19 @@ static
int rdp_implant_listener(struct rdp_backend *b, freerdp_listener* instance) int rdp_implant_listener(struct rdp_backend *b, freerdp_listener* instance)
{ {
int i, fd; int i, fd;
int rcount = 0; int handle_count = 0;
void* rfds[MAX_FREERDP_FDS]; HANDLE handles[MAX_FREERDP_FDS];
struct wl_event_loop *loop; struct wl_event_loop *loop;
if (!instance->GetFileDescriptor(instance, rfds, &rcount)) { handle_count = instance->GetEventHandles(instance, handles, MAX_FREERDP_FDS);
weston_log("Failed to get FreeRDP file descriptor\n"); if (!handle_count) {
weston_log("Failed to get FreeRDP handles\n");
return -1; return -1;
} }
loop = wl_display_get_event_loop(b->compositor->wl_display); loop = wl_display_get_event_loop(b->compositor->wl_display);
for (i = 0; i < rcount; i++) { for (i = 0; i < handle_count; i++) {
fd = (int)(long)(rfds[i]); fd = GetEventFileDescriptor(handles[i]);
b->listener_events[i] = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE, b->listener_events[i] = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE,
rdp_listener_activity, instance); rdp_listener_activity, instance);
} }
@ -1472,8 +1473,8 @@ xf_suppress_output(rdpContext *context, BYTE allow, const RECTANGLE_16 *area)
static int static int
rdp_peer_init(freerdp_peer *client, struct rdp_backend *b) rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
{ {
int rcount = 0; int handle_count = 0;
void *rfds[MAX_FREERDP_FDS + 1]; /* +1 for WTSVirtualChannelManagerGetFileDescriptor. */ HANDLE handles[MAX_FREERDP_FDS + 1]; /* +1 for virtual channel */
int i, fd; int i, fd;
struct wl_event_loop *loop; struct wl_event_loop *loop;
rdpSettings *settings; rdpSettings *settings;
@ -1530,8 +1531,9 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
input->KeyboardEvent = xf_input_keyboard_event; input->KeyboardEvent = xf_input_keyboard_event;
input->UnicodeKeyboardEvent = xf_input_unicode_keyboard_event; input->UnicodeKeyboardEvent = xf_input_unicode_keyboard_event;
if (!client->GetFileDescriptor(client, rfds, &rcount)) { handle_count = client->GetEventHandles(client, handles, MAX_FREERDP_FDS);
weston_log("unable to retrieve client fds\n"); if (!handle_count) {
weston_log("unable to retrieve client handles\n");
goto error_initialize; goto error_initialize;
} }
@ -1539,14 +1541,14 @@ rdp_peer_init(freerdp_peer *client, struct rdp_backend *b)
WTSRegisterWtsApiFunctionTable(fn); WTSRegisterWtsApiFunctionTable(fn);
peerCtx->vcm = WTSOpenServerA((LPSTR)peerCtx); peerCtx->vcm = WTSOpenServerA((LPSTR)peerCtx);
if (peerCtx->vcm) { if (peerCtx->vcm) {
WTSVirtualChannelManagerGetFileDescriptor(peerCtx->vcm, rfds, &rcount); handles[handle_count++] = WTSVirtualChannelManagerGetEventHandle(peerCtx->vcm);
} else { } else {
weston_log("WTSOpenServer is failed! continue without virtual channel.\n"); weston_log("WTSOpenServer is failed! continue without virtual channel.\n");
} }
loop = wl_display_get_event_loop(b->compositor->wl_display); loop = wl_display_get_event_loop(b->compositor->wl_display);
for (i = 0; i < rcount; i++) { for (i = 0; i < handle_count; i++) {
fd = (int)(long)(rfds[i]); fd = GetEventFileDescriptor(handles[i]);
peerCtx->events[i] = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE, peerCtx->events[i] = wl_event_loop_add_fd(loop, fd, WL_EVENT_READABLE,
rdp_client_activity, client); rdp_client_activity, client);

Loading…
Cancel
Save