Merge git://github.com/awakecoding/FreeRDP

Merging Marc-André's latest changes
This commit is contained in:
Benoît LeBlanc 2013-06-13 10:28:32 -04:00
commit dc3ca67b2b
23 changed files with 1439 additions and 1469 deletions

View File

@ -34,28 +34,28 @@
int main(int argc, char* argv[])
{
xfInfo* xfi;
xfContext* xfc;
DWORD dwExitCode;
freerdp* instance;
freerdp_client_global_init();
xfi = freerdp_client_new(argc, argv);
xfc = freerdp_client_new(argc, argv);
if (xfi == NULL)
if (xfc == NULL)
{
return 1;
}
instance = xfi->instance;
instance = xfc->instance;
freerdp_client_start(xfi);
freerdp_client_start(xfc);
WaitForSingleObject(xfi->thread, INFINITE);
WaitForSingleObject(xfc->thread, INFINITE);
GetExitCodeThread(xfi->thread, &dwExitCode);
GetExitCodeThread(xfc->thread, &dwExitCode);
freerdp_client_free(xfi);
freerdp_client_free(xfc);
freerdp_client_global_uninit();

View File

@ -28,11 +28,11 @@
int xf_on_channel_connected(freerdp* instance, const char* name, void* pInterface)
{
xfInfo* xfi = ((xfContext*) instance->context)->xfi;
xfContext* xfc = (xfContext*) instance->context;
if (strcmp(name, RDPEI_DVC_CHANNEL_NAME) == 0)
{
xfi->rdpei = (RdpeiClientContext*) pInterface;
xfc->rdpei = (RdpeiClientContext*) pInterface;
}
return 0;

View File

@ -90,7 +90,7 @@ struct clipboard_context
int incr_data_length;
};
void xf_cliprdr_init(xfInfo* xfi, rdpChannels* channels)
void xf_cliprdr_init(xfContext* xfc, rdpChannels* channels)
{
int n;
UINT32 id;
@ -99,13 +99,13 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* channels)
cb = (clipboardContext*) malloc(sizeof(clipboardContext));
ZeroMemory(cb, sizeof(clipboardContext));
xfi->clipboard_context = cb;
xfc->clipboard_context = cb;
cb->channels = channels;
cb->request_index = -1;
cb->root_window = DefaultRootWindow(xfi->display);
cb->clipboard_atom = XInternAtom(xfi->display, "CLIPBOARD", FALSE);
cb->root_window = DefaultRootWindow(xfc->display);
cb->clipboard_atom = XInternAtom(xfc->display, "CLIPBOARD", FALSE);
if (cb->clipboard_atom == None)
{
@ -113,20 +113,20 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* channels)
}
id = 1;
cb->property_atom = XInternAtom(xfi->display, "_FREERDP_CLIPRDR", FALSE);
cb->identity_atom = XInternAtom(xfi->display, "_FREERDP_CLIPRDR_ID", FALSE);
cb->property_atom = XInternAtom(xfc->display, "_FREERDP_CLIPRDR", FALSE);
cb->identity_atom = XInternAtom(xfc->display, "_FREERDP_CLIPRDR_ID", FALSE);
XChangeProperty(xfi->display, xfi->drawable, cb->identity_atom,
XChangeProperty(xfc->display, xfc->drawable, cb->identity_atom,
XA_INTEGER, 32, PropModeReplace, (BYTE*) &id, 1);
XSelectInput(xfi->display, cb->root_window, PropertyChangeMask);
XSelectInput(xfc->display, cb->root_window, PropertyChangeMask);
n = 0;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "_FREERDP_RAW", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "_FREERDP_RAW", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_RAW;
n++;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "UTF8_STRING", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "UTF8_STRING", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_UNICODETEXT;
n++;
@ -134,36 +134,36 @@ void xf_cliprdr_init(xfInfo* xfi, rdpChannels* channels)
cb->format_mappings[n].format_id = CB_FORMAT_TEXT;
n++;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/png", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "image/png", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_PNG;
n++;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/jpeg", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "image/jpeg", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_JPEG;
n++;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/gif", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "image/gif", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_GIF;
n++;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "image/bmp", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "image/bmp", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_DIB;
n++;
cb->format_mappings[n].target_format = XInternAtom(xfi->display, "text/html", FALSE);
cb->format_mappings[n].target_format = XInternAtom(xfc->display, "text/html", FALSE);
cb->format_mappings[n].format_id = CB_FORMAT_HTML;
cb->num_format_mappings = n + 1;
cb->targets[0] = XInternAtom(xfi->display, "TIMESTAMP", FALSE);
cb->targets[1] = XInternAtom(xfi->display, "TARGETS", FALSE);
cb->targets[0] = XInternAtom(xfc->display, "TIMESTAMP", FALSE);
cb->targets[1] = XInternAtom(xfc->display, "TARGETS", FALSE);
cb->num_targets = 2;
cb->incr_atom = XInternAtom(xfi->display, "INCR", FALSE);
cb->incr_atom = XInternAtom(xfc->display, "INCR", FALSE);
}
void xf_cliprdr_uninit(xfInfo* xfi)
void xf_cliprdr_uninit(xfContext* xfc)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (cb)
{
@ -172,7 +172,7 @@ void xf_cliprdr_uninit(xfInfo* xfi)
free(cb->respond);
free(cb->incr_data);
free(cb);
xfi->clipboard_context = NULL;
xfc->clipboard_context = NULL;
}
}
@ -250,20 +250,20 @@ static void be2le(BYTE* data, int size)
}
}
static BOOL xf_cliprdr_is_self_owned(xfInfo* xfi)
static BOOL xf_cliprdr_is_self_owned(xfContext* xfc)
{
Atom type;
UINT32 id = 0;
UINT32* pid = NULL;
int format, result = 0;
unsigned long length, bytes_left;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
cb->owner = XGetSelectionOwner(xfi->display, cb->clipboard_atom);
cb->owner = XGetSelectionOwner(xfc->display, cb->clipboard_atom);
if (cb->owner != None)
{
result = XGetWindowProperty(xfi->display, cb->owner,
result = XGetWindowProperty(xfc->display, cb->owner,
cb->identity_atom, 0, 4, 0, XA_INTEGER,
&type, &format, &length, &bytes_left, (BYTE**) &pid);
}
@ -274,7 +274,7 @@ static BOOL xf_cliprdr_is_self_owned(xfInfo* xfi)
XFree(pid);
}
if ((cb->owner == None) || (cb->owner == xfi->drawable))
if ((cb->owner == None) || (cb->owner == xfc->drawable))
return FALSE;
if (result != Success)
@ -322,16 +322,16 @@ static int xf_cliprdr_select_format_by_atom(clipboardContext* cb, Atom target)
return -1;
}
static void xf_cliprdr_send_raw_format_list(xfInfo* xfi)
static void xf_cliprdr_send_raw_format_list(xfContext* xfc)
{
Atom type;
BYTE* format_data;
int format, result;
unsigned long length, bytes_left;
RDP_CB_FORMAT_LIST_EVENT* event;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
result = XGetWindowProperty(xfi->display, cb->root_window,
result = XGetWindowProperty(xfc->display, cb->root_window,
cb->property_atom, 0, 3600, 0, XA_STRING,
&type, &format, &length, &bytes_left, (BYTE**) &format_data);
@ -353,10 +353,10 @@ static void xf_cliprdr_send_raw_format_list(xfInfo* xfi)
freerdp_channels_send_event(cb->channels, (wMessage*) event);
}
static void xf_cliprdr_send_null_format_list(xfInfo* xfi)
static void xf_cliprdr_send_null_format_list(xfContext* xfc)
{
RDP_CB_FORMAT_LIST_EVENT* event;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_FormatList, NULL, NULL);
@ -366,11 +366,11 @@ static void xf_cliprdr_send_null_format_list(xfInfo* xfi)
freerdp_channels_send_event(cb->channels, (wMessage*) event);
}
static void xf_cliprdr_send_supported_format_list(xfInfo* xfi)
static void xf_cliprdr_send_supported_format_list(xfContext* xfc)
{
int i;
RDP_CB_FORMAT_LIST_EVENT* event;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_FormatList, NULL, NULL);
@ -384,30 +384,30 @@ static void xf_cliprdr_send_supported_format_list(xfInfo* xfi)
freerdp_channels_send_event(cb->channels, (wMessage*) event);
}
static void xf_cliprdr_send_format_list(xfInfo* xfi)
static void xf_cliprdr_send_format_list(xfContext* xfc)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (xf_cliprdr_is_self_owned(xfi))
if (xf_cliprdr_is_self_owned(xfc))
{
xf_cliprdr_send_raw_format_list(xfi);
xf_cliprdr_send_raw_format_list(xfc);
}
else if (cb->owner == None)
{
xf_cliprdr_send_null_format_list(xfi);
xf_cliprdr_send_null_format_list(xfc);
}
else if (cb->owner != xfi->drawable)
else if (cb->owner != xfc->drawable)
{
/* Request the owner for TARGETS, and wait for SelectionNotify event */
XConvertSelection(xfi->display, cb->clipboard_atom,
cb->targets[1], cb->property_atom, xfi->drawable, CurrentTime);
XConvertSelection(xfc->display, cb->clipboard_atom,
cb->targets[1], cb->property_atom, xfc->drawable, CurrentTime);
}
}
static void xf_cliprdr_send_data_request(xfInfo* xfi, UINT32 format)
static void xf_cliprdr_send_data_request(xfContext* xfc, UINT32 format)
{
RDP_CB_DATA_REQUEST_EVENT* event;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
event = (RDP_CB_DATA_REQUEST_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_DataRequest, NULL, NULL);
@ -417,10 +417,10 @@ static void xf_cliprdr_send_data_request(xfInfo* xfi, UINT32 format)
freerdp_channels_send_event(cb->channels, (wMessage*) event);
}
static void xf_cliprdr_send_data_response(xfInfo* xfi, BYTE* data, int size)
static void xf_cliprdr_send_data_response(xfContext* xfc, BYTE* data, int size)
{
RDP_CB_DATA_RESPONSE_EVENT* event;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
event = (RDP_CB_DATA_RESPONSE_EVENT*) freerdp_event_new(CliprdrChannel_Class,
CliprdrChannel_DataResponse, NULL, NULL);
@ -431,31 +431,31 @@ static void xf_cliprdr_send_data_response(xfInfo* xfi, BYTE* data, int size)
freerdp_channels_send_event(cb->channels, (wMessage*) event);
}
static void xf_cliprdr_send_null_data_response(xfInfo* xfi)
static void xf_cliprdr_send_null_data_response(xfContext* xfc)
{
xf_cliprdr_send_data_response(xfi, NULL, 0);
xf_cliprdr_send_data_response(xfc, NULL, 0);
}
static void xf_cliprdr_process_cb_monitor_ready_event(xfInfo* xfi)
static void xf_cliprdr_process_cb_monitor_ready_event(xfContext* xfc)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
xf_cliprdr_send_format_list(xfi);
xf_cliprdr_send_format_list(xfc);
cb->sync = TRUE;
}
static void xf_cliprdr_process_cb_data_request_event(xfInfo* xfi, RDP_CB_DATA_REQUEST_EVENT* event)
static void xf_cliprdr_process_cb_data_request_event(xfContext* xfc, RDP_CB_DATA_REQUEST_EVENT* event)
{
int i;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
DEBUG_X11_CLIPRDR("format %d", event->format);
if (xf_cliprdr_is_self_owned(xfi))
if (xf_cliprdr_is_self_owned(xfc))
{
/* CB_FORMAT_RAW */
i = 0;
XChangeProperty(xfi->display, xfi->drawable, cb->property_atom,
XChangeProperty(xfc->display, xfc->drawable, cb->property_atom,
XA_INTEGER, 32, PropModeReplace, (BYTE*) &event->format, 1);
}
else
@ -466,7 +466,7 @@ static void xf_cliprdr_process_cb_data_request_event(xfInfo* xfi, RDP_CB_DATA_RE
if (i < 0)
{
DEBUG_X11_CLIPRDR("unsupported format requested");
xf_cliprdr_send_null_data_response(xfi);
xf_cliprdr_send_null_data_response(xfc);
}
else
{
@ -474,15 +474,15 @@ static void xf_cliprdr_process_cb_data_request_event(xfInfo* xfi, RDP_CB_DATA_RE
DEBUG_X11_CLIPRDR("target=%d", (int) cb->format_mappings[i].target_format);
XConvertSelection(xfi->display, cb->clipboard_atom,
XConvertSelection(xfc->display, cb->clipboard_atom,
cb->format_mappings[i].target_format, cb->property_atom,
xfi->drawable, CurrentTime);
XFlush(xfi->display);
xfc->drawable, CurrentTime);
XFlush(xfc->display);
/* After this point, we expect a SelectionNotify event from the clipboard owner. */
}
}
static void xf_cliprdr_get_requested_targets(xfInfo* xfi)
static void xf_cliprdr_get_requested_targets(xfContext* xfc)
{
int num;
int i, j;
@ -491,9 +491,9 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi)
BYTE* data = NULL;
unsigned long length, bytes_left;
RDP_CB_FORMAT_LIST_EVENT* event;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
XGetWindowProperty(xfi->display, xfi->drawable, cb->property_atom,
XGetWindowProperty(xfc->display, xfc->drawable, cb->property_atom,
0, 200, 0, XA_ATOM, &atom, &format, &length, &bytes_left, &data);
DEBUG_X11_CLIPRDR("type=%d format=%d length=%d bytes_left=%d",
@ -534,7 +534,7 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi)
if (data)
XFree(data);
xf_cliprdr_send_null_format_list(xfi);
xf_cliprdr_send_null_format_list(xfc);
}
}
@ -669,17 +669,17 @@ static BYTE* xf_cliprdr_process_requested_html(BYTE* data, int* size)
return outbuf;
}
static void xf_cliprdr_process_requested_data(xfInfo* xfi, BOOL has_data, BYTE* data, int size)
static void xf_cliprdr_process_requested_data(xfContext* xfc, BOOL has_data, BYTE* data, int size)
{
BYTE* outbuf;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (cb->incr_starts && has_data)
return;
if (!has_data || data == NULL)
{
xf_cliprdr_send_null_data_response(xfi);
xf_cliprdr_send_null_data_response(xfc);
return;
}
@ -714,31 +714,31 @@ static void xf_cliprdr_process_requested_data(xfInfo* xfi, BOOL has_data, BYTE*
}
if (outbuf)
xf_cliprdr_send_data_response(xfi, outbuf, size);
xf_cliprdr_send_data_response(xfc, outbuf, size);
else
xf_cliprdr_send_null_data_response(xfi);
xf_cliprdr_send_null_data_response(xfc);
/* Resend the format list, otherwise the server won't request again for the next paste */
xf_cliprdr_send_format_list(xfi);
xf_cliprdr_send_format_list(xfc);
}
static BOOL xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target)
static BOOL xf_cliprdr_get_requested_data(xfContext* xfc, Atom target)
{
Atom type;
int format;
BYTE* data = NULL;
BOOL has_data = FALSE;
unsigned long length, bytes_left, dummy;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if ((cb->request_index < 0) || (cb->format_mappings[cb->request_index].target_format != target))
{
DEBUG_X11_CLIPRDR("invalid target");
xf_cliprdr_send_null_data_response(xfi);
xf_cliprdr_send_null_data_response(xfc);
return FALSE;
}
XGetWindowProperty(xfi->display, xfi->drawable,
XGetWindowProperty(xfc->display, xfc->drawable,
cb->property_atom, 0, 0, 0, target,
&type, &format, &length, &bytes_left, &data);
@ -780,7 +780,7 @@ static BOOL xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target)
DEBUG_X11("INCR finished");
has_data = TRUE;
}
else if (XGetWindowProperty(xfi->display, xfi->drawable,
else if (XGetWindowProperty(xfc->display, xfc->drawable,
cb->property_atom, 0, bytes_left, 0, target,
&type, &format, &length, &dummy, &data) == Success)
{
@ -801,9 +801,9 @@ static BOOL xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target)
DEBUG_X11_CLIPRDR("XGetWindowProperty failed");
}
}
XDeleteProperty(xfi->display, xfi->drawable, cb->property_atom);
XDeleteProperty(xfc->display, xfc->drawable, cb->property_atom);
xf_cliprdr_process_requested_data(xfi, has_data, data, (int) bytes_left);
xf_cliprdr_process_requested_data(xfc, has_data, data, (int) bytes_left);
if (data)
XFree(data);
@ -827,13 +827,13 @@ static void xf_cliprdr_append_target(clipboardContext* cb, Atom target)
cb->targets[cb->num_targets++] = target;
}
static void xf_cliprdr_provide_targets(xfInfo* xfi, XEvent* respond)
static void xf_cliprdr_provide_targets(xfContext* xfc, XEvent* respond)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (respond->xselection.property != None)
{
XChangeProperty(xfi->display,
XChangeProperty(xfc->display,
respond->xselection.requestor,
respond->xselection.property,
XA_ATOM, 32, PropModeReplace,
@ -841,13 +841,13 @@ static void xf_cliprdr_provide_targets(xfInfo* xfi, XEvent* respond)
}
}
static void xf_cliprdr_provide_data(xfInfo* xfi, XEvent* respond)
static void xf_cliprdr_provide_data(xfContext* xfc, XEvent* respond)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (respond->xselection.property != None)
{
XChangeProperty(xfi->display,
XChangeProperty(xfc->display,
respond->xselection.requestor,
respond->xselection.property,
respond->xselection.target, 8, PropModeReplace,
@ -855,10 +855,10 @@ static void xf_cliprdr_provide_data(xfInfo* xfi, XEvent* respond)
}
}
static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_LIST_EVENT* event)
static void xf_cliprdr_process_cb_format_list_event(xfContext* xfc, RDP_CB_FORMAT_LIST_EVENT* event)
{
int i, j;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (cb->data)
{
@ -888,16 +888,16 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L
}
}
XSetSelectionOwner(xfi->display, cb->clipboard_atom, xfi->drawable, CurrentTime);
XSetSelectionOwner(xfc->display, cb->clipboard_atom, xfc->drawable, CurrentTime);
if (event->raw_format_data)
{
XChangeProperty(xfi->display, cb->root_window, cb->property_atom,
XChangeProperty(xfc->display, cb->root_window, cb->property_atom,
XA_STRING, 8, PropModeReplace,
event->raw_format_data, event->raw_format_data_size);
}
XFlush(xfi->display);
XFlush(xfc->display);
}
static void xf_cliprdr_process_text(clipboardContext* cb, BYTE* data, int size)
@ -979,9 +979,9 @@ static void xf_cliprdr_process_html(clipboardContext* cb, BYTE* data, int size)
crlf2lf(cb->data, &cb->data_length);
}
static void xf_cliprdr_process_cb_data_response_event(xfInfo* xfi, RDP_CB_DATA_RESPONSE_EVENT* event)
static void xf_cliprdr_process_cb_data_response_event(xfContext* xfc, RDP_CB_DATA_RESPONSE_EVENT* event)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
DEBUG_X11_CLIPRDR("size=%d", event->size);
@ -1035,33 +1035,33 @@ static void xf_cliprdr_process_cb_data_response_event(xfInfo* xfi, RDP_CB_DATA_R
cb->respond->xselection.property = None;
break;
}
xf_cliprdr_provide_data(xfi, cb->respond);
xf_cliprdr_provide_data(xfc, cb->respond);
}
XSendEvent(xfi->display, cb->respond->xselection.requestor, 0, 0, cb->respond);
XFlush(xfi->display);
XSendEvent(xfc->display, cb->respond->xselection.requestor, 0, 0, cb->respond);
XFlush(xfc->display);
free(cb->respond);
cb->respond = NULL;
}
void xf_process_cliprdr_event(xfInfo* xfi, wMessage* event)
void xf_process_cliprdr_event(xfContext* xfc, wMessage* event)
{
switch (GetMessageType(event->id))
{
case CliprdrChannel_MonitorReady:
xf_cliprdr_process_cb_monitor_ready_event(xfi);
xf_cliprdr_process_cb_monitor_ready_event(xfc);
break;
case CliprdrChannel_FormatList:
xf_cliprdr_process_cb_format_list_event(xfi, (RDP_CB_FORMAT_LIST_EVENT*) event);
xf_cliprdr_process_cb_format_list_event(xfc, (RDP_CB_FORMAT_LIST_EVENT*) event);
break;
case CliprdrChannel_DataRequest:
xf_cliprdr_process_cb_data_request_event(xfi, (RDP_CB_DATA_REQUEST_EVENT*) event);
xf_cliprdr_process_cb_data_request_event(xfc, (RDP_CB_DATA_REQUEST_EVENT*) event);
break;
case CliprdrChannel_DataResponse:
xf_cliprdr_process_cb_data_response_event(xfi, (RDP_CB_DATA_RESPONSE_EVENT*) event);
xf_cliprdr_process_cb_data_response_event(xfc, (RDP_CB_DATA_RESPONSE_EVENT*) event);
break;
default:
@ -1070,31 +1070,31 @@ void xf_process_cliprdr_event(xfInfo* xfi, wMessage* event)
}
}
BOOL xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent)
BOOL xf_cliprdr_process_selection_notify(xfContext* xfc, XEvent* xevent)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (xevent->xselection.target == cb->targets[1])
{
if (xevent->xselection.property == None)
{
DEBUG_X11_CLIPRDR("owner not support TARGETS. sending all format.");
xf_cliprdr_send_supported_format_list(xfi);
xf_cliprdr_send_supported_format_list(xfc);
}
else
{
xf_cliprdr_get_requested_targets(xfi);
xf_cliprdr_get_requested_targets(xfc);
}
return TRUE;
}
else
{
return xf_cliprdr_get_requested_data(xfi, xevent->xselection.target);
return xf_cliprdr_get_requested_data(xfc, xevent->xselection.target);
}
}
BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
BOOL xf_cliprdr_process_selection_request(xfContext* xfc, XEvent* xevent)
{
int i;
int fmt;
@ -1105,11 +1105,11 @@ BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
BYTE* data = NULL;
BOOL delay_respond;
unsigned long length, bytes_left;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
DEBUG_X11_CLIPRDR("target=%d", (int) xevent->xselectionrequest.target);
if (xevent->xselectionrequest.owner != xfi->drawable)
if (xevent->xselectionrequest.owner != xfc->drawable)
{
DEBUG_X11_CLIPRDR("not owner");
return FALSE;
@ -1138,7 +1138,7 @@ BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
/* Someone else requests our available formats */
DEBUG_X11_CLIPRDR("target: TARGETS");
respond->xselection.property = xevent->xselectionrequest.property;
xf_cliprdr_provide_targets(xfi, respond);
xf_cliprdr_provide_targets(xfc, respond);
}
else
{
@ -1146,14 +1146,14 @@ BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
i = xf_cliprdr_select_format_by_atom(cb, xevent->xselectionrequest.target);
if (i >= 0 && xevent->xselectionrequest.requestor != xfi->drawable)
if (i >= 0 && xevent->xselectionrequest.requestor != xfc->drawable)
{
format = cb->format_mappings[i].format_id;
alt_format = format;
if (format == CB_FORMAT_RAW)
{
if (XGetWindowProperty(xfi->display, xevent->xselectionrequest.requestor,
if (XGetWindowProperty(xfc->display, xevent->xselectionrequest.requestor,
cb->property_atom, 0, 4, 0, XA_INTEGER,
&type, &fmt, &length, &bytes_left, &data) != Success)
{
@ -1172,7 +1172,7 @@ BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
{
/* Cached clipboard data available. Send it now */
respond->xselection.property = xevent->xselectionrequest.property;
xf_cliprdr_provide_data(xfi, respond);
xf_cliprdr_provide_data(xfc, respond);
}
else if (cb->respond)
{
@ -1196,36 +1196,36 @@ BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
cb->data_alt_format = alt_format;
delay_respond = TRUE;
xf_cliprdr_send_data_request(xfi, alt_format);
xf_cliprdr_send_data_request(xfc, alt_format);
}
}
}
if (delay_respond == FALSE)
{
XSendEvent(xfi->display, xevent->xselectionrequest.requestor, 0, 0, respond);
XFlush(xfi->display);
XSendEvent(xfc->display, xevent->xselectionrequest.requestor, 0, 0, respond);
XFlush(xfc->display);
free(respond);
}
return TRUE;
}
BOOL xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent)
BOOL xf_cliprdr_process_selection_clear(xfContext* xfc, XEvent* xevent)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (xf_cliprdr_is_self_owned(xfi))
if (xf_cliprdr_is_self_owned(xfc))
return FALSE;
XDeleteProperty(xfi->display, cb->root_window, cb->property_atom);
XDeleteProperty(xfc->display, cb->root_window, cb->property_atom);
return TRUE;
}
BOOL xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent)
BOOL xf_cliprdr_process_property_notify(xfContext* xfc, XEvent* xevent)
{
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (!cb)
return TRUE;
@ -1236,33 +1236,33 @@ BOOL xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent)
if (xevent->xproperty.window == cb->root_window)
{
DEBUG_X11_CLIPRDR("root window PropertyNotify");
xf_cliprdr_send_format_list(xfi);
xf_cliprdr_send_format_list(xfc);
}
else if (xevent->xproperty.window == xfi->drawable &&
else if (xevent->xproperty.window == xfc->drawable &&
xevent->xproperty.state == PropertyNewValue &&
cb->incr_starts && cb->request_index >= 0)
{
DEBUG_X11_CLIPRDR("cliprdr window PropertyNotify");
xf_cliprdr_get_requested_data(xfi,
xf_cliprdr_get_requested_data(xfc,
cb->format_mappings[cb->request_index].target_format);
}
return TRUE;
}
void xf_cliprdr_check_owner(xfInfo* xfi)
void xf_cliprdr_check_owner(xfContext* xfc)
{
Window owner;
clipboardContext* cb = (clipboardContext*) xfi->clipboard_context;
clipboardContext* cb = (clipboardContext*) xfc->clipboard_context;
if (cb->sync)
{
owner = XGetSelectionOwner(xfi->display, cb->clipboard_atom);
owner = XGetSelectionOwner(xfc->display, cb->clipboard_atom);
if (cb->owner != owner)
{
cb->owner = owner;
xf_cliprdr_send_format_list(xfi);
xf_cliprdr_send_format_list(xfc);
}
}
}

View File

@ -23,13 +23,13 @@
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_cliprdr_init(xfInfo* xfi, rdpChannels* chanman);
void xf_cliprdr_uninit(xfInfo* xfi);
void xf_process_cliprdr_event(xfInfo* xfi, wMessage* event);
BOOL xf_cliprdr_process_selection_notify(xfInfo* xfi, XEvent* xevent);
BOOL xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent);
BOOL xf_cliprdr_process_selection_clear(xfInfo* xfi, XEvent* xevent);
BOOL xf_cliprdr_process_property_notify(xfInfo* xfi, XEvent* xevent);
void xf_cliprdr_check_owner(xfInfo* xfi);
void xf_cliprdr_init(xfContext* xfc, rdpChannels* channels);
void xf_cliprdr_uninit(xfContext* xfc);
void xf_process_cliprdr_event(xfContext* xfc, wMessage* event);
BOOL xf_cliprdr_process_selection_notify(xfContext* xfc, XEvent* xevent);
BOOL xf_cliprdr_process_selection_request(xfContext* xfc, XEvent* xevent);
BOOL xf_cliprdr_process_selection_clear(xfContext* xfc, XEvent* xevent);
BOOL xf_cliprdr_process_property_notify(xfContext* xfc, XEvent* xevent);
void xf_cliprdr_check_owner(xfContext* xfc);
#endif /* __XF_CLIPRDR_H */

View File

@ -84,7 +84,7 @@ const char* const X11_EVENT_STRINGS[] =
#define DEBUG_X11_LMS(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
static BOOL xf_event_Expose(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_Expose(xfContext* xfc, XEvent* event, BOOL app)
{
int x, y;
int w, h;
@ -96,51 +96,51 @@ static BOOL xf_event_Expose(xfInfo* xfi, XEvent* event, BOOL app)
if (!app)
{
if (xfi->scale != 1.0)
if (xfc->scale != 1.0)
{
xf_draw_screen_scaled(xfi);
xf_draw_screen_scaled(xfc);
}
else
{
XCopyArea(xfi->display, xfi->primary,
xfi->window->handle, xfi->gc, x, y, w, h, x, y);
XCopyArea(xfc->display, xfc->primary,
xfc->window->handle, xfc->gc, x, y, w, h, x, y);
}
}
else
{
xfWindow* xfw;
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpRail* rail = ((rdpContext*) xfc)->rail;
window = window_list_get_by_extra_id(rail->list, (void*) event->xexpose.window);
if (window != NULL)
{
xfw = (xfWindow*) window->extra;
xf_UpdateWindowArea(xfi, xfw, x, y, w, h);
xf_UpdateWindowArea(xfc, xfw, x, y, w, h);
}
}
return TRUE;
}
static BOOL xf_event_VisibilityNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_VisibilityNotify(xfContext* xfc, XEvent* event, BOOL app)
{
xfi->unobscured = event->xvisibility.state == VisibilityUnobscured;
xfc->unobscured = event->xvisibility.state == VisibilityUnobscured;
return TRUE;
}
static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_MotionNotify(xfContext* xfc, XEvent* event, BOOL app)
{
int x, y;
rdpInput* input;
Window childWindow;
input = xfi->instance->input;
input = xfc->instance->input;
x = event->xmotion.x;
y = event->xmotion.y;
if (!xfi->settings->MouseMotion)
if (!xfc->settings->MouseMotion)
{
if ((event->xmotion.state & (Button1Mask | Button2Mask | Button3Mask)) == 0)
return TRUE;
@ -149,35 +149,35 @@ static BOOL xf_event_MotionNotify(xfInfo* xfi, XEvent* event, BOOL app)
if (app)
{
/* make sure window exists */
if (xf_rdpWindowFromWindow(xfi, event->xmotion.window) == 0)
if (xf_rdpWindowFromWindow(xfc, event->xmotion.window) == 0)
{
return TRUE;
}
/* Translate to desktop coordinates */
XTranslateCoordinates(xfi->display, event->xmotion.window,
RootWindowOfScreen(xfi->screen),
XTranslateCoordinates(xfc->display, event->xmotion.window,
RootWindowOfScreen(xfc->screen),
x, y, &x, &y, &childWindow);
}
if (xfi->scale != 1.0)
if (xfc->scale != 1.0)
{
/* Take scaling in to consideration */
x = (int) (x * (1.0 / xfi->scale));
y = (int) (y * (1.0 / xfi->scale));
x = (int) (x * (1.0 / xfc->scale));
y = (int) (y * (1.0 / xfc->scale));
}
input->MouseEvent(input, PTR_FLAGS_MOVE, x, y);
if (xfi->fullscreen)
if (xfc->fullscreen)
{
XSetInputFocus(xfi->display, xfi->window->handle, RevertToPointerRoot, CurrentTime);
XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
}
return TRUE;
}
static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_ButtonPress(xfContext* xfc, XEvent* event, BOOL app)
{
int x, y;
int flags;
@ -186,7 +186,7 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
rdpInput* input;
Window childWindow;
input = xfi->instance->input;
input = xfc->instance->input;
x = 0;
y = 0;
@ -260,21 +260,21 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
if (app)
{
/* make sure window exists */
if (xf_rdpWindowFromWindow(xfi, event->xbutton.window) == 0)
if (xf_rdpWindowFromWindow(xfc, event->xbutton.window) == 0)
{
return TRUE;
}
/* Translate to desktop coordinates */
XTranslateCoordinates(xfi->display, event->xbutton.window,
RootWindowOfScreen(xfi->screen),
XTranslateCoordinates(xfc->display, event->xbutton.window,
RootWindowOfScreen(xfc->screen),
x, y, &x, &y, &childWindow);
}
if (xfi->scale != 1.0)
if (xfc->scale != 1.0)
{
/* Take scaling in to consideration */
x = (int) (x * (1.0 / xfi->scale));
y = (int) (y * (1.0 / xfi->scale));
x = (int) (x * (1.0 / xfc->scale));
y = (int) (y * (1.0 / xfc->scale));
}
if (extended)
@ -287,7 +287,7 @@ static BOOL xf_event_ButtonPress(xfInfo* xfi, XEvent* event, BOOL app)
return TRUE;
}
static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_ButtonRelease(xfContext* xfc, XEvent* event, BOOL app)
{
int x, y;
int flags;
@ -295,7 +295,7 @@ static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app)
rdpInput* input;
Window childWindow;
input = xfi->instance->input;
input = xfc->instance->input;
x = 0;
y = 0;
@ -350,21 +350,21 @@ static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app)
if (app)
{
/* make sure window exists */
if (xf_rdpWindowFromWindow(xfi, event->xbutton.window) == NULL)
if (xf_rdpWindowFromWindow(xfc, event->xbutton.window) == NULL)
{
return TRUE;
}
/* Translate to desktop coordinates */
XTranslateCoordinates(xfi->display, event->xbutton.window,
RootWindowOfScreen(xfi->screen),
XTranslateCoordinates(xfc->display, event->xbutton.window,
RootWindowOfScreen(xfc->screen),
x, y, &x, &y, &childWindow);
}
if (xfi->scale != 1.0)
if (xfc->scale != 1.0)
{
/* Take scaling in to consideration */
x = (int) (x * (1.0 / xfi->scale));
y = (int) (y * (1.0 / xfi->scale));
x = (int) (x * (1.0 / xfc->scale));
y = (int) (y * (1.0 / xfc->scale));
}
if (extended)
@ -376,31 +376,31 @@ static BOOL xf_event_ButtonRelease(xfInfo* xfi, XEvent* event, BOOL app)
return TRUE;
}
static BOOL xf_event_KeyPress(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_KeyPress(xfContext* xfc, XEvent* event, BOOL app)
{
KeySym keysym;
char str[256];
XLookupString((XKeyEvent*) event, str, sizeof(str), &keysym, NULL);
xf_kbd_set_keypress(xfi, event->xkey.keycode, keysym);
xf_kbd_set_keypress(xfc, event->xkey.keycode, keysym);
if (xfi->fullscreen_toggle && xf_kbd_handle_special_keys(xfi, keysym))
if (xfc->fullscreen_toggle && xf_kbd_handle_special_keys(xfc, keysym))
return TRUE;
xf_kbd_send_key(xfi, TRUE, event->xkey.keycode);
xf_kbd_send_key(xfc, TRUE, event->xkey.keycode);
return TRUE;
}
static BOOL xf_event_KeyRelease(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_KeyRelease(xfContext* xfc, XEvent* event, BOOL app)
{
XEvent next_event;
if (XPending(xfi->display))
if (XPending(xfc->display))
{
ZeroMemory(&next_event, sizeof(next_event));
XPeekEvent(xfi->display, &next_event);
XPeekEvent(xfc->display, &next_event);
if (next_event.type == KeyPress)
{
@ -409,89 +409,89 @@ static BOOL xf_event_KeyRelease(xfInfo* xfi, XEvent* event, BOOL app)
}
}
xf_kbd_unset_keypress(xfi, event->xkey.keycode);
xf_kbd_send_key(xfi, FALSE, event->xkey.keycode);
xf_kbd_unset_keypress(xfc, event->xkey.keycode);
xf_kbd_send_key(xfc, FALSE, event->xkey.keycode);
return TRUE;
}
static BOOL xf_event_FocusIn(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_FocusIn(xfContext* xfc, XEvent* event, BOOL app)
{
if (event->xfocus.mode == NotifyGrab)
return TRUE;
xfi->focused = TRUE;
xfc->focused = TRUE;
if (xfi->mouse_active && (!app))
XGrabKeyboard(xfi->display, xfi->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime);
if (xfc->mouse_active && (!app))
XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime);
if (app)
{
xf_rail_send_activate(xfi, event->xany.window, TRUE);
xf_rail_send_activate(xfc, event->xany.window, TRUE);
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpRail* rail = ((rdpContext*) xfc)->rail;
window = window_list_get_by_extra_id(rail->list, (void*) event->xany.window);
/* Update the server with any window changes that occured while the window was not focused. */
if (window != NULL)
xf_rail_adjust_position(xfi, window);
xf_rail_adjust_position(xfc, window);
}
xf_kbd_focus_in(xfi);
xf_kbd_focus_in(xfc);
if (!app)
xf_cliprdr_check_owner(xfi);
xf_cliprdr_check_owner(xfc);
return TRUE;
}
static BOOL xf_event_FocusOut(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_FocusOut(xfContext* xfc, XEvent* event, BOOL app)
{
if (event->xfocus.mode == NotifyUngrab)
return TRUE;
xfi->focused = FALSE;
xfc->focused = FALSE;
if (event->xfocus.mode == NotifyWhileGrabbed)
XUngrabKeyboard(xfi->display, CurrentTime);
XUngrabKeyboard(xfc->display, CurrentTime);
xf_kbd_clear(xfi);
xf_kbd_clear(xfc);
if (app)
xf_rail_send_activate(xfi, event->xany.window, FALSE);
xf_rail_send_activate(xfc, event->xany.window, FALSE);
return TRUE;
}
static BOOL xf_event_MappingNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_MappingNotify(xfContext* xfc, XEvent* event, BOOL app)
{
if (event->xmapping.request == MappingModifier)
{
XFreeModifiermap(xfi->modifier_map);
xfi->modifier_map = XGetModifierMapping(xfi->display);
XFreeModifiermap(xfc->modifier_map);
xfc->modifier_map = XGetModifierMapping(xfc->display);
}
return TRUE;
}
static BOOL xf_event_ClientMessage(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_ClientMessage(xfContext* xfc, XEvent* event, BOOL app)
{
if ((event->xclient.message_type == xfi->WM_PROTOCOLS)
&& ((Atom) event->xclient.data.l[0] == xfi->WM_DELETE_WINDOW))
if ((event->xclient.message_type == xfc->WM_PROTOCOLS)
&& ((Atom) event->xclient.data.l[0] == xfc->WM_DELETE_WINDOW))
{
if (app)
{
DEBUG_X11("RAIL window closed");
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpRail* rail = ((rdpContext*) xfc)->rail;
window = window_list_get_by_extra_id(rail->list, (void*) event->xclient.window);
if (window != NULL)
{
xf_rail_send_client_system_command(xfi, window->windowId, SC_CLOSE);
xf_rail_send_client_system_command(xfc, window->windowId, SC_CLOSE);
}
return TRUE;
@ -506,17 +506,17 @@ static BOOL xf_event_ClientMessage(xfInfo* xfi, XEvent* event, BOOL app)
return TRUE;
}
static BOOL xf_event_EnterNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_EnterNotify(xfContext* xfc, XEvent* event, BOOL app)
{
if (!app)
{
xfi->mouse_active = TRUE;
xfc->mouse_active = TRUE;
if (xfi->fullscreen)
XSetInputFocus(xfi->display, xfi->window->handle, RevertToPointerRoot, CurrentTime);
if (xfc->fullscreen)
XSetInputFocus(xfc->display, xfc->window->handle, RevertToPointerRoot, CurrentTime);
if (xfi->focused)
XGrabKeyboard(xfi->display, xfi->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime);
if (xfc->focused)
XGrabKeyboard(xfc->display, xfc->window->handle, TRUE, GrabModeAsync, GrabModeAsync, CurrentTime);
}
else
{
@ -524,42 +524,42 @@ static BOOL xf_event_EnterNotify(xfInfo* xfi, XEvent* event, BOOL app)
xfWindow* xfw;
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpRail* rail = ((rdpContext*) xfc)->rail;
window = window_list_get_by_extra_id(rail->list, (void*) event->xexpose.window);
if (window != NULL)
{
xfw = (xfWindow*) window->extra;
xfi->window = xfw;
xfc->window = xfw;
}
}
return TRUE;
}
static BOOL xf_event_LeaveNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_LeaveNotify(xfContext* xfc, XEvent* event, BOOL app)
{
if (!app)
{
xfi->mouse_active = FALSE;
XUngrabKeyboard(xfi->display, CurrentTime);
xfc->mouse_active = FALSE;
XUngrabKeyboard(xfc->display, CurrentTime);
}
return TRUE;
}
static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_ConfigureNotify(xfContext* xfc, XEvent* event, BOOL app)
{
rdpWindow* window;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpRail* rail = ((rdpContext*) xfc)->rail;
if (xfi->width != event->xconfigure.width)
if (xfc->width != event->xconfigure.width)
{
xfi->scale = (double) event->xconfigure.width / (double) xfi->originalWidth;
xfi->currentWidth = event->xconfigure.width;
xfi->currentHeight = event->xconfigure.width;
xfc->scale = (double) event->xconfigure.width / (double) xfc->originalWidth;
xfc->currentWidth = event->xconfigure.width;
xfc->currentHeight = event->xconfigure.width;
xf_draw_screen_scaled(xfi);
xf_draw_screen_scaled(xfc);
}
window = window_list_get_by_extra_id(rail->list, (void*) event->xconfigure.window);
@ -575,8 +575,8 @@ static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app)
* Translate these to root window coordinates.
*/
XTranslateCoordinates(xfi->display, xfw->handle,
RootWindowOfScreen(xfi->screen),
XTranslateCoordinates(xfc->display, xfw->handle,
RootWindowOfScreen(xfc->screen),
0, 0, &xfw->left, &xfw->top, &childWindow);
xfw->width = event->xconfigure.width;
@ -597,7 +597,7 @@ static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app)
if (app && xfw->decorations)
{
/* moving resizing using window decoration */
xf_rail_adjust_position(xfi, window);
xf_rail_adjust_position(xfc, window);
window->windowOffsetX = xfw->left;
window->visibleOffsetX = window->windowOffsetX;
window->windowOffsetY = xfw->top;
@ -607,9 +607,9 @@ static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app)
}
else
{
if (app && (!event->xconfigure.send_event || xfi->window->local_move.state == LMS_NOT_ACTIVE)
&& !xfw->rail_ignore_configure && xfi->focused)
xf_rail_adjust_position(xfi, window);
if (app && (!event->xconfigure.send_event || xfc->window->local_move.state == LMS_NOT_ACTIVE)
&& !xfw->rail_ignore_configure && xfc->focused)
xf_rail_adjust_position(xfc, window);
}
}
@ -617,21 +617,21 @@ static BOOL xf_event_ConfigureNotify(xfInfo* xfi, XEvent* event, BOOL app)
return True;
}
static BOOL xf_event_MapNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_MapNotify(xfContext* xfc, XEvent* event, BOOL app)
{
RECTANGLE_16 rect;
rdpWindow* window;
rdpUpdate* update = xfi->instance->update;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpUpdate* update = xfc->instance->update;
rdpRail* rail = ((rdpContext*) xfc)->rail;
if (!app)
{
rect.left = 0;
rect.top = 0;
rect.right = xfi->width;
rect.bottom = xfi->height;
rect.right = xfc->width;
rect.bottom = xfc->height;
update->SuppressOutput((rdpContext*) xfi->context, 1, &rect);
update->SuppressOutput((rdpContext*) xfc, 1, &rect);
}
else
{
@ -646,7 +646,7 @@ static BOOL xf_event_MapNotify(xfInfo* xfi, XEvent* event, BOOL app)
* that is minimized back to the maximized state
*/
//xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE);
//xf_rail_send_client_system_command(xfc, window->windowId, SC_RESTORE);
xfWindow* xfw = (xfWindow*) window->extra;
xfw->is_mapped = TRUE;
}
@ -655,17 +655,17 @@ static BOOL xf_event_MapNotify(xfInfo* xfi, XEvent* event, BOOL app)
return TRUE;
}
static BOOL xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_UnmapNotify(xfContext* xfc, XEvent* event, BOOL app)
{
rdpWindow* window;
rdpUpdate* update = xfi->instance->update;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpUpdate* update = xfc->instance->update;
rdpRail* rail = ((rdpContext*) xfc)->rail;
xf_kbd_release_all_keypress(xfi);
xf_kbd_release_all_keypress(xfc);
if (!app)
{
update->SuppressOutput((rdpContext*) xfi->context, 0, NULL);
update->SuppressOutput((rdpContext*) xfc, 0, NULL);
}
else
{
@ -681,40 +681,40 @@ static BOOL xf_event_UnmapNotify(xfInfo* xfi, XEvent* event, BOOL app)
return TRUE;
}
static BOOL xf_event_SelectionNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_SelectionNotify(xfContext* xfc, XEvent* event, BOOL app)
{
if (!app)
{
if (xf_cliprdr_process_selection_notify(xfi, event))
if (xf_cliprdr_process_selection_notify(xfc, event))
return TRUE;
}
return TRUE;
}
static BOOL xf_event_SelectionRequest(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_SelectionRequest(xfContext* xfc, XEvent* event, BOOL app)
{
if (!app)
{
if (xf_cliprdr_process_selection_request(xfi, event))
if (xf_cliprdr_process_selection_request(xfc, event))
return TRUE;
}
return TRUE;
}
static BOOL xf_event_SelectionClear(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_SelectionClear(xfContext* xfc, XEvent* event, BOOL app)
{
if (!app)
{
if (xf_cliprdr_process_selection_clear(xfi, event))
if (xf_cliprdr_process_selection_clear(xfc, event))
return TRUE;
}
return TRUE;
}
static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
static BOOL xf_event_PropertyNotify(xfContext* xfc, XEvent* event, BOOL app)
{
/*
* This section handles sending the appropriate commands to the rail server
@ -726,13 +726,13 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
{
rdpWindow* window;
window = xf_rdpWindowFromWindow(xfi, event->xproperty.window);
window = xf_rdpWindowFromWindow(xfc, event->xproperty.window);
if (window == NULL)
return TRUE;
if ((((Atom) event->xproperty.atom == xfi->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) ||
(((Atom) event->xproperty.atom == xfi->WM_STATE) && (event->xproperty.state != PropertyDelete)))
if ((((Atom) event->xproperty.atom == xfc->_NET_WM_STATE) && (event->xproperty.state != PropertyDelete)) ||
(((Atom) event->xproperty.atom == xfc->WM_STATE) && (event->xproperty.state != PropertyDelete)))
{
int i;
BOOL status;
@ -743,10 +743,10 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
unsigned long bytes;
unsigned char* prop;
if ((Atom) event->xproperty.atom == xfi->_NET_WM_STATE)
if ((Atom) event->xproperty.atom == xfc->_NET_WM_STATE)
{
status = xf_GetWindowProperty(xfi, event->xproperty.window,
xfi->_NET_WM_STATE, 12, &nitems, &bytes, &prop);
status = xf_GetWindowProperty(xfc, event->xproperty.window,
xfc->_NET_WM_STATE, 12, &nitems, &bytes, &prop);
if (!status)
{
@ -755,12 +755,12 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
for (i = 0; i < nitems; i++)
{
if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False))
{
maxVert = TRUE;
}
if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False))
if ((Atom) ((UINT16**) prop)[i] == XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False))
{
maxHorz = TRUE;
}
@ -769,9 +769,9 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
XFree(prop);
}
if ((Atom) event->xproperty.atom == xfi->WM_STATE)
if ((Atom) event->xproperty.atom == xfc->WM_STATE)
{
status = xf_GetWindowProperty(xfi, event->xproperty.window, xfi->WM_STATE, 1, &nitems, &bytes, &prop);
status = xf_GetWindowProperty(xfc, event->xproperty.window, xfc->WM_STATE, 1, &nitems, &bytes, &prop);
if (!status)
{
@ -790,51 +790,51 @@ static BOOL xf_event_PropertyNotify(xfInfo* xfi, XEvent* event, BOOL app)
}
if (maxVert && maxHorz && !minimized && (xfi->window->rail_state != WINDOW_SHOW_MAXIMIZED))
if (maxVert && maxHorz && !minimized && (xfc->window->rail_state != WINDOW_SHOW_MAXIMIZED))
{
DEBUG_X11_LMS("Send SC_MAXIMIZE command to rail server.");
xfi->window->rail_state = WINDOW_SHOW_MAXIMIZED;
xf_rail_send_client_system_command(xfi, window->windowId, SC_MAXIMIZE);
xfc->window->rail_state = WINDOW_SHOW_MAXIMIZED;
xf_rail_send_client_system_command(xfc, window->windowId, SC_MAXIMIZE);
}
else if (minimized && (xfi->window->rail_state != WINDOW_SHOW_MINIMIZED))
else if (minimized && (xfc->window->rail_state != WINDOW_SHOW_MINIMIZED))
{
DEBUG_X11_LMS("Send SC_MINIMIZE command to rail server.");
xfi->window->rail_state = WINDOW_SHOW_MINIMIZED;
xf_rail_send_client_system_command(xfi, window->windowId, SC_MINIMIZE);
xfc->window->rail_state = WINDOW_SHOW_MINIMIZED;
xf_rail_send_client_system_command(xfc, window->windowId, SC_MINIMIZE);
}
else if (!minimized && !maxVert && !maxHorz && (xfi->window->rail_state != WINDOW_SHOW))
else if (!minimized && !maxVert && !maxHorz && (xfc->window->rail_state != WINDOW_SHOW))
{
DEBUG_X11_LMS("Send SC_RESTORE command to rail server");
xfi->window->rail_state = WINDOW_SHOW;
xf_rail_send_client_system_command(xfi, window->windowId, SC_RESTORE);
xfc->window->rail_state = WINDOW_SHOW;
xf_rail_send_client_system_command(xfc, window->windowId, SC_RESTORE);
}
}
}
else
{
if (xf_cliprdr_process_property_notify(xfi, event))
if (xf_cliprdr_process_property_notify(xfc, event))
return TRUE;
}
return TRUE;
}
static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*event)
static BOOL xf_event_suppress_events(xfContext* xfc, rdpWindow* window, XEvent*event)
{
if (!xfi->remote_app)
if (!xfc->remote_app)
return FALSE;
switch (xfi->window->local_move.state)
switch (xfc->window->local_move.state)
{
case LMS_NOT_ACTIVE:
/* No local move in progress, nothing to do */
/* Prevent Configure from happening during indeterminant state of Horz or Vert Max only */
if ( (event->type == ConfigureNotify) && xfi->window->rail_ignore_configure)
if ( (event->type == ConfigureNotify) && xfc->window->rail_ignore_configure)
{
DEBUG_X11_LMS("ConfigureNotify Event Ignored");
xfi->window->rail_ignore_configure = FALSE;
xfc->window->rail_ignore_configure = FALSE;
return TRUE;
}
@ -846,7 +846,7 @@ static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*even
{
case ConfigureNotify:
/* Starting to see move events from the X server. Local move is now in progress. */
xfi->window->local_move.state = LMS_ACTIVE;
xfc->window->local_move.state = LMS_ACTIVE;
/* Allow these events to be processed during move to keep our state up to date. */
break;
@ -886,7 +886,7 @@ static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*even
default:
DEBUG_X11_LMS("Event Type to break LMS: %s", X11_EVENT_STRINGS[event->type]);
/* Any other event terminates move */
xf_rail_end_local_move(xfi, window);
xf_rail_end_local_move(xfc, window);
break;
}
break;
@ -903,20 +903,20 @@ static BOOL xf_event_suppress_events(xfInfo *xfi, rdpWindow *window, XEvent*even
BOOL xf_event_process(freerdp* instance, XEvent* event)
{
BOOL status = TRUE;
xfInfo* xfi = ((xfContext*) instance->context)->xfi;
rdpRail* rail = ((rdpContext*) xfi->context)->rail;
rdpWindow* window;
xfContext* xfc = (xfContext*) instance->context;
rdpRail* rail = ((rdpContext*) xfc)->rail;
if (xfi->remote_app)
if (xfc->remote_app)
{
window = window_list_get_by_extra_id(rail->list, (void*) event->xexpose.window);
if (window)
{
/* Update "current" window for cursor change orders */
xfi->window = (xfWindow*) window->extra;
xfc->window = (xfWindow*) window->extra;
if (xf_event_suppress_events(xfi, window, event))
if (xf_event_suppress_events(xfc, window, event))
return TRUE;
}
}
@ -927,47 +927,47 @@ BOOL xf_event_process(freerdp* instance, XEvent* event)
switch (event->type)
{
case Expose:
status = xf_event_Expose(xfi, event, xfi->remote_app);
status = xf_event_Expose(xfc, event, xfc->remote_app);
break;
case VisibilityNotify:
status = xf_event_VisibilityNotify(xfi, event, xfi->remote_app);
status = xf_event_VisibilityNotify(xfc, event, xfc->remote_app);
break;
case MotionNotify:
status = xf_event_MotionNotify(xfi, event, xfi->remote_app);
status = xf_event_MotionNotify(xfc, event, xfc->remote_app);
break;
case ButtonPress:
status = xf_event_ButtonPress(xfi, event, xfi->remote_app);
status = xf_event_ButtonPress(xfc, event, xfc->remote_app);
break;
case ButtonRelease:
status = xf_event_ButtonRelease(xfi, event, xfi->remote_app);
status = xf_event_ButtonRelease(xfc, event, xfc->remote_app);
break;
case KeyPress:
status = xf_event_KeyPress(xfi, event, xfi->remote_app);
status = xf_event_KeyPress(xfc, event, xfc->remote_app);
break;
case KeyRelease:
status = xf_event_KeyRelease(xfi, event, xfi->remote_app);
status = xf_event_KeyRelease(xfc, event, xfc->remote_app);
break;
case FocusIn:
status = xf_event_FocusIn(xfi, event, xfi->remote_app);
status = xf_event_FocusIn(xfc, event, xfc->remote_app);
break;
case FocusOut:
status = xf_event_FocusOut(xfi, event, xfi->remote_app);
status = xf_event_FocusOut(xfc, event, xfc->remote_app);
break;
case EnterNotify:
status = xf_event_EnterNotify(xfi, event, xfi->remote_app);
status = xf_event_EnterNotify(xfc, event, xfc->remote_app);
break;
case LeaveNotify:
status = xf_event_LeaveNotify(xfi, event, xfi->remote_app);
status = xf_event_LeaveNotify(xfc, event, xfc->remote_app);
break;
case NoExpose:
@ -977,48 +977,48 @@ BOOL xf_event_process(freerdp* instance, XEvent* event)
break;
case ConfigureNotify:
status = xf_event_ConfigureNotify(xfi, event, xfi->remote_app);
status = xf_event_ConfigureNotify(xfc, event, xfc->remote_app);
break;
case MapNotify:
status = xf_event_MapNotify(xfi, event, xfi->remote_app);
status = xf_event_MapNotify(xfc, event, xfc->remote_app);
break;
case UnmapNotify:
status = xf_event_UnmapNotify(xfi, event, xfi->remote_app);
status = xf_event_UnmapNotify(xfc, event, xfc->remote_app);
break;
case ReparentNotify:
break;
case MappingNotify:
status = xf_event_MappingNotify(xfi, event, xfi->remote_app);
status = xf_event_MappingNotify(xfc, event, xfc->remote_app);
break;
case ClientMessage:
status = xf_event_ClientMessage(xfi, event, xfi->remote_app);
status = xf_event_ClientMessage(xfc, event, xfc->remote_app);
break;
case SelectionNotify:
status = xf_event_SelectionNotify(xfi, event, xfi->remote_app);
status = xf_event_SelectionNotify(xfc, event, xfc->remote_app);
break;
case SelectionRequest:
status = xf_event_SelectionRequest(xfi, event, xfi->remote_app);
status = xf_event_SelectionRequest(xfc, event, xfc->remote_app);
break;
case SelectionClear:
status = xf_event_SelectionClear(xfi, event, xfi->remote_app);
status = xf_event_SelectionClear(xfc, event, xfc->remote_app);
break;
case PropertyNotify:
status = xf_event_PropertyNotify(xfi, event, xfi->remote_app);
status = xf_event_PropertyNotify(xfc, event, xfc->remote_app);
break;
}
xf_input_handle_event(xfi, event);
xf_input_handle_event(xfc, event);
XSync(xfi->display, FALSE);
XSync(xfc->display, FALSE);
return status;
}

View File

@ -26,6 +26,6 @@
#include "xfreerdp.h"
BOOL xf_event_process(freerdp* instance, XEvent* event);
void xf_event_SendClientEvent(xfInfo *xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...);
void xf_event_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsigned int numArgs, ...);
#endif /* __XF_EVENT_H */

File diff suppressed because it is too large Load Diff

View File

@ -43,25 +43,24 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
BYTE* data;
Pixmap pixmap;
XImage* image;
xfContext* context_ = (xfContext*) context;
xfInfo* xfi = context_->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
XSetFunction(xfi->display, xfi->gc, GXcopy);
pixmap = XCreatePixmap(xfi->display, xfi->drawable, bitmap->width, bitmap->height, xfi->depth);
XSetFunction(xfc->display, xfc->gc, GXcopy);
pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width, bitmap->height, xfc->depth);
if (bitmap->data != NULL)
{
data = freerdp_image_convert(bitmap->data, NULL,
bitmap->width, bitmap->height, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);
bitmap->width, bitmap->height, context->settings->ColorDepth, xfc->bpp, xfc->clrconv);
if (bitmap->ephemeral != TRUE)
{
image = XCreateImage(xfi->display, xfi->visual, xfi->depth,
ZPixmap, 0, (char*) data, bitmap->width, bitmap->height, xfi->scanline_pad, 0);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
ZPixmap, 0, (char*) data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);
XPutImage(xfi->display, pixmap, xfi->gc, image, 0, 0, 0, 0, bitmap->width, bitmap->height);
XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width, bitmap->height);
XFree(image);
if (data != bitmap->data)
@ -78,45 +77,45 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
((xfBitmap*) bitmap)->pixmap = pixmap;
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
{
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (((xfBitmap*) bitmap)->pixmap != 0)
XFreePixmap(xfi->display, ((xfBitmap*) bitmap)->pixmap);
XFreePixmap(xfc->display, ((xfBitmap*) bitmap)->pixmap);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
XImage* image;
int width, height;
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
width = bitmap->right - bitmap->left + 1;
height = bitmap->bottom - bitmap->top + 1;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFunction(xfc->display, xfc->gc, GXcopy);
image = XCreateImage(xfi->display, xfi->visual, xfi->depth,
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfi->scanline_pad, 0);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height, xfc->scanline_pad, 0);
XPutImage(xfi->display, xfi->primary, xfi->gc,
XPutImage(xfc->display, xfc->primary, xfc->gc,
image, 0, 0, bitmap->left, bitmap->top, width, height);
XFree(image);
gdi_InvalidateRegion(xfi->hdc, bitmap->left, bitmap->top, width, height);
gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
@ -128,11 +127,9 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
BYTE* dst;
int yindex;
int xindex;
xfInfo* xfi;
BOOL status;
RFX_MESSAGE* msg;
xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
size = width * height * (bpp + 7) / 8;
@ -148,8 +145,8 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
break;
case RDP_CODEC_ID_REMOTEFX:
rfx_context_set_pixel_format(xfi->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
msg = rfx_process_message(xfi->rfx_context, data, length);
rfx_context_set_pixel_format(xfc->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
msg = rfx_process_message(xfc->rfx_context, data, length);
if (msg == NULL)
{
@ -169,7 +166,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
src++;
}
}
rfx_message_free(xfi->rfx_context, msg);
rfx_message_free(xfc->rfx_context, msg);
}
break;
@ -204,16 +201,16 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
void xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (primary)
xfi->drawing = xfi->primary;
xfc->drawing = xfc->primary;
else
xfi->drawing = ((xfBitmap*) bitmap)->pixmap;
xfc->drawing = ((xfBitmap*) bitmap)->pixmap;
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
/* Pointer Class */
@ -222,9 +219,9 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
XcursorImage ci;
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
ZeroMemory(&ci, sizeof(ci));
ci.version = XCURSOR_IMAGE_VERSION;
@ -240,54 +237,54 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
if ((pointer->andMaskData != 0) && (pointer->xorMaskData != 0))
{
freerdp_alpha_cursor_convert((BYTE*) (ci.pixels), pointer->xorMaskData, pointer->andMaskData,
pointer->width, pointer->height, pointer->xorBpp, xfi->clrconv);
pointer->width, pointer->height, pointer->xorBpp, xfc->clrconv);
}
((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci);
((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfc->display, &ci);
free(ci.pixels);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
#endif
}
void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (((xfPointer*) pointer)->cursor != 0)
XFreeCursor(xfi->display, ((xfPointer*) pointer)->cursor);
XFreeCursor(xfc->display, ((xfPointer*) pointer)->cursor);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
#endif
}
void xf_Pointer_Set(rdpContext* context, rdpPointer* pointer)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
/* in RemoteApp mode, window can be null if none has had focus */
if (xfi->window != NULL)
XDefineCursor(xfi->display, xfi->window->handle, ((xfPointer*) pointer)->cursor);
if (xfc->window != NULL)
XDefineCursor(xfc->display, xfc->window->handle, ((xfPointer*) pointer)->cursor);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
#endif
}
void xf_Pointer_SetNull(rdpContext* context)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
static Cursor nullcursor = None;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (nullcursor == None)
{
@ -299,27 +296,27 @@ void xf_Pointer_SetNull(rdpContext* context)
ci.width = ci.height = 1;
ci.xhot = ci.yhot = 0;
ci.pixels = &xp;
nullcursor = XcursorImageLoadCursor(xfi->display, &ci);
nullcursor = XcursorImageLoadCursor(xfc->display, &ci);
}
if (xfi->window != NULL && nullcursor != None)
XDefineCursor(xfi->display, xfi->window->handle, nullcursor);
if (xfc->window != NULL && nullcursor != None)
XDefineCursor(xfc->display, xfc->window->handle, nullcursor);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
#endif
}
void xf_Pointer_SetDefault(rdpContext* context)
{
#ifdef WITH_XCURSOR
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (xfi->window != NULL)
XUndefineCursor(xfi->display, xfi->window->handle);
if (xfc->window != NULL)
XUndefineCursor(xfc->display, xfc->window->handle);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
#endif
}
@ -327,101 +324,100 @@ void xf_Pointer_SetDefault(rdpContext* context)
void xf_Glyph_New(rdpContext* context, rdpGlyph* glyph)
{
xfInfo* xfi;
int scanline;
XImage* image;
xfGlyph* xf_glyph;
xf_glyph = (xfGlyph*) glyph;
xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
scanline = (glyph->cx + 7) / 8;
xf_glyph->pixmap = XCreatePixmap(xfi->display, xfi->drawing, glyph->cx, glyph->cy, 1);
xf_glyph->pixmap = XCreatePixmap(xfc->display, xfc->drawing, glyph->cx, glyph->cy, 1);
image = XCreateImage(xfi->display, xfi->visual, 1,
image = XCreateImage(xfc->display, xfc->visual, 1,
ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
image->byte_order = MSBFirst;
image->bitmap_bit_order = MSBFirst;
XInitImage(image);
XPutImage(xfi->display, xf_glyph->pixmap, xfi->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(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Glyph_Free(rdpContext* context, rdpGlyph* glyph)
{
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (((xfGlyph*) glyph)->pixmap != 0)
XFreePixmap(xfi->display, ((xfGlyph*) glyph)->pixmap);
XFreePixmap(xfc->display, ((xfGlyph*) glyph)->pixmap);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Glyph_Draw(rdpContext* context, rdpGlyph* glyph, int x, int y)
{
xfGlyph* xf_glyph;
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_glyph = (xfGlyph*) glyph;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
XSetStipple(xfi->display, xfi->gc, xf_glyph->pixmap);
XSetTSOrigin(xfi->display, xfi->gc, x, y);
XFillRectangle(xfi->display, xfi->drawing, xfi->gc, x, y, glyph->cx, glyph->cy);
XSetStipple(xfi->display, xfi->gc, xfi->bitmap_mono);
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(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
{
xfContext* context_ = (xfContext*) context;
xfInfo* xfi = context_->xfi;
xfContext* xfc = (xfContext*) context;
bgcolor = (xfi->clrconv->invert)?
freerdp_color_convert_var_bgr(bgcolor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv):
freerdp_color_convert_var_rgb(bgcolor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);
bgcolor = (xfc->clrconv->invert)?
freerdp_color_convert_var_bgr(bgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv):
freerdp_color_convert_var_rgb(bgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv);
fgcolor = (xfi->clrconv->invert)?
freerdp_color_convert_var_bgr(fgcolor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv):
freerdp_color_convert_var_rgb(fgcolor, context_->settings->ColorDepth, xfi->bpp, xfi->clrconv);
fgcolor = (xfc->clrconv->invert)?
freerdp_color_convert_var_bgr(fgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv):
freerdp_color_convert_var_rgb(fgcolor, context_->settings->ColorDepth, xfc->bpp, xfc->clrconv);
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
XSetForeground(xfi->display, xfi->gc, fgcolor);
XFillRectangle(xfi->display, xfi->drawing, xfi->gc, x, y, width, height);
XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, fgcolor);
XFillRectangle(xfc->display, xfc->drawing, xfc->gc, x, y, width, height);
XSetForeground(xfi->display, xfi->gc, bgcolor);
XSetBackground(xfi->display, xfi->gc, fgcolor);
XSetFillStyle(xfi->display, xfi->gc, FillStippled);
XSetForeground(xfc->display, xfc->gc, bgcolor);
XSetBackground(xfc->display, xfc->gc, fgcolor);
XSetFillStyle(xfc->display, xfc->gc, FillStippled);
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
void xf_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height, UINT32 bgcolor, UINT32 fgcolor)
{
xfInfo* xfi = ((xfContext*) context)->xfi;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfi, FALSE);
xf_lock_x11(xfc, FALSE);
if (xfi->drawing == xfi->primary)
if (xfc->drawing == xfc->primary)
{
gdi_InvalidateRegion(xfi->hdc, x, y, width, height);
gdi_InvalidateRegion(xfc->hdc, x, y, width, height);
}
xf_unlock_x11(xfi, FALSE);
xf_unlock_x11(xfc, FALSE);
}
/* Graphics Module */

View File

@ -54,7 +54,7 @@ double z_vector;
int xinput_opcode;
int scale_cnt;
int xf_input_init(xfInfo* xfi, Window window)
int xf_input_init(xfContext* xfc, Window window)
{
int i, j;
int nmasks;
@ -72,15 +72,15 @@ int xf_input_init(xfInfo* xfi, Window window)
active_contacts = 0;
ZeroMemory(contacts, sizeof(touchContact) * MAX_CONTACTS);
if (!XQueryExtension(xfi->display, "XInputExtension", &opcode, &event, &error))
if (!XQueryExtension(xfc->display, "XInputExtension", &opcode, &event, &error))
{
printf("XInput extension not available.\n");
return -1;
}
xfi->XInputOpcode = opcode;
xfc->XInputOpcode = opcode;
XIQueryVersion(xfi->display, &major, &minor);
XIQueryVersion(xfc->display, &major, &minor);
if (major * 1000 + minor < 2002)
{
@ -88,7 +88,7 @@ int xf_input_init(xfInfo* xfi, Window window)
return -1;
}
info = XIQueryDevice(xfi->display, XIAllDevices, &ndevices);
info = XIQueryDevice(xfc->display, XIAllDevices, &ndevices);
for (i = 0; i < ndevices; i++)
{
@ -125,7 +125,7 @@ int xf_input_init(xfInfo* xfi, Window window)
}
if (nmasks > 0)
xstatus = XISelectEvents(xfi->display, window, evmasks, nmasks);
xstatus = XISelectEvents(xfc->display, window, evmasks, nmasks);
return 0;
}
@ -151,7 +151,7 @@ void xf_input_save_last_event(XIDeviceEvent* event)
lastEvent.event_y = event->event_y;
}
void xf_input_detect_pinch(xfInfo* xfi)
void xf_input_detect_pinch(xfContext* xfc)
{
double dist;
double zoom;
@ -189,33 +189,33 @@ void xf_input_detect_pinch(xfInfo* xfi)
if (z_vector > 10)
{
xfi->scale -= 0.05;
xfc->scale -= 0.05;
if (xfi->scale < 0.5)
xfi->scale = 0.5;
if (xfc->scale < 0.5)
xfc->scale = 0.5;
XResizeWindow(xfi->display, xfi->window->handle, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
XResizeWindow(xfc->display, xfc->window->handle, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
IFCALL(xfc->client->OnResizeWindow, xfc->instance, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
z_vector = 0;
}
if (z_vector < -10)
{
xfi->scale += 0.05;
xfc->scale += 0.05;
if (xfi->scale > 1.5)
xfi->scale = 1.5;
if (xfc->scale > 1.5)
xfc->scale = 1.5;
XResizeWindow(xfi->display, xfi->window->handle, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
IFCALL(xfi->client->OnResizeWindow, xfi->instance, xfi->originalWidth * xfi->scale, xfi->originalHeight * xfi->scale);
XResizeWindow(xfc->display, xfc->window->handle, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
IFCALL(xfc->client->OnResizeWindow, xfc->instance, xfc->originalWidth * xfc->scale, xfc->originalHeight * xfc->scale);
z_vector = 0;
}
}
}
void xf_input_touch_begin(xfInfo* xfi, XIDeviceEvent* event)
void xf_input_touch_begin(xfContext* xfc, XIDeviceEvent* event)
{
int i;
@ -234,7 +234,7 @@ void xf_input_touch_begin(xfInfo* xfi, XIDeviceEvent* event)
}
}
void xf_input_touch_update(xfInfo* xfi, XIDeviceEvent* event)
void xf_input_touch_update(xfContext* xfc, XIDeviceEvent* event)
{
int i;
@ -248,14 +248,14 @@ void xf_input_touch_update(xfInfo* xfi, XIDeviceEvent* event)
contacts[i].pos_x = event->event_x;
contacts[i].pos_y = event->event_y;
xf_input_detect_pinch(xfi);
xf_input_detect_pinch(xfc);
break;
}
}
}
void xf_input_touch_end(xfInfo* xfi, XIDeviceEvent* event)
void xf_input_touch_end(xfContext* xfc, XIDeviceEvent* event)
{
int i;
@ -274,31 +274,31 @@ void xf_input_touch_end(xfInfo* xfi, XIDeviceEvent* event)
}
}
int xf_input_handle_event_local(xfInfo* xfi, XEvent* event)
int xf_input_handle_event_local(xfContext* xfc, XEvent* event)
{
XGenericEventCookie* cookie = &event->xcookie;
XGetEventData(xfi->display, cookie);
XGetEventData(xfc->display, cookie);
if ((cookie->type == GenericEvent) && (cookie->extension == xfi->XInputOpcode))
if ((cookie->type == GenericEvent) && (cookie->extension == xfc->XInputOpcode))
{
switch (cookie->evtype)
{
case XI_TouchBegin:
if (xf_input_is_duplicate(cookie->data) == FALSE)
xf_input_touch_begin(xfi, cookie->data);
xf_input_touch_begin(xfc, cookie->data);
xf_input_save_last_event(cookie->data);
break;
case XI_TouchUpdate:
if (xf_input_is_duplicate(cookie->data) == FALSE)
xf_input_touch_update(xfi, cookie->data);
xf_input_touch_update(xfc, cookie->data);
xf_input_save_last_event(cookie->data);
break;
case XI_TouchEnd:
if (xf_input_is_duplicate(cookie->data) == FALSE)
xf_input_touch_end(xfi, cookie->data);
xf_input_touch_end(xfc, cookie->data);
xf_input_save_last_event(cookie->data);
break;
@ -308,7 +308,7 @@ int xf_input_handle_event_local(xfInfo* xfi, XEvent* event)
}
}
XFreeEventData(xfi->display,cookie);
XFreeEventData(xfc->display,cookie);
return 0;
}
@ -325,12 +325,12 @@ char* xf_input_touch_state_string(DWORD flags)
return "TouchUnknown";
}
int xf_input_touch_remote(xfInfo* xfi, XIDeviceEvent* event, int evtype)
int xf_input_touch_remote(xfContext* xfc, XIDeviceEvent* event, int evtype)
{
int x, y;
int touchId;
int contactId;
RdpeiClientContext* rdpei = xfi->rdpei;
RdpeiClientContext* rdpei = xfc->rdpei;
if (!rdpei)
return 0;
@ -358,26 +358,26 @@ int xf_input_touch_remote(xfInfo* xfi, XIDeviceEvent* event, int evtype)
return 0;
}
int xf_input_handle_event_remote(xfInfo* xfi, XEvent* event)
int xf_input_handle_event_remote(xfContext* xfc, XEvent* event)
{
XGenericEventCookie* cookie = &event->xcookie;
XGetEventData(xfi->display, cookie);
XGetEventData(xfc->display, cookie);
if ((cookie->type == GenericEvent) && (cookie->extension == xfi->XInputOpcode))
if ((cookie->type == GenericEvent) && (cookie->extension == xfc->XInputOpcode))
{
switch (cookie->evtype)
{
case XI_TouchBegin:
xf_input_touch_remote(xfi, cookie->data, XI_TouchBegin);
xf_input_touch_remote(xfc, cookie->data, XI_TouchBegin);
break;
case XI_TouchUpdate:
xf_input_touch_remote(xfi, cookie->data, XI_TouchUpdate);
xf_input_touch_remote(xfc, cookie->data, XI_TouchUpdate);
break;
case XI_TouchEnd:
xf_input_touch_remote(xfi, cookie->data, XI_TouchEnd);
xf_input_touch_remote(xfc, cookie->data, XI_TouchEnd);
break;
default:
@ -385,21 +385,21 @@ int xf_input_handle_event_remote(xfInfo* xfi, XEvent* event)
}
}
XFreeEventData(xfi->display,cookie);
XFreeEventData(xfc->display,cookie);
return 0;
}
#else
int xf_input_init(xfInfo* xfi, Window window)
int xf_input_init(xfContext* xfc, Window window)
{
return 0;
}
#endif
void xf_process_rdpei_event(xfInfo* xfi, wMessage* event)
void xf_process_rdpei_event(xfContext* xfc, wMessage* event)
{
switch (GetMessageType(event->id))
{
@ -414,16 +414,16 @@ void xf_process_rdpei_event(xfInfo* xfi, wMessage* event)
}
}
int xf_input_handle_event(xfInfo* xfi, XEvent* event)
int xf_input_handle_event(xfContext* xfc, XEvent* event)
{
#ifdef WITH_XI
if (xfi->settings->MultiTouchInput)
if (xfc->settings->MultiTouchInput)
{
return xf_input_handle_event_remote(xfi, event);
return xf_input_handle_event_remote(xfc, event);
}
if (xfi->enableScaling)
return xf_input_handle_event_local(xfi, event);
if (xfc->enableScaling)
return xf_input_handle_event_local(xfc, event);
#endif
return 0;

View File

@ -27,9 +27,9 @@
#include <X11/extensions/XInput2.h>
#endif
int xf_input_init(xfInfo* xfi, Window window);
int xf_input_init(xfContext* xfc, Window window);
int xf_input_handle_event(xfInfo* xfi, XEvent* event);
void xf_process_rdpei_event(xfInfo* xfi, wMessage* event);
int xf_input_handle_event(xfContext* xfc, XEvent* event);
void xf_process_rdpei_event(xfContext* xfc, wMessage* event);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,7 @@
#include <winpr/thread.h>
typedef struct xf_context xfInfo;
typedef struct xf_context xfContext;
#ifdef __cplusplus
extern "C" {
@ -44,22 +45,22 @@ extern "C" {
* Client Interface
*/
#define cfInfo xfInfo
#define cfInfo xfContext
FREERDP_API int freerdp_client_global_init();
FREERDP_API int freerdp_client_global_uninit();
FREERDP_API int freerdp_client_start(cfInfo* cfi);
FREERDP_API int freerdp_client_stop(cfInfo* cfi);
FREERDP_API int freerdp_client_start(cfInfo* cfc);
FREERDP_API int freerdp_client_stop(cfInfo* cfc);
FREERDP_API freerdp* freerdp_client_get_instance(cfInfo* cfi);
FREERDP_API HANDLE freerdp_client_get_thread(cfInfo* cfi);
FREERDP_API rdpClient* freerdp_client_get_interface(cfInfo* cfi);
FREERDP_API double freerdp_client_get_scale(xfInfo* xfi);
FREERDP_API void freerdp_client_reset_scale(xfInfo* xfi);
FREERDP_API freerdp* freerdp_client_get_instance(cfInfo* cfc);
FREERDP_API HANDLE freerdp_client_get_thread(cfInfo* cfc);
FREERDP_API rdpClient* freerdp_client_get_interface(cfInfo* cfc);
FREERDP_API double freerdp_client_get_scale(cfInfo* cfc);
FREERDP_API void freerdp_client_reset_scale(cfInfo* cfc);
FREERDP_API cfInfo* freerdp_client_new(int argc, char** argv);
FREERDP_API void freerdp_client_free(cfInfo* cfi);
FREERDP_API void freerdp_client_free(cfInfo* cfc);
#ifdef __cplusplus
}

View File

@ -35,64 +35,64 @@
#include "xf_keyboard.h"
void xf_kbd_init(xfInfo* xfi)
void xf_kbd_init(xfContext* xfc)
{
xf_kbd_clear(xfi);
xfi->keyboard_layout_id = xfi->instance->settings->KeyboardLayout;
xfi->keyboard_layout_id = freerdp_keyboard_init(xfi->keyboard_layout_id);
xfi->instance->settings->KeyboardLayout = xfi->keyboard_layout_id;
xfi->modifier_map = XGetModifierMapping(xfi->display);
xf_kbd_clear(xfc);
xfc->keyboard_layout_id = xfc->instance->settings->KeyboardLayout;
xfc->keyboard_layout_id = freerdp_keyboard_init(xfc->keyboard_layout_id);
xfc->instance->settings->KeyboardLayout = xfc->keyboard_layout_id;
xfc->modifier_map = XGetModifierMapping(xfc->display);
}
void xf_kbd_clear(xfInfo* xfi)
void xf_kbd_clear(xfContext* xfc)
{
ZeroMemory(xfi->pressed_keys, 256 * sizeof(BOOL));
ZeroMemory(xfc->pressed_keys, 256 * sizeof(BOOL));
}
void xf_kbd_set_keypress(xfInfo* xfi, BYTE keycode, KeySym keysym)
void xf_kbd_set_keypress(xfContext* xfc, BYTE keycode, KeySym keysym)
{
if (keycode >= 8)
xfi->pressed_keys[keycode] = keysym;
xfc->pressed_keys[keycode] = keysym;
else
return;
}
void xf_kbd_unset_keypress(xfInfo* xfi, BYTE keycode)
void xf_kbd_unset_keypress(xfContext* xfc, BYTE keycode)
{
if (keycode >= 8)
xfi->pressed_keys[keycode] = NoSymbol;
xfc->pressed_keys[keycode] = NoSymbol;
else
return;
}
void xf_kbd_release_all_keypress(xfInfo* xfi)
void xf_kbd_release_all_keypress(xfContext* xfc)
{
int keycode;
DWORD rdp_scancode;
for (keycode = 0; keycode < ARRAYSIZE(xfi->pressed_keys); keycode++)
for (keycode = 0; keycode < ARRAYSIZE(xfc->pressed_keys); keycode++)
{
if (xfi->pressed_keys[keycode] != NoSymbol)
if (xfc->pressed_keys[keycode] != NoSymbol)
{
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);
freerdp_input_send_keyboard_event_ex(xfi->instance->input, FALSE, rdp_scancode);
xfi->pressed_keys[keycode] = NoSymbol;
freerdp_input_send_keyboard_event_ex(xfc->instance->input, FALSE, rdp_scancode);
xfc->pressed_keys[keycode] = NoSymbol;
}
}
}
BOOL xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym)
BOOL xf_kbd_key_pressed(xfContext* xfc, KeySym keysym)
{
KeyCode keycode = XKeysymToKeycode(xfi->display, keysym);
return (xfi->pressed_keys[keycode] == keysym);
KeyCode keycode = XKeysymToKeycode(xfc->display, keysym);
return (xfc->pressed_keys[keycode] == keysym);
}
void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode)
void xf_kbd_send_key(xfContext* xfc, BOOL down, BYTE keycode)
{
DWORD rdp_scancode;
rdpInput* input;
input = xfi->instance->input;
input = xfc->instance->input;
rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);
if (rdp_scancode == RDP_SCANCODE_UNKNOWN)
@ -100,7 +100,7 @@ void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode)
fprintf(stderr, "Unknown key with X keycode 0x%02x\n", keycode);
}
else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
!xf_kbd_key_pressed(xfi, XK_Control_L) && !xf_kbd_key_pressed(xfi, XK_Control_R))
!xf_kbd_key_pressed(xfc, XK_Control_L) && !xf_kbd_key_pressed(xfc, XK_Control_R))
{
/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
if (down)
@ -118,47 +118,47 @@ void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode)
if ((rdp_scancode == RDP_SCANCODE_CAPSLOCK) && (down == FALSE))
{
UINT32 syncFlags;
syncFlags = xf_kbd_get_toggle_keys_state(xfi);
syncFlags = xf_kbd_get_toggle_keys_state(xfc);
input->SynchronizeEvent(input, syncFlags);
}
}
}
int xf_kbd_read_keyboard_state(xfInfo* xfi)
int xf_kbd_read_keyboard_state(xfContext* xfc)
{
int dummy;
Window wdummy;
UINT32 state = 0;
if (!xfi->remote_app)
if (!xfc->remote_app)
{
XQueryPointer(xfi->display, xfi->window->handle,
XQueryPointer(xfc->display, xfc->window->handle,
&wdummy, &wdummy, &dummy, &dummy, &dummy, &dummy, &state);
}
else
{
XQueryPointer(xfi->display, DefaultRootWindow(xfi->display),
XQueryPointer(xfc->display, DefaultRootWindow(xfc->display),
&wdummy, &wdummy, &dummy, &dummy, &dummy, &dummy, &state);
}
return state;
}
BOOL xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym)
BOOL xf_kbd_get_key_state(xfContext* xfc, int state, int keysym)
{
int offset;
int modifierpos, key, keysymMask = 0;
KeyCode keycode = XKeysymToKeycode(xfi->display, keysym);
KeyCode keycode = XKeysymToKeycode(xfc->display, keysym);
if (keycode == NoSymbol)
return FALSE;
for (modifierpos = 0; modifierpos < 8; modifierpos++)
{
offset = xfi->modifier_map->max_keypermod * modifierpos;
offset = xfc->modifier_map->max_keypermod * modifierpos;
for (key = 0; key < xfi->modifier_map->max_keypermod; key++)
for (key = 0; key < xfc->modifier_map->max_keypermod; key++)
{
if (xfi->modifier_map->modifiermap[offset + key] == keycode)
if (xfc->modifier_map->modifiermap[offset + key] == keycode)
{
keysymMask |= 1 << modifierpos;
}
@ -168,26 +168,26 @@ BOOL xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym)
return (state & keysymMask) ? TRUE : FALSE;
}
int xf_kbd_get_toggle_keys_state(xfInfo* xfi)
int xf_kbd_get_toggle_keys_state(xfContext* xfc)
{
int state;
int toggle_keys_state = 0;
state = xf_kbd_read_keyboard_state(xfi);
state = xf_kbd_read_keyboard_state(xfc);
if (xf_kbd_get_key_state(xfi, state, XK_Scroll_Lock))
if (xf_kbd_get_key_state(xfc, state, XK_Scroll_Lock))
toggle_keys_state |= KBD_SYNC_SCROLL_LOCK;
if (xf_kbd_get_key_state(xfi, state, XK_Num_Lock))
if (xf_kbd_get_key_state(xfc, state, XK_Num_Lock))
toggle_keys_state |= KBD_SYNC_NUM_LOCK;
if (xf_kbd_get_key_state(xfi, state, XK_Caps_Lock))
if (xf_kbd_get_key_state(xfc, state, XK_Caps_Lock))
toggle_keys_state |= KBD_SYNC_CAPS_LOCK;
if (xf_kbd_get_key_state(xfi, state, XK_Kana_Lock))
if (xf_kbd_get_key_state(xfc, state, XK_Kana_Lock))
toggle_keys_state |= KBD_SYNC_KANA_LOCK;
return toggle_keys_state;
}
void xf_kbd_focus_in(xfInfo* xfi)
void xf_kbd_focus_in(xfContext* xfc)
{
rdpInput* input;
UINT32 syncFlags;
@ -195,24 +195,24 @@ void xf_kbd_focus_in(xfInfo* xfi)
Window wdummy;
UINT32 state = 0;
if (xfi->display && xfi->window)
if (xfc->display && xfc->window)
{
input = xfi->instance->input;
syncFlags = xf_kbd_get_toggle_keys_state(xfi);
XQueryPointer(xfi->display, xfi->window->handle, &wdummy, &wdummy, &mouseX, &mouseY, &dummy, &dummy, &state);
input = xfc->instance->input;
syncFlags = xf_kbd_get_toggle_keys_state(xfc);
XQueryPointer(xfc->display, xfc->window->handle, &wdummy, &wdummy, &mouseX, &mouseY, &dummy, &dummy, &state);
input->FocusInEvent(input, syncFlags, mouseX, mouseY);
}
}
BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym)
BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym)
{
if (keysym == XK_Return)
{
if ((xf_kbd_key_pressed(xfi, XK_Alt_L) || xf_kbd_key_pressed(xfi, XK_Alt_R))
&& (xf_kbd_key_pressed(xfi, XK_Control_L) || xf_kbd_key_pressed(xfi, XK_Control_R)))
if ((xf_kbd_key_pressed(xfc, XK_Alt_L) || xf_kbd_key_pressed(xfc, XK_Alt_R))
&& (xf_kbd_key_pressed(xfc, XK_Control_L) || xf_kbd_key_pressed(xfc, XK_Control_R)))
{
/* Ctrl-Alt-Enter: toggle full screen */
xf_toggle_fullscreen(xfi);
xf_toggle_fullscreen(xfc);
return TRUE;
}
}

View File

@ -25,17 +25,17 @@
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_kbd_init(xfInfo* xfi);
void xf_kbd_clear(xfInfo* xfi);
void xf_kbd_set_keypress(xfInfo* xfi, BYTE keycode, KeySym keysym);
void xf_kbd_unset_keypress(xfInfo* xfi, BYTE keycode);
void xf_kbd_release_all_keypress(xfInfo* xfi);
BOOL xf_kbd_key_pressed(xfInfo* xfi, KeySym keysym);
void xf_kbd_send_key(xfInfo* xfi, BOOL down, BYTE keycode);
int xf_kbd_read_keyboard_state(xfInfo* xfi);
BOOL xf_kbd_get_key_state(xfInfo* xfi, int state, int keysym);
int xf_kbd_get_toggle_keys_state(xfInfo* xfi);
void xf_kbd_focus_in(xfInfo* xfi);
BOOL xf_kbd_handle_special_keys(xfInfo* xfi, KeySym keysym);
void xf_kbd_init(xfContext* xfc);
void xf_kbd_clear(xfContext* xfc);
void xf_kbd_set_keypress(xfContext* xfc, BYTE keycode, KeySym keysym);
void xf_kbd_unset_keypress(xfContext* xfc, BYTE keycode);
void xf_kbd_release_all_keypress(xfContext* xfc);
BOOL xf_kbd_key_pressed(xfContext* xfc, KeySym keysym);
void xf_kbd_send_key(xfContext* xfc, BOOL down, BYTE keycode);
int xf_kbd_read_keyboard_state(xfContext* xfc);
BOOL xf_kbd_get_key_state(xfContext* xfc, int state, int keysym);
int xf_kbd_get_toggle_keys_state(xfContext* xfc);
void xf_kbd_focus_in(xfContext* xfc);
BOOL xf_kbd_handle_special_keys(xfContext* xfc, KeySym keysym);
#endif /* __XF_KEYBOARD_H */

View File

@ -37,7 +37,7 @@
/* See MSDN Section on Multiple Display Monitors: http://msdn.microsoft.com/en-us/library/dd145071 */
int xf_list_monitors(xfInfo* xfi)
int xf_list_monitors(xfContext* xfc)
{
#ifdef WITH_XINERAMA
Display* display;
@ -81,7 +81,7 @@ int xf_list_monitors(xfInfo* xfi)
return 0;
}
BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
BOOL xf_detect_monitors(xfContext* xfc, rdpSettings* settings)
{
int i, j;
int nmonitors;
@ -95,14 +95,14 @@ BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
XineramaScreenInfo* screen_info = NULL;
#endif
vscreen = &xfi->vscreen;
vscreen = &xfc->vscreen;
#ifdef WITH_XINERAMA
if (XineramaQueryExtension(xfi->display, &ignored, &ignored2))
if (XineramaQueryExtension(xfc->display, &ignored, &ignored2))
{
if (XineramaIsActive(xfi->display))
if (XineramaIsActive(xfc->display))
{
screen_info = XineramaQueryScreens(xfi->display, &vscreen->nmonitors);
screen_info = XineramaQueryScreens(xfc->display, &vscreen->nmonitors);
if (vscreen->nmonitors > 16)
vscreen->nmonitors = 0;
@ -129,39 +129,39 @@ BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
}
#endif
if (!xf_GetWorkArea(xfi))
if (!xf_GetWorkArea(xfc))
{
xfi->workArea.x = 0;
xfi->workArea.y = 0;
xfi->workArea.width = WidthOfScreen(xfi->screen);
xfi->workArea.height = HeightOfScreen(xfi->screen);
xfc->workArea.x = 0;
xfc->workArea.y = 0;
xfc->workArea.width = WidthOfScreen(xfc->screen);
xfc->workArea.height = HeightOfScreen(xfc->screen);
}
if (settings->Fullscreen)
{
settings->DesktopWidth = WidthOfScreen(xfi->screen);
settings->DesktopHeight = HeightOfScreen(xfi->screen);
settings->DesktopWidth = WidthOfScreen(xfc->screen);
settings->DesktopHeight = HeightOfScreen(xfc->screen);
maxWidth = settings->DesktopWidth;
maxHeight = settings->DesktopHeight;
}
else if (settings->Workarea)
{
settings->DesktopWidth = xfi->workArea.width;
settings->DesktopHeight = xfi->workArea.height;
settings->DesktopWidth = xfc->workArea.width;
settings->DesktopHeight = xfc->workArea.height;
maxWidth = settings->DesktopWidth;
maxHeight = settings->DesktopHeight;
}
else if (settings->PercentScreen)
{
settings->DesktopWidth = (xfi->workArea.width * settings->PercentScreen) / 100;
settings->DesktopHeight = (xfi->workArea.height * settings->PercentScreen) / 100;
settings->DesktopWidth = (xfc->workArea.width * settings->PercentScreen) / 100;
settings->DesktopHeight = (xfc->workArea.height * settings->PercentScreen) / 100;
maxWidth = settings->DesktopWidth;
maxHeight = settings->DesktopHeight;
}
else
{
maxWidth = WidthOfScreen(xfi->screen);
maxHeight = HeightOfScreen(xfi->screen);
maxWidth = WidthOfScreen(xfc->screen);
maxHeight = HeightOfScreen(xfc->screen);
}
if (!settings->Fullscreen && !settings->Workarea && !settings->UseMultimon)
@ -240,8 +240,8 @@ BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings)
if (settings->Workarea)
{
vscreen->area.top = xfi->workArea.y;
vscreen->area.bottom = (vHeight - (vHeight - (xfi->workArea.height + xfi->workArea.y))) - 1;
vscreen->area.top = xfc->workArea.y;
vscreen->area.bottom = (vHeight - (vHeight - (xfc->workArea.height + xfc->workArea.y))) - 1;
}
if (nmonitors && !primaryMonitor)

View File

@ -43,7 +43,7 @@ typedef struct _VIRTUAL_SCREEN VIRTUAL_SCREEN;
#include "xf_interface.h"
#include "xfreerdp.h"
int xf_list_monitors(xfInfo* xfi);
BOOL xf_detect_monitors(xfInfo* xfi, rdpSettings* settings);
int xf_list_monitors(xfContext* xfc);
BOOL xf_detect_monitors(xfContext* xfc, rdpSettings* settings);
#endif /* __XF_MONITOR_H */

View File

@ -38,27 +38,27 @@
#define DEBUG_X11_LMS(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
void xf_rail_enable_remoteapp_mode(xfInfo* xfi)
void xf_rail_enable_remoteapp_mode(xfContext* xfc)
{
if (!xfi->remote_app)
if (!xfc->remote_app)
{
xfi->remote_app = TRUE;
xfi->drawable = DefaultRootWindow(xfi->display);
xf_DestroyWindow(xfi, xfi->window);
xfi->window = NULL;
xfc->remote_app = TRUE;
xfc->drawable = DefaultRootWindow(xfc->display);
xf_DestroyWindow(xfc, xfc->window);
xfc->window = NULL;
}
}
void xf_rail_disable_remoteapp_mode(xfInfo* xfi)
void xf_rail_disable_remoteapp_mode(xfContext* xfc)
{
if (xfi->remote_app)
if (xfc->remote_app)
{
xfi->remote_app = FALSE;
xf_create_window(xfi);
xfc->remote_app = FALSE;
xf_create_window(xfc);
}
}
void xf_rail_paint(xfInfo* xfi, 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)
{
xfWindow* xfw;
rdpWindow* window;
@ -100,36 +100,35 @@ void xf_rail_paint(xfInfo* xfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 u
if (intersect)
{
xf_UpdateWindowArea(xfi, xfw, ileft - wleft, itop - wtop, iwidth, iheight);
xf_UpdateWindowArea(xfc, xfw, ileft - wleft, itop - wtop, iwidth, iheight);
}
}
}
void xf_rail_DesktopNonMonitored(rdpRail *rail, rdpWindow* window)
{
xfInfo* xfi;
xfContext* xfc;
xfi = (xfInfo*) rail->extra;
xf_rail_disable_remoteapp_mode(xfi);
xfc = (xfContext*) rail->extra;
xf_rail_disable_remoteapp_mode(xfc);
}
static void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
{
xfInfo* xfi;
xfContext* xfc;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xf_rail_enable_remoteapp_mode(xfi);
xf_rail_enable_remoteapp_mode(xfc);
xfw = xf_CreateWindow((xfInfo*) rail->extra, window,
xfw = xf_CreateWindow(xfc, window,
window->windowOffsetX, window->windowOffsetY,
window->windowWidth, window->windowHeight,
window->windowId);
window->windowWidth, window->windowHeight, window->windowId);
xf_SetWindowStyle(xfi, xfw, window->style, window->extendedStyle);
xf_SetWindowStyle(xfc, xfw, window->style, window->extendedStyle);
xf_SetWindowText(xfi, xfw, window->title);
xf_SetWindowText(xfc, xfw, window->title);
window->extra = (void*) xfw;
window->extraId = (void*) xfw->handle;
@ -137,10 +136,10 @@ static void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
{
xfInfo* xfi;
xfContext* xfc;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
/*
@ -161,83 +160,87 @@ static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
* Just ensure entire window area is updated to handle cases where we
* have drawn locally before getting new bitmap from the server
*/
xf_UpdateWindowArea(xfi, xfw, 0, 0, window->windowWidth, window->windowHeight);
xf_UpdateWindowArea(xfc, xfw, 0, 0, window->windowWidth, window->windowHeight);
return;
}
xf_MoveWindow(xfi, xfw,
xf_MoveWindow(xfc, xfw,
window->visibleOffsetX, window->visibleOffsetY,
window->windowWidth, window->windowHeight);
}
static void xf_rail_ShowWindow(rdpRail* rail, rdpWindow* window, BYTE state)
{
xfInfo* xfi;
xfContext* xfc;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
xf_ShowWindow(xfi, xfw, state);
xf_ShowWindow(xfc, xfw, state);
}
static void xf_rail_SetWindowText(rdpRail* rail, rdpWindow* window)
{
xfInfo* xfi;
xfContext* xfc;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
xf_SetWindowText(xfi, xfw, window->title);
xf_SetWindowText(xfc, xfw, window->title);
}
static void xf_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon)
{
xfInfo* xfi;
xfContext* xfc;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
icon->extra = freerdp_icon_convert(icon->entry->bitsColor, NULL, icon->entry->bitsMask,
icon->entry->width, icon->entry->height, icon->entry->bpp, rail->clrconv);
xf_SetWindowIcon(xfi, xfw, icon);
xf_SetWindowIcon(xfc, xfw, icon);
}
static void xf_rail_SetWindowRects(rdpRail* rail, rdpWindow* window)
{
xfInfo* xfi;
xfContext* xfc;
xfWindow* xfw;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
xf_SetWindowRects(xfi, xfw, window->windowRects, window->numWindowRects);
xf_SetWindowRects(xfc, xfw, window->windowRects, window->numWindowRects);
}
static void xf_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window)
{
xfInfo* xfi;
xfWindow* xfw;
xfContext* xfc;
xfi = (xfInfo*) rail->extra;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
xf_SetWindowVisibilityRects(xfi, xfw, window->windowRects, window->numWindowRects);
xf_SetWindowVisibilityRects(xfc, xfw, window->windowRects, window->numWindowRects);
}
static void xf_rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
{
xfWindow* xfw;
xfContext* xfc;
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
xf_DestroyWindow((xfInfo*) rail->extra, xfw);
xf_DestroyWindow(xfc, xfw);
}
void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail)
void xf_rail_register_callbacks(xfContext* xfc, rdpRail* rail)
{
rail->extra = (void*) xfi;
rail->extra = (void*) xfc;
rail->rail_CreateWindow = xf_rail_CreateWindow;
rail->rail_MoveWindow = xf_rail_MoveWindow;
rail->rail_ShowWindow = xf_rail_ShowWindow;
@ -270,15 +273,15 @@ static void xf_send_rail_client_event(rdpChannels* channels, UINT16 event_type,
}
}
void xf_rail_send_activate(xfInfo* xfi, Window xwindow, BOOL enabled)
void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
{
rdpRail* rail;
rdpChannels* channels;
rdpWindow* rail_window;
RAIL_ACTIVATE_ORDER activate;
rail = xfi->_context->rail;
channels = xfi->_context->channels;
rail = ((rdpContext*) xfc)->rail;
channels = ((rdpContext*) xfc)->channels;
rail_window = window_list_get_by_extra_id(rail->list, (void*) xwindow);
@ -291,12 +294,12 @@ void xf_rail_send_activate(xfInfo* xfi, Window xwindow, BOOL enabled)
xf_send_rail_client_event(channels, RailChannel_ClientActivate, &activate);
}
void xf_rail_send_client_system_command(xfInfo* xfi, UINT32 windowId, UINT16 command)
void xf_rail_send_client_system_command(xfContext* xfc, UINT32 windowId, UINT16 command)
{
rdpChannels* channels;
RAIL_SYSCOMMAND_ORDER syscommand;
channels = xfi->_context->channels;
channels = ((rdpContext*) xfc)->channels;
syscommand.windowId = windowId;
syscommand.command = command;
@ -310,14 +313,14 @@ void xf_rail_send_client_system_command(xfInfo* xfi, UINT32 windowId, UINT16 com
* send an update to the RDP server informing it of the new window position
* and size.
*/
void xf_rail_adjust_position(xfInfo* xfi, rdpWindow* window)
void xf_rail_adjust_position(xfContext* xfc, rdpWindow* window)
{
xfWindow* xfw;
rdpChannels* channels;
RAIL_WINDOW_MOVE_ORDER window_move;
xfw = (xfWindow*) window->extra;
channels = xfi->_context->channels;
channels = ((rdpContext*) xfc)->channels;
if (! xfw->is_mapped || xfw->local_move.state != LMS_NOT_ACTIVE)
return;
@ -371,12 +374,12 @@ void xf_rail_adjust_position(xfInfo* xfi, rdpWindow* window)
}
}
void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
void xf_rail_end_local_move(xfContext* xfc, rdpWindow *window)
{
xfWindow* xfw;
rdpChannels* channels;
RAIL_WINDOW_MOVE_ORDER window_move;
rdpInput* input = xfi->instance->input;
rdpInput* input = xfc->instance->input;
int x,y;
Window root_window;
Window child_window;
@ -385,7 +388,7 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
int child_y;
xfw = (xfWindow*) window->extra;
channels = xfi->_context->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,
@ -427,7 +430,7 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
* Simulate button up at new position to end the local move (per RDP spec)
*/
XQueryPointer(xfi->display, xfw->handle,
XQueryPointer(xfc->display, xfw->handle,
&root_window, &child_window,
&x, &y, &child_x, &child_y, &mask);
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
@ -454,16 +457,16 @@ void xf_rail_end_local_move(xfInfo* xfi, rdpWindow *window)
xfw->local_move.state = LMS_TERMINATING;
}
void xf_process_rail_get_sysparams_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_get_sysparams_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
RAIL_SYSPARAM_ORDER* sysparam;
sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
sysparam->workArea.left = xfi->workArea.x;
sysparam->workArea.top = xfi->workArea.y;
sysparam->workArea.right = xfi->workArea.x + xfi->workArea.width;
sysparam->workArea.bottom = xfi->workArea.y + xfi->workArea.height;
sysparam->workArea.left = xfc->workArea.x;
sysparam->workArea.top = xfc->workArea.y;
sysparam->workArea.right = xfc->workArea.x + xfc->workArea.width;
sysparam->workArea.bottom = xfc->workArea.y + xfc->workArea.height;
sysparam->taskbarPos.left = 0;
sysparam->taskbarPos.top = 0;
@ -486,7 +489,7 @@ const char* error_code_names[] =
"RAIL_EXEC_E_SESSION_LOCKED"
};
void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_exec_result_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
RAIL_EXEC_RESULT_ORDER* exec_result;
@ -496,15 +499,15 @@ void xf_process_rail_exec_result_event(xfInfo* xfi, rdpChannels* channels, wMess
{
fprintf(stderr, "RAIL exec error: execResult=%s NtError=0x%X\n",
error_code_names[exec_result->execResult], exec_result->rawResult);
xfi->disconnect = True;
xfc->disconnect = True;
}
else
{
xf_rail_enable_remoteapp_mode(xfi);
xf_rail_enable_remoteapp_mode(xfc);
}
}
void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_server_sysparam_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
RAIL_SYSPARAM_ORDER* sysparam = (RAIL_SYSPARAM_ORDER*) event->wParam;
@ -518,13 +521,13 @@ void xf_process_rail_server_sysparam_event(xfInfo* xfi, rdpChannels* channels, w
}
}
void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_server_minmaxinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
rdpRail* rail;
rdpWindow* rail_window = NULL;
RAIL_MINMAXINFO_ORDER* minmax = (RAIL_MINMAXINFO_ORDER*) event->wParam;
rail = ((rdpContext*) xfi->context)->rail;
rail = ((rdpContext*) xfc)->rail;
rail_window = window_list_get_by_id(rail->list, minmax->windowId);
if (rail_window != NULL)
@ -539,7 +542,7 @@ void xf_process_rail_server_minmaxinfo_event(xfInfo* xfi, rdpChannels* channels,
minmax->minTrackWidth, minmax->minTrackHeight,
minmax->maxTrackWidth, minmax->maxTrackHeight);
xf_SetWindowMinMaxInfo(xfi, window, minmax->maxWidth, minmax->maxHeight, minmax->maxPosX, minmax->maxPosY,
xf_SetWindowMinMaxInfo(xfc, window, minmax->maxWidth, minmax->maxHeight, minmax->maxPosX, minmax->maxPosY,
minmax->minTrackWidth, minmax->minTrackHeight, minmax->maxTrackWidth, minmax->maxTrackHeight);
}
}
@ -560,7 +563,7 @@ const char* movetype_names[] =
"RAIL_WMSZ_KEYSIZE"
};
void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_server_localmovesize_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
int x, y;
rdpRail* rail;
@ -569,7 +572,7 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channe
rdpWindow* rail_window = NULL;
RAIL_LOCALMOVESIZE_ORDER* movesize = (RAIL_LOCALMOVESIZE_ORDER*) event->wParam;
rail = ((rdpContext*) xfi->context)->rail;
rail = ((rdpContext*) xfc)->rail;
rail_window = window_list_get_by_id(rail->list, movesize->windowId);
if (rail_window != NULL)
@ -625,8 +628,8 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channe
break;
case RAIL_WMSZ_MOVE: //0x9
direction = _NET_WM_MOVERESIZE_MOVE;
XTranslateCoordinates(xfi->display, xfw->handle,
RootWindowOfScreen(xfi->screen),
XTranslateCoordinates(xfc->display, xfw->handle,
RootWindowOfScreen(xfc->screen),
movesize->posX, movesize->posY, &x, &y, &child_window);
break;
case RAIL_WMSZ_KEYMOVE: //0xA
@ -645,14 +648,14 @@ void xf_process_rail_server_localmovesize_event(xfInfo* xfi, rdpChannels* channe
if (movesize->isMoveSizeStart)
{
xf_StartLocalMoveSize(xfi, xfw, direction, x, y);
xf_StartLocalMoveSize(xfc, xfw, direction, x, y);
} else {
xf_EndLocalMoveSize(xfi, xfw);
xf_EndLocalMoveSize(xfc, xfw);
}
}
}
void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_appid_resp_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
RAIL_GET_APPID_RESP_ORDER* appid_resp =
(RAIL_GET_APPID_RESP_ORDER*) event->wParam;
@ -664,7 +667,7 @@ void xf_process_rail_appid_resp_event(xfInfo* xfi, rdpChannels* channels, wMessa
winpr_HexDump(appid_resp->applicationId.string, appid_resp->applicationId.length);
}
void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_langbarinfo_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
RAIL_LANGBAR_INFO_ORDER* langbar =
(RAIL_LANGBAR_INFO_ORDER*) event->wParam;
@ -673,36 +676,36 @@ void xf_process_rail_langbarinfo_event(xfInfo* xfi, rdpChannels* channels, wMess
langbar->languageBarStatus);
}
void xf_process_rail_event(xfInfo* xfi, rdpChannels* channels, wMessage* event)
void xf_process_rail_event(xfContext* xfc, rdpChannels* channels, wMessage* event)
{
switch (GetMessageType(event->id))
{
case RailChannel_GetSystemParam:
xf_process_rail_get_sysparams_event(xfi, channels, event);
xf_process_rail_get_sysparams_event(xfc, channels, event);
break;
case RailChannel_ServerExecuteResult:
xf_process_rail_exec_result_event(xfi, channels, event);
xf_process_rail_exec_result_event(xfc, channels, event);
break;
case RailChannel_ServerSystemParam:
xf_process_rail_server_sysparam_event(xfi, channels, event);
xf_process_rail_server_sysparam_event(xfc, channels, event);
break;
case RailChannel_ServerMinMaxInfo:
xf_process_rail_server_minmaxinfo_event(xfi, channels, event);
xf_process_rail_server_minmaxinfo_event(xfc, channels, event);
break;
case RailChannel_ServerLocalMoveSize:
xf_process_rail_server_localmovesize_event(xfi, channels, event);
xf_process_rail_server_localmovesize_event(xfc, channels, event);
break;
case RailChannel_ServerGetAppIdResponse:
xf_process_rail_appid_resp_event(xfi, channels, event);
xf_process_rail_appid_resp_event(xfc, channels, event);
break;
case RailChannel_ServerLanguageBarInfo:
xf_process_rail_langbarinfo_event(xfi, channels, event);
xf_process_rail_langbarinfo_event(xfc, channels, event);
break;
default:

View File

@ -23,14 +23,14 @@
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_rail_paint(xfInfo* xfi, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom);
void xf_rail_register_callbacks(xfInfo* xfi, rdpRail* rail);
void xf_rail_send_client_system_command(xfInfo* xfi, UINT32 windowId, UINT16 command);
void xf_rail_send_activate(xfInfo* xfi, Window xwindow, BOOL enabled);
void xf_process_rail_event(xfInfo* xfi, rdpChannels* channels, wMessage* event);
void xf_rail_adjust_position(xfInfo* xfi, rdpWindow* window);
void xf_rail_end_local_move(xfInfo* xfi, rdpWindow* window);
void xf_rail_enable_remoteapp_mode(xfInfo* xfi);
void xf_rail_disable_remoteapp_mode(xfInfo* xfi);
void xf_rail_paint(xfContext* xfc, rdpRail* rail, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom);
void xf_rail_register_callbacks(xfContext* xfc, rdpRail* rail);
void xf_rail_send_client_system_command(xfContext* xfc, UINT32 windowId, UINT16 command);
void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled);
void xf_process_rail_event(xfContext* xfc, rdpChannels* channels, wMessage* event);
void xf_rail_adjust_position(xfContext* xfc, rdpWindow* window);
void xf_rail_end_local_move(xfContext* xfc, rdpWindow* window);
void xf_rail_enable_remoteapp_mode(xfContext* xfc);
void xf_rail_disable_remoteapp_mode(xfContext* xfc);
#endif /* __XF_RAIL_H */

View File

@ -63,7 +63,7 @@ struct xf_xv_context
#define DEBUG_XV(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif
void xf_tsmf_init(xfInfo* xfi, long xv_port)
void xf_tsmf_init(xfContext* xfc, long xv_port)
{
int ret;
unsigned int i;
@ -81,19 +81,19 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port)
xv = (xfXvContext*) malloc(sizeof(xfXvContext));
ZeroMemory(xv, sizeof(xfXvContext));
xfi->xv_context = xv;
xfc->xv_context = xv;
xv->xv_colorkey_atom = None;
xv->xv_image_size = 0;
xv->xv_port = xv_port;
if (!XShmQueryExtension(xfi->display))
if (!XShmQueryExtension(xfc->display))
{
DEBUG_XV("no shmem available.");
return;
}
ret = XvQueryExtension(xfi->display, &version, &release, &request_base, &event_base, &error_base);
ret = XvQueryExtension(xfc->display, &version, &release, &request_base, &event_base, &error_base);
if (ret != Success)
{
DEBUG_XV("XvQueryExtension failed %d.", ret);
@ -101,7 +101,7 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port)
}
DEBUG_XV("version %u release %u", version, release);
ret = XvQueryAdaptors(xfi->display, DefaultRootWindow(xfi->display),
ret = XvQueryAdaptors(xfc->display, DefaultRootWindow(xfc->display),
&num_adaptors, &ai);
if (ret != Success)
{
@ -127,13 +127,13 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port)
}
DEBUG_XV("selected %ld", xv->xv_port);
attr = XvQueryPortAttributes(xfi->display, xv->xv_port, &ret);
attr = XvQueryPortAttributes(xfc->display, xv->xv_port, &ret);
for (i = 0; i < (unsigned int)ret; i++)
{
if (strcmp(attr[i].name, "XV_COLORKEY") == 0)
{
xv->xv_colorkey_atom = XInternAtom(xfi->display, "XV_COLORKEY", FALSE);
XvSetPortAttribute(xfi->display, xv->xv_port, xv->xv_colorkey_atom, attr[i].min_value + 1);
xv->xv_colorkey_atom = XInternAtom(xfc->display, "XV_COLORKEY", FALSE);
XvSetPortAttribute(xfc->display, xv->xv_port, xv->xv_colorkey_atom, attr[i].min_value + 1);
break;
}
}
@ -142,7 +142,7 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port)
#ifdef WITH_DEBUG_XV
fprintf(stderr, "xf_tsmf_init: pixel format ");
#endif
fo = XvListImageFormats(xfi->display, xv->xv_port, &ret);
fo = XvListImageFormats(xfc->display, xv->xv_port, &ret);
if (ret > 0)
{
xv->xv_pixfmts = (UINT32*) malloc((ret + 1) * sizeof(UINT32));
@ -164,9 +164,9 @@ void xf_tsmf_init(xfInfo* xfi, long xv_port)
#endif
}
void xf_tsmf_uninit(xfInfo* xfi)
void xf_tsmf_uninit(xfContext* xfc)
{
xfXvContext* xv = (xfXvContext*) xfi->xv_context;
xfXvContext* xv = (xfXvContext*) xfc->xv_context;
if (xv)
{
@ -181,7 +181,7 @@ void xf_tsmf_uninit(xfInfo* xfi)
xv->xv_pixfmts = NULL;
}
free(xv);
xfi->xv_context = NULL;
xfc->xv_context = NULL;
}
}
@ -202,7 +202,7 @@ xf_tsmf_is_format_supported(xfXvContext* xv, UINT32 pixfmt)
return FALSE;
}
static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT* vevent)
static void xf_process_tsmf_video_frame_event(xfContext* xfc, RDP_VIDEO_FRAME_EVENT* vevent)
{
int i;
BYTE* data1;
@ -213,7 +213,7 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT
XvImage * image;
int colorkey = 0;
XShmSegmentInfo shminfo;
xfXvContext* xv = (xfXvContext*) xfi->xv_context;
xfXvContext* xv = (xfXvContext*) xfc->xv_context;
if (xv->xv_port == 0)
return;
@ -224,13 +224,13 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT
if (xv->xv_colorkey_atom != None)
{
XvGetPortAttribute(xfi->display, xv->xv_port, xv->xv_colorkey_atom, &colorkey);
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
XSetForeground(xfi->display, xfi->gc, colorkey);
XvGetPortAttribute(xfc->display, xv->xv_port, xv->xv_colorkey_atom, &colorkey);
XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, colorkey);
for (i = 0; i < vevent->num_visible_rects; i++)
{
XFillRectangle(xfi->display, xfi->window->handle, xfi->gc,
XFillRectangle(xfc->display, xfc->window->handle, xfc->gc,
vevent->x + vevent->visible_rects[i].x,
vevent->y + vevent->visible_rects[i].y,
vevent->visible_rects[i].width,
@ -239,7 +239,7 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT
}
else
{
XSetClipRectangles(xfi->display, xfi->gc, vevent->x, vevent->y,
XSetClipRectangles(xfc->display, xfc->gc, vevent->x, vevent->y,
(XRectangle*) vevent->visible_rects, vevent->num_visible_rects, YXBanded);
}
@ -265,7 +265,7 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT
return;
}
image = XvShmCreateImage(xfi->display, xv->xv_port,
image = XvShmCreateImage(xfc->display, xv->xv_port,
xvpixfmt, 0, vevent->frame_width, vevent->frame_height, &shminfo);
if (xv->xv_image_size != image->data_size)
@ -283,7 +283,7 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT
shminfo.shmaddr = image->data = xv->xv_shmaddr;
shminfo.readOnly = FALSE;
if (!XShmAttach(xfi->display, &shminfo))
if (!XShmAttach(xfc->display, &shminfo))
{
XFree(image);
DEBUG_XV("XShmAttach failed.");
@ -356,35 +356,35 @@ static void xf_process_tsmf_video_frame_event(xfInfo* xfi, RDP_VIDEO_FRAME_EVENT
break;
}
XvShmPutImage(xfi->display, xv->xv_port, xfi->window->handle, xfi->gc, image,
XvShmPutImage(xfc->display, xv->xv_port, xfc->window->handle, xfc->gc, image,
0, 0, image->width, image->height,
vevent->x, vevent->y, vevent->width, vevent->height, FALSE);
if (xv->xv_colorkey_atom == None)
XSetClipMask(xfi->display, xfi->gc, None);
XSync(xfi->display, FALSE);
XSetClipMask(xfc->display, xfc->gc, None);
XSync(xfc->display, FALSE);
XShmDetach(xfi->display, &shminfo);
XShmDetach(xfc->display, &shminfo);
XFree(image);
}
static void xf_process_tsmf_redraw_event(xfInfo* xfi, RDP_REDRAW_EVENT* revent)
static void xf_process_tsmf_redraw_event(xfContext* xfc, RDP_REDRAW_EVENT* revent)
{
XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
XCopyArea(xfi->display, xfi->primary, xfi->window->handle, xfi->gc,
XSetFunction(xfc->display, xfc->gc, GXcopy);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XCopyArea(xfc->display, xfc->primary, xfc->window->handle, xfc->gc,
revent->x, revent->y, revent->width, revent->height, revent->x, revent->y);
}
void xf_process_tsmf_event(xfInfo* xfi, wMessage* event)
void xf_process_tsmf_event(xfContext* xfc, wMessage* event)
{
switch (GetMessageType(event->id))
{
case TsmfChannel_VideoFrame:
xf_process_tsmf_video_frame_event(xfi, (RDP_VIDEO_FRAME_EVENT*) event);
xf_process_tsmf_video_frame_event(xfc, (RDP_VIDEO_FRAME_EVENT*) event);
break;
case TsmfChannel_Redraw:
xf_process_tsmf_redraw_event(xfi, (RDP_REDRAW_EVENT*) event);
xf_process_tsmf_redraw_event(xfc, (RDP_REDRAW_EVENT*) event);
break;
}
@ -392,15 +392,15 @@ void xf_process_tsmf_event(xfInfo* xfi, wMessage* event)
#else /* WITH_XV */
void xf_tsmf_init(xfInfo* xfi, long xv_port)
void xf_tsmf_init(xfContext* xfc, long xv_port)
{
}
void xf_tsmf_uninit(xfInfo* xfi)
void xf_tsmf_uninit(xfContext* xfc)
{
}
void xf_process_tsmf_event(xfInfo* xfi, wMessage* event)
void xf_process_tsmf_event(xfContext* xfc, wMessage* event)
{
}

View File

@ -23,8 +23,8 @@
#include "xf_interface.h"
#include "xfreerdp.h"
void xf_tsmf_init(xfInfo* xfi, long xv_port);
void xf_tsmf_uninit(xfInfo* xfi);
void xf_process_tsmf_event(xfInfo* xfi, wMessage* event);
void xf_tsmf_init(xfContext* xfc, long xv_port);
void xf_tsmf_uninit(xfContext* xfc);
void xf_process_tsmf_event(xfContext* xfc, wMessage* event);
#endif /* __XF_TSMF_H */

View File

@ -108,7 +108,7 @@ typedef struct _PropMotifWmHints PropMotifWmHints;
/**
* Post an event from the client to the X server
*/
void xf_SendClientEvent(xfInfo* xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...)
void xf_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsigned int numArgs, ...)
{
XEvent xevent;
unsigned int i;
@ -119,7 +119,7 @@ void xf_SendClientEvent(xfInfo* xfi, xfWindow* window, Atom atom, unsigned int n
xevent.xclient.type = ClientMessage;
xevent.xclient.serial = 0;
xevent.xclient.send_event = False;
xevent.xclient.display = xfi->display;
xevent.xclient.display = xfc->display;
xevent.xclient.window = window->handle;
xevent.xclient.message_type = atom;
xevent.xclient.format = 32;
@ -131,23 +131,23 @@ void xf_SendClientEvent(xfInfo* xfi, xfWindow* window, Atom atom, unsigned int n
DEBUG_X11("Send ClientMessage Event: wnd=0x%04X", (unsigned int) xevent.xclient.window);
XSendEvent(xfi->display, RootWindowOfScreen(xfi->screen), False,
XSendEvent(xfc->display, RootWindowOfScreen(xfc->screen), False,
SubstructureRedirectMask | SubstructureNotifyMask, &xevent);
XSync(xfi->display, False);
XSync(xfc->display, False);
va_end(argp);
}
void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, BOOL fullscreen)
void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen)
{
if (fullscreen)
{
rdpSettings* settings = xfi->instance->settings;
rdpSettings* settings = xfc->instance->settings;
xf_SetWindowDecorations(xfi, window, FALSE);
xf_SetWindowDecorations(xfc, window, FALSE);
XMoveResizeWindow(xfi->display, window->handle, settings->DesktopPosX, settings->DesktopPosY, window->width, window->height);
XMapRaised(xfi->display, window->handle);
XMoveResizeWindow(xfc->display, window->handle, settings->DesktopPosX, settings->DesktopPosY, window->width, window->height);
XMapRaised(xfc->display, window->handle);
window->fullscreen = TRUE;
}
@ -155,7 +155,7 @@ void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, BOOL fullscreen)
/* http://tronche.com/gui/x/xlib/window-information/XGetWindowProperty.html */
BOOL xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length,
BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int length,
unsigned long* nitems, unsigned long* bytes, BYTE** prop)
{
int status;
@ -165,7 +165,7 @@ BOOL xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length,
if (property == None)
return FALSE;
status = XGetWindowProperty(xfi->display, window,
status = XGetWindowProperty(xfc->display, window,
property, 0, length, FALSE, AnyPropertyType,
&actual_type, &actual_format, nitems, bytes, prop);
@ -181,26 +181,26 @@ BOOL xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length,
return TRUE;
}
BOOL xf_GetCurrentDesktop(xfInfo* xfi)
BOOL xf_GetCurrentDesktop(xfContext* xfc)
{
BOOL status;
unsigned long nitems;
unsigned long bytes;
unsigned char* prop;
status = xf_GetWindowProperty(xfi, DefaultRootWindow(xfi->display),
xfi->_NET_CURRENT_DESKTOP, 1, &nitems, &bytes, &prop);
status = xf_GetWindowProperty(xfc, DefaultRootWindow(xfc->display),
xfc->_NET_CURRENT_DESKTOP, 1, &nitems, &bytes, &prop);
if (!status)
return FALSE;
xfi->current_desktop = (int) *prop;
xfc->current_desktop = (int) *prop;
free(prop);
return TRUE;
}
BOOL xf_GetWorkArea(xfInfo* xfi)
BOOL xf_GetWorkArea(xfContext* xfc)
{
long* plong;
BOOL status;
@ -208,18 +208,18 @@ BOOL xf_GetWorkArea(xfInfo* xfi)
unsigned long bytes;
unsigned char* prop;
status = xf_GetCurrentDesktop(xfi);
status = xf_GetCurrentDesktop(xfc);
if (status != TRUE)
return FALSE;
status = xf_GetWindowProperty(xfi, DefaultRootWindow(xfi->display),
xfi->_NET_WORKAREA, 32 * 4, &nitems, &bytes, &prop);
status = xf_GetWindowProperty(xfc, DefaultRootWindow(xfc->display),
xfc->_NET_WORKAREA, 32 * 4, &nitems, &bytes, &prop);
if (status != TRUE)
return FALSE;
if ((xfi->current_desktop * 4 + 3) >= nitems)
if ((xfc->current_desktop * 4 + 3) >= nitems)
{
free(prop);
return FALSE;
@ -227,16 +227,16 @@ BOOL xf_GetWorkArea(xfInfo* xfi)
plong = (long*) prop;
xfi->workArea.x = plong[xfi->current_desktop * 4 + 0];
xfi->workArea.y = plong[xfi->current_desktop * 4 + 1];
xfi->workArea.width = plong[xfi->current_desktop * 4 + 2];
xfi->workArea.height = plong[xfi->current_desktop * 4 + 3];
xfc->workArea.x = plong[xfc->current_desktop * 4 + 0];
xfc->workArea.y = plong[xfc->current_desktop * 4 + 1];
xfc->workArea.width = plong[xfc->current_desktop * 4 + 2];
xfc->workArea.height = plong[xfc->current_desktop * 4 + 3];
free(prop);
return TRUE;
}
void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, BOOL show)
void xf_SetWindowDecorations(xfContext* xfc, xfWindow* window, BOOL show)
{
PropMotifWmHints hints;
@ -246,22 +246,22 @@ void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, BOOL show)
hints.inputMode = 0;
hints.status = 0;
XChangeProperty(xfi->display, window->handle, xfi->_MOTIF_WM_HINTS, xfi->_MOTIF_WM_HINTS, 32,
XChangeProperty(xfc->display, window->handle, xfc->_MOTIF_WM_HINTS, xfc->_MOTIF_WM_HINTS, 32,
PropModeReplace, (BYTE*) &hints, PROP_MOTIF_WM_HINTS_ELEMENTS);
}
void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window)
void xf_SetWindowUnlisted(xfContext* xfc, xfWindow* window)
{
Atom window_state[2];
window_state[0] = xfi->_NET_WM_STATE_SKIP_PAGER;
window_state[1] = xfi->_NET_WM_STATE_SKIP_TASKBAR;
window_state[0] = xfc->_NET_WM_STATE_SKIP_PAGER;
window_state[1] = xfc->_NET_WM_STATE_SKIP_TASKBAR;
XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_STATE,
XChangeProperty(xfc->display, window->handle, xfc->_NET_WM_STATE,
XA_ATOM, 32, PropModeReplace, (BYTE*) &window_state, 2);
}
void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, UINT32 style, UINT32 ex_style)
void xf_SetWindowStyle(xfContext* xfc, xfWindow* window, UINT32 style, UINT32 ex_style)
{
Atom window_type;
@ -278,11 +278,11 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, UINT32 style, UINT32 ex_st
*/
XSetWindowAttributes attrs;
attrs.override_redirect = True;
XChangeWindowAttributes(xfi->display, window->handle, CWOverrideRedirect, &attrs);
XChangeWindowAttributes(xfc->display, window->handle, CWOverrideRedirect, &attrs);
window->is_transient = TRUE;
xf_SetWindowUnlisted(xfi, window);
window_type = xfi->_NET_WM_WINDOW_TYPE_POPUP;
xf_SetWindowUnlisted(xfc, window);
window_type = xfc->_NET_WM_WINDOW_TYPE_POPUP;
}
/*
* TOPMOST window that is not a toolwindow is treated like a regular window(ie. task manager).
@ -290,44 +290,44 @@ void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, UINT32 style, UINT32 ex_st
*/
else if (ex_style & WS_EX_TOPMOST)
{
window_type = xfi->_NET_WM_WINDOW_TYPE_NORMAL;
window_type = xfc->_NET_WM_WINDOW_TYPE_NORMAL;
}
else if (style & WS_POPUP)
{
/* this includes dialogs, popups, etc, that need to be full-fledged windows */
window->is_transient = TRUE;
window_type = xfi->_NET_WM_WINDOW_TYPE_DIALOG;
xf_SetWindowUnlisted(xfi, window);
window_type = xfc->_NET_WM_WINDOW_TYPE_DIALOG;
xf_SetWindowUnlisted(xfc, window);
}
else
{
window_type = xfi->_NET_WM_WINDOW_TYPE_NORMAL;
window_type = xfc->_NET_WM_WINDOW_TYPE_NORMAL;
}
XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_WINDOW_TYPE,
XChangeProperty(xfc->display, window->handle, xfc->_NET_WM_WINDOW_TYPE,
XA_ATOM, 32, PropModeReplace, (BYTE*) &window_type, 1);
}
void xf_SetWindowText(xfInfo *xfi, xfWindow* window, char *name)
void xf_SetWindowText(xfContext* xfc, xfWindow* window, char *name)
{
XStoreName(xfi->display, window->handle, name);
XStoreName(xfc->display, window->handle, name);
}
static void xf_SetWindowPID(xfInfo* xfi, xfWindow* window, pid_t pid)
static void xf_SetWindowPID(xfContext* xfc, xfWindow* window, pid_t pid)
{
Atom am_wm_pid;
if (!pid)
pid = getpid();
am_wm_pid = XInternAtom(xfi->display, "_NET_WM_PID", False);
am_wm_pid = XInternAtom(xfc->display, "_NET_WM_PID", False);
XChangeProperty(xfi->display, window->handle, am_wm_pid, XA_CARDINAL,
XChangeProperty(xfc->display, window->handle, am_wm_pid, XA_CARDINAL,
32, PropModeReplace, (unsigned char *)&pid, 1);
}
xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, BOOL decorations)
xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int height, BOOL decorations)
{
xfWindow* window;
XEvent xevent;
@ -335,7 +335,7 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
window = (xfWindow*) malloc(sizeof(xfWindow));
ZeroMemory(window, sizeof(xfWindow));
settings = xfi->instance->settings;
settings = xfc->instance->settings;
if (window)
{
@ -351,10 +351,10 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
window->is_mapped = FALSE;
window->is_transient = FALSE;
window->handle = XCreateWindow(xfi->display, RootWindowOfScreen(xfi->screen),
xfi->workArea.x, xfi->workArea.y, xfi->workArea.width, xfi->workArea.height, 0, xfi->depth, InputOutput, xfi->visual,
window->handle = XCreateWindow(xfc->display, RootWindowOfScreen(xfc->screen),
xfc->workArea.x, xfc->workArea.y, xfc->workArea.width, xfc->workArea.height, 0, xfc->depth, InputOutput, xfc->visual,
CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
CWBorderPixel | CWWinGravity | CWBitGravity, &xfi->attribs);
CWBorderPixel | CWWinGravity | CWBitGravity, &xfc->attribs);
shmid = shmget(SHARED_MEM_KEY, sizeof(int), IPC_CREAT | 0666);
@ -382,38 +382,38 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
{
class_hints->res_name = "xfreerdp";
if (xfi->instance->settings->WmClass)
class_hints->res_class = xfi->instance->settings->WmClass;
if (xfc->instance->settings->WmClass)
class_hints->res_class = xfc->instance->settings->WmClass;
else
class_hints->res_class = "xfreerdp";
XSetClassHint(xfi->display, window->handle, class_hints);
XSetClassHint(xfc->display, window->handle, class_hints);
XFree(class_hints);
}
xf_ResizeDesktopWindow(xfi, window, width, height);
xf_SetWindowDecorations(xfi, window, decorations);
xf_SetWindowPID(xfi, window, 0);
xf_ResizeDesktopWindow(xfc, window, width, height);
xf_SetWindowDecorations(xfc, window, decorations);
xf_SetWindowPID(xfc, window, 0);
input_mask =
KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
VisibilityChangeMask | FocusChangeMask | StructureNotifyMask |
PointerMotionMask | ExposureMask | PropertyChangeMask;
if (xfi->grab_keyboard)
if (xfc->grab_keyboard)
input_mask |= EnterWindowMask | LeaveWindowMask;
XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_ICON, XA_CARDINAL, 32,
XChangeProperty(xfc->display, window->handle, xfc->_NET_WM_ICON, XA_CARDINAL, 32,
PropModeReplace, (BYTE*) xf_icon_prop, ARRAYSIZE(xf_icon_prop));
if (xfi->settings->ParentWindowId)
XReparentWindow(xfi->display, window->handle, (Window) xfi->settings->ParentWindowId, 0, 0);
if (xfc->settings->ParentWindowId)
XReparentWindow(xfc->display, window->handle, (Window) xfc->settings->ParentWindowId, 0, 0);
XSelectInput(xfi->display, window->handle, input_mask);
XClearWindow(xfi->display, window->handle);
XMapWindow(xfi->display, window->handle);
XSelectInput(xfc->display, window->handle, input_mask);
XClearWindow(xfc->display, window->handle);
XMapWindow(xfc->display, window->handle);
xf_input_init(xfi, window->handle);
xf_input_init(xfc, window->handle);
/*
* NOTE: This must be done here to handle reparenting the window,
@ -421,7 +421,7 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
*/
do
{
XMaskEvent(xfi->display, VisibilityChangeMask, &xevent);
XMaskEvent(xfc->display, VisibilityChangeMask, &xevent);
}
while (xevent.type != VisibilityNotify);
@ -431,22 +431,22 @@ xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height,
* This extra call after the window is mapped will position the login window correctly
*/
if (xfi->instance->settings->RemoteApplicationMode)
if (xfc->instance->settings->RemoteApplicationMode)
{
XMoveWindow(xfi->display, window->handle, 0, 0);
XMoveWindow(xfc->display, window->handle, 0, 0);
}
else if (settings->DesktopPosX || settings->DesktopPosY)
{
XMoveWindow(xfi->display, window->handle, settings->DesktopPosX, settings->DesktopPosY);
XMoveWindow(xfc->display, window->handle, settings->DesktopPosX, settings->DesktopPosY);
}
}
xf_SetWindowText(xfi, window, name);
xf_SetWindowText(xfc, window, name);
return window;
}
void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height)
void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height)
{
XSizeHints* size_hints;
@ -455,21 +455,21 @@ void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height
if (size_hints)
{
size_hints->flags = PMinSize | PMaxSize;
size_hints->min_width = size_hints->max_width = xfi->width;
size_hints->min_height = size_hints->max_height = xfi->height;
XSetWMNormalHints(xfi->display, window->handle, size_hints);
XResizeWindow(xfi->display, window->handle, xfi->width, xfi->height);
size_hints->min_width = size_hints->max_width = xfc->width;
size_hints->min_height = size_hints->max_height = xfc->height;
XSetWMNormalHints(xfc->display, window->handle, size_hints);
XResizeWindow(xfc->display, window->handle, xfc->width, xfc->height);
XFree(size_hints);
}
}
void xf_FixWindowCoordinates(xfInfo* xfi, int* x, int* y, int* width, int* height)
void xf_FixWindowCoordinates(xfContext* xfc, int* x, int* y, int* width, int* height)
{
int vscreen_width;
int vscreen_height;
vscreen_width = xfi->vscreen.area.right - xfi->vscreen.area.left + 1;
vscreen_height = xfi->vscreen.area.bottom - xfi->vscreen.area.top + 1;
vscreen_width = xfc->vscreen.area.right - xfc->vscreen.area.left + 1;
vscreen_height = xfc->vscreen.area.bottom - xfc->vscreen.area.top + 1;
if (*width < 1)
{
@ -479,15 +479,15 @@ void xf_FixWindowCoordinates(xfInfo* xfi, int* x, int* y, int* width, int* heigh
{
*height = 1;
}
if (*x < xfi->vscreen.area.left)
if (*x < xfc->vscreen.area.left)
{
*width += *x;
*x = xfi->vscreen.area.left;
*x = xfc->vscreen.area.left;
}
if (*y < xfi->vscreen.area.top)
if (*y < xfc->vscreen.area.top)
{
*height += *y;
*y = xfi->vscreen.area.top;
*y = xfc->vscreen.area.top;
}
if (*width > vscreen_width)
{
@ -501,7 +501,7 @@ void xf_FixWindowCoordinates(xfInfo* xfi, int* x, int* y, int* width, int* heigh
char rail_window_class[] = "RAIL:00000000";
xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, UINT32 id)
xfWindow* xf_CreateWindow(xfContext* xfc, rdpWindow* wnd, int x, int y, int width, int height, UINT32 id)
{
XGCValues gcv;
int input_mask;
@ -512,7 +512,7 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
window = (xfWindow*) malloc(sizeof(xfWindow));
ZeroMemory(window, sizeof(xfWindow));
xf_FixWindowCoordinates(xfi, &x, &y, &width, &height);
xf_FixWindowCoordinates(xfc, &x, &y, &width, &height);
window->left = x;
window->top = y;
@ -536,17 +536,17 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
window->rail_state = 0;
window->rail_ignore_configure = FALSE;
window->handle = XCreateWindow(xfi->display, RootWindowOfScreen(xfi->screen),
x, y, window->width, window->height, 0, xfi->depth, InputOutput, xfi->visual,
window->handle = XCreateWindow(xfc->display, RootWindowOfScreen(xfc->screen),
x, y, window->width, window->height, 0, xfc->depth, InputOutput, xfc->visual,
CWBackPixel | CWBackingStore | CWOverrideRedirect | CWColormap |
CWBorderPixel | CWWinGravity | CWBitGravity, &xfi->attribs);
CWBorderPixel | CWWinGravity | CWBitGravity, &xfc->attribs);
DEBUG_X11_LMS("Create window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d rdp=0x%X",
(UINT32) window->handle, window->left, window->top, window->right, window->bottom,
window->width, window->height, wnd->windowId);
ZeroMemory(&gcv, sizeof(gcv));
window->gc = XCreateGC(xfi->display, window->handle, GCGraphicsExposures, &gcv);
window->gc = XCreateGC(xfc->display, window->handle, GCGraphicsExposures, &gcv);
class_hints = XAllocClassHint();
@ -554,9 +554,9 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
{
char* class = NULL;
if (xfi->instance->settings->WmClass != NULL)
if (xfc->instance->settings->WmClass != NULL)
{
class_hints->res_class = xfi->instance->settings->WmClass;
class_hints->res_class = xfc->instance->settings->WmClass;
}
else
{
@ -566,7 +566,7 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
}
class_hints->res_name = "RAIL";
XSetClassHint(xfi->display, window->handle, class_hints);
XSetClassHint(xfc->display, window->handle, class_hints);
XFree(class_hints);
if (class)
@ -577,10 +577,10 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
InputModeHint = XAllocWMHints();
InputModeHint->flags = (1L << 0);
InputModeHint->input = True;
XSetWMHints(xfi->display, window->handle, InputModeHint);
XSetWMHints(xfc->display, window->handle, InputModeHint);
XFree(InputModeHint);
XSetWMProtocols(xfi->display, window->handle, &(xfi->WM_DELETE_WINDOW), 1);
XSetWMProtocols(xfc->display, window->handle, &(xfc->WM_DELETE_WINDOW), 1);
input_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask |
ButtonReleaseMask | EnterWindowMask | LeaveWindowMask |
@ -591,23 +591,23 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
SubstructureRedirectMask | FocusChangeMask | PropertyChangeMask |
ColormapChangeMask | OwnerGrabButtonMask;
XSelectInput(xfi->display, window->handle, input_mask);
XSelectInput(xfc->display, window->handle, input_mask);
xf_SetWindowDecorations(xfi, window, window->decorations);
xf_SetWindowStyle(xfi, window, wnd->style, wnd->extendedStyle);
xf_SetWindowPID(xfi, window, 0);
xf_ShowWindow(xfi, window, WINDOW_SHOW);
xf_SetWindowDecorations(xfc, window, window->decorations);
xf_SetWindowStyle(xfc, window, wnd->style, wnd->extendedStyle);
xf_SetWindowPID(xfc, window, 0);
xf_ShowWindow(xfc, window, WINDOW_SHOW);
XClearWindow(xfi->display, window->handle);
XMapWindow(xfi->display, window->handle);
XClearWindow(xfc->display, window->handle);
XMapWindow(xfc->display, window->handle);
/* Move doesn't seem to work until window is mapped. */
xf_MoveWindow(xfi, window, x, y, width, height);
xf_MoveWindow(xfc, window, x, y, width, height);
return window;
}
void xf_SetWindowMinMaxInfo(xfInfo* xfi, xfWindow* window,
void xf_SetWindowMinMaxInfo(xfContext* xfc, xfWindow* window,
int maxWidth, int maxHeight, int maxPosX, int maxPosY,
int minTrackWidth, int minTrackHeight, int maxTrackWidth, int maxTrackHeight)
{
@ -628,12 +628,12 @@ void xf_SetWindowMinMaxInfo(xfInfo* xfi, xfWindow* window,
/* to speedup window drawing we need to select optimal value for sizing step. */
size_hints->width_inc = size_hints->height_inc = 1;
XSetWMNormalHints(xfi->display, window->handle, size_hints);
XSetWMNormalHints(xfc->display, window->handle, size_hints);
XFree(size_hints);
}
}
void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, int y)
void xf_StartLocalMoveSize(xfContext* xfc, xfWindow* window, int direction, int x, int y)
{
if (window->local_move.state != LMS_NOT_ACTIVE)
return;
@ -655,10 +655,10 @@ void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x,
window->local_move.state = LMS_STARTING;
window->local_move.direction = direction;
XUngrabPointer(xfi->display, CurrentTime);
XUngrabPointer(xfc->display, CurrentTime);
xf_SendClientEvent(xfi, window,
xfi->_NET_WM_MOVERESIZE, /* request X window manager to initiate a local move */
xf_SendClientEvent(xfc, window,
xfc->_NET_WM_MOVERESIZE, /* request X window manager to initiate a local move */
5, /* 5 arguments to follow */
x, /* x relative to root window */
y, /* y relative to root window */
@ -667,7 +667,7 @@ void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x,
1); /* 1 == application request per extended ICCM */
}
void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window)
void xf_EndLocalMoveSize(xfContext* xfc, xfWindow *window)
{
DEBUG_X11_LMS("state=%d window=0x%X rc={l=%d t=%d r=%d b=%d} w=%d h=%d "
@ -689,8 +689,8 @@ void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window)
* RDP server for local moves. We must cancel the X window manager move.
* Per ICCM, the X client can ask to cancel an active move.
*/
xf_SendClientEvent(xfi, window,
xfi->_NET_WM_MOVERESIZE, /* request X window manager to abort a local move */
xf_SendClientEvent(xfc, window,
xfc->_NET_WM_MOVERESIZE, /* request X window manager to abort a local move */
5, /* 5 arguments to follow */
window->local_move.root_x, /* x relative to root window */
window->local_move.root_y, /* y relative to root window */
@ -702,7 +702,7 @@ void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window)
window->local_move.state = LMS_NOT_ACTIVE;
}
void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height)
void xf_MoveWindow(xfContext* xfc, xfWindow* window, int x, int y, int width, int height)
{
BOOL resize = FALSE;
@ -734,30 +734,30 @@ void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int h
window->height = height;
if (resize)
XMoveResizeWindow(xfi->display, window->handle, x, y, width, height);
XMoveResizeWindow(xfc->display, window->handle, x, y, width, height);
else
XMoveWindow(xfi->display, window->handle, x, y);
XMoveWindow(xfc->display, window->handle, x, y);
xf_UpdateWindowArea(xfi, window, 0, 0, width, height);
xf_UpdateWindowArea(xfc, window, 0, 0, width, height);
}
void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state)
void xf_ShowWindow(xfContext* xfc, xfWindow* window, BYTE state)
{
switch (state)
{
case WINDOW_HIDE:
XWithdrawWindow(xfi->display, window->handle, xfi->screen_number);
XWithdrawWindow(xfc->display, window->handle, xfc->screen_number);
break;
case WINDOW_SHOW_MINIMIZED:
XIconifyWindow(xfi->display, window->handle, xfi->screen_number);
XIconifyWindow(xfc->display, window->handle, xfc->screen_number);
break;
case WINDOW_SHOW_MAXIMIZED:
/* Set the window as maximized */
xf_SendClientEvent(xfi, window, xfi->_NET_WM_STATE, 4, 1,
XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False),
XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False), 0);
xf_SendClientEvent(xfc, window, xfc->_NET_WM_STATE, 4, 1,
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False),
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False), 0);
/*
* This is a workaround for the case where the window is maximized locally before the rail server is told to maximize
@ -767,14 +767,14 @@ void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state)
*/
if (window->rail_state == WINDOW_SHOW_MAXIMIZED)
xf_UpdateWindowArea(xfi, window, 0, 0, window->window->windowWidth, window->window->windowHeight);
xf_UpdateWindowArea(xfc, window, 0, 0, window->window->windowWidth, window->window->windowHeight);
break;
case WINDOW_SHOW:
/* Ensure the window is not maximized */
xf_SendClientEvent(xfi, window, xfi->_NET_WM_STATE, 4, 0,
XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_VERT", False),
XInternAtom(xfi->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False), 0);
xf_SendClientEvent(xfc, window, xfc->_NET_WM_STATE, 4, 0,
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_VERT", False),
XInternAtom(xfc->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False), 0);
/*
* Ignore configure requests until both the Maximized properties have been processed
@ -787,7 +787,7 @@ void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state)
window->rail_ignore_configure = TRUE;
if (window->is_transient)
xf_SetWindowUnlisted(xfi, window);
xf_SetWindowUnlisted(xfc, window);
break;
}
@ -795,10 +795,10 @@ void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state)
/* Save the current rail state of this window */
window->rail_state = state;
XFlush(xfi->display);
XFlush(xfc->display);
}
void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon)
void xf_SetWindowIcon(xfContext* xfc, xfWindow* window, rdpIcon* icon)
{
int x, y;
int pixels;
@ -827,13 +827,13 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon)
}
}
XChangeProperty(xfi->display, window->handle, xfi->_NET_WM_ICON, XA_CARDINAL, 32,
XChangeProperty(xfc->display, window->handle, xfc->_NET_WM_ICON, XA_CARDINAL, 32,
PropModeReplace, (BYTE*) propdata, propsize);
XFlush(xfi->display);
XFlush(xfc->display);
}
void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects)
void xf_SetWindowRects(xfContext* xfc, xfWindow* window, RECTANGLE_16* rects, int nrects)
{
int i;
XRectangle* xrects;
@ -857,13 +857,13 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n
*
* Marc: enabling it works, and is required for round corners.
*/
XShapeCombineRectangles(xfi->display, window->handle, ShapeBounding, 0, 0, xrects, nrects, ShapeSet, 0);
XShapeCombineRectangles(xfc->display, window->handle, ShapeBounding, 0, 0, xrects, nrects, ShapeSet, 0);
#endif
free(xrects);
}
void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects)
void xf_SetWindowVisibilityRects(xfContext* xfc, xfWindow* window, RECTANGLE_16* rects, int nrects)
{
int i;
XRectangle* xrects;
@ -887,13 +887,13 @@ void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* re
*
* Marc: enabling it works, and is required for round corners.
*/
XShapeCombineRectangles(xfi->display, window->handle, ShapeBounding, 0, 0, xrects, nrects, ShapeSet, 0);
XShapeCombineRectangles(xfc->display, window->handle, ShapeBounding, 0, 0, xrects, nrects, ShapeSet, 0);
#endif
free(xrects);
}
void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height)
void xf_UpdateWindowArea(xfContext* xfc, xfWindow* window, int x, int y, int width, int height)
{
int ax, ay;
rdpWindow* wnd;
@ -901,7 +901,7 @@ void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width,
/* RemoteApp mode uses visibleOffset instead of windowOffset */
if (!xfi->remote_app)
if (!xfc->remote_app)
{
ax = x + wnd->windowOffsetX;
ay = y + wnd->windowOffsetY;
@ -924,23 +924,23 @@ void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width,
height = (wnd->visibleOffsetY + wnd->windowHeight - 1) - ay;
}
WaitForSingleObject(xfi->mutex, INFINITE);
WaitForSingleObject(xfc->mutex, INFINITE);
if (xfi->settings->SoftwareGdi)
if (xfc->settings->SoftwareGdi)
{
XPutImage(xfi->display, xfi->primary, window->gc, xfi->image,
XPutImage(xfc->display, xfc->primary, window->gc, xfc->image,
ax, ay, ax, ay, width, height);
}
XCopyArea(xfi->display, xfi->primary, window->handle, window->gc,
XCopyArea(xfc->display, xfc->primary, window->handle, window->gc,
ax, ay, width, height, x, y);
XFlush(xfi->display);
XFlush(xfc->display);
ReleaseMutex(xfi->mutex);
ReleaseMutex(xfc->mutex);
}
BOOL xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y)
BOOL xf_IsWindowBorder(xfContext* xfc, xfWindow* xfw, int x, int y)
{
rdpWindow* wnd;
BOOL clientArea = FALSE;
@ -959,43 +959,40 @@ BOOL xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y)
return (windowArea && !(clientArea));
}
void xf_DestroyWindow(xfInfo* xfi, xfWindow* window)
void xf_DestroyWindow(xfContext* xfc, xfWindow* window)
{
if (window == NULL)
return;
if (xfi->window == window)
xfi->window = NULL;
if (xfc->window == window)
xfc->window = NULL;
if (window->gc)
XFreeGC(xfi->display, window->gc);
XFreeGC(xfc->display, window->gc);
if (window->handle)
{
XUnmapWindow(xfi->display, window->handle);
XDestroyWindow(xfi->display, window->handle);
XUnmapWindow(xfc->display, window->handle);
XDestroyWindow(xfc->display, window->handle);
}
free(window);
}
rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd)
rdpWindow* xf_rdpWindowFromWindow(xfContext* xfc, Window wnd)
{
rdpRail* rail;
if (xfi != NULL)
if (xfc)
{
if (wnd != 0)
if (wnd)
{
if (xfi->_context != NULL)
{
rail = xfi->_context->rail;
rail = ((rdpContext*) xfc)->rail;
if (rail != NULL)
if (rail)
return window_list_get_by_extra_id(rail->list, (void*) (long) wnd);
}
}
}
return NULL;
}

View File

@ -82,39 +82,39 @@ struct xf_window
BOOL rail_ignore_configure;
};
void xf_ewmhints_init(xfInfo* xfi);
void xf_ewmhints_init(xfContext* xfc);
BOOL xf_GetCurrentDesktop(xfInfo* xfi);
BOOL xf_GetWorkArea(xfInfo* xfi);
BOOL xf_GetCurrentDesktop(xfContext* xfc);
BOOL xf_GetWorkArea(xfContext* xfc);
void xf_SetWindowFullscreen(xfInfo* xfi, xfWindow* window, BOOL fullscreen);
void xf_SetWindowDecorations(xfInfo* xfi, xfWindow* window, BOOL show);
void xf_SetWindowUnlisted(xfInfo* xfi, xfWindow* window);
void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen);
void xf_SetWindowDecorations(xfContext* xfc, xfWindow* window, BOOL show);
void xf_SetWindowUnlisted(xfContext* xfc, xfWindow* window);
xfWindow* xf_CreateDesktopWindow(xfInfo* xfi, char* name, int width, int height, BOOL decorations);
void xf_ResizeDesktopWindow(xfInfo* xfi, xfWindow* window, int width, int height);
xfWindow* xf_CreateDesktopWindow(xfContext* xfc, char* name, int width, int height, BOOL decorations);
void xf_ResizeDesktopWindow(xfContext* xfc, xfWindow* window, int width, int height);
xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, int height, UINT32 id);
void xf_SetWindowText(xfInfo *xfi, xfWindow* window, char *name);
void xf_MoveWindow(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height);
void xf_ShowWindow(xfInfo* xfi, xfWindow* window, BYTE state);
void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon);
void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects);
void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects);
void xf_SetWindowStyle(xfInfo* xfi, xfWindow* window, UINT32 style, UINT32 ex_style);
void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height);
BOOL xf_IsWindowBorder(xfInfo* xfi, xfWindow* xfw, int x, int y);
void xf_DestroyWindow(xfInfo* xfi, xfWindow* window);
rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd);
xfWindow* xf_CreateWindow(xfContext* xfc, rdpWindow* wnd, int x, int y, int width, int height, UINT32 id);
void xf_SetWindowText(xfContext* xfc, xfWindow* window, char *name);
void xf_MoveWindow(xfContext* xfc, xfWindow* window, int x, int y, int width, int height);
void xf_ShowWindow(xfContext* xfc, xfWindow* window, BYTE state);
void xf_SetWindowIcon(xfContext* xfc, xfWindow* window, rdpIcon* icon);
void xf_SetWindowRects(xfContext* xfc, xfWindow* window, RECTANGLE_16* rects, int nrects);
void xf_SetWindowVisibilityRects(xfContext* xfc, xfWindow* window, RECTANGLE_16* rects, int nrects);
void xf_SetWindowStyle(xfContext* xfc, xfWindow* window, UINT32 style, UINT32 ex_style);
void xf_UpdateWindowArea(xfContext* xfc, xfWindow* window, int x, int y, int width, int height);
BOOL xf_IsWindowBorder(xfContext* xfc, xfWindow* xfw, int x, int y);
void xf_DestroyWindow(xfContext* xfc, xfWindow* window);
rdpWindow* xf_rdpWindowFromWindow(xfContext* xfc, Window wnd);
BOOL xf_GetWindowProperty(xfInfo* xfi, Window window, Atom property, int length,
BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int length,
unsigned long* nitems, unsigned long* bytes, BYTE** prop);
void xf_SetWindowMinMaxInfo(xfInfo* xfi, xfWindow* window, int maxWidth, int maxHeight,
void xf_SetWindowMinMaxInfo(xfContext* xfc, xfWindow* window, int maxWidth, int maxHeight,
int maxPosX, int maxPosY, int minTrackWidth, int minTrackHeight, int maxTrackWidth, int maxTrackHeight);
void xf_StartLocalMoveSize(xfInfo* xfi, xfWindow* window, int direction, int x, int y);
void xf_EndLocalMoveSize(xfInfo *xfi, xfWindow *window);
void xf_SendClientEvent(xfInfo *xfi, xfWindow* window, Atom atom, unsigned int numArgs, ...);
void xf_StartLocalMoveSize(xfContext* xfc, xfWindow* window, int direction, int x, int y);
void xf_EndLocalMoveSize(xfContext* xfc, xfWindow *window);
void xf_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsigned int numArgs, ...);
#endif /* __XF_WINDOW_H */

View File

@ -54,18 +54,11 @@ struct xf_glyph
};
typedef struct xf_glyph xfGlyph;
typedef struct xf_context xfContext;
struct xf_context
{
rdpContext _p;
xfInfo* xfi;
rdpContext context;
freerdp* instance;
xfContext* context;
rdpContext* _context;
rdpClient* client;
rdpSettings* settings;
@ -165,8 +158,8 @@ struct xf_context
RdpeiClientContext* rdpei;
};
void xf_create_window(xfInfo* xfi);
void xf_toggle_fullscreen(xfInfo* xfi);
void xf_create_window(xfContext* xfc);
void xf_toggle_fullscreen(xfContext* xfc);
BOOL xf_post_connect(freerdp* instance);
enum XF_EXIT_CODE
@ -210,10 +203,10 @@ enum XF_EXIT_CODE
XF_EXIT_UNKNOWN = 255,
};
void xf_lock_x11(xfInfo* xfi, BOOL display);
void xf_unlock_x11(xfInfo* xfi, BOOL display);
void xf_lock_x11(xfContext* xfc, BOOL display);
void xf_unlock_x11(xfContext* xfc, BOOL display);
void xf_draw_screen_scaled(xfInfo* xfi);
void xf_draw_screen_scaled(xfContext* xfc);
DWORD xf_exit_code_from_disconnect_reason(DWORD reason);