|
|
@ -644,30 +644,29 @@ static int APP_CC
|
|
|
|
clipboard_send_data_response(int xrdp_clip_type, char *data, int data_size)
|
|
|
|
clipboard_send_data_response(int xrdp_clip_type, char *data, int data_size)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LLOGLN(10, ("clipboard_send_data_response:"));
|
|
|
|
LLOGLN(10, ("clipboard_send_data_response:"));
|
|
|
|
if (g_last_clip_data != 0)
|
|
|
|
if (data != 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (g_last_xrdp_clip_type == XRDP_CB_FILE)
|
|
|
|
if (xrdp_clip_type == XRDP_CB_FILE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return clipboard_send_data_response_for_file(data, data_size);
|
|
|
|
return clipboard_send_data_response_for_file(data, data_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (g_last_xrdp_clip_type == XRDP_CB_BITMAP)
|
|
|
|
else if (xrdp_clip_type == XRDP_CB_BITMAP)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return clipboard_send_data_response_for_image(data, data_size);
|
|
|
|
return clipboard_send_data_response_for_image(data, data_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (g_last_xrdp_clip_type == XRDP_CB_TEXT)
|
|
|
|
else if (xrdp_clip_type == XRDP_CB_TEXT)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return clipboard_send_data_response_for_text(data, data_size);
|
|
|
|
return clipboard_send_data_response_for_text(data, data_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LLOGLN(0, ("clipboard_send_data_response: unknown "
|
|
|
|
LLOGLN(0, ("clipboard_send_data_response: unknown "
|
|
|
|
"g_last_xrdp_clip_type %d", g_last_xrdp_clip_type));
|
|
|
|
"xrdp_clip_type %d", xrdp_clip_type));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LLOGLN(0, ("clipboard_send_data_response: g_last_clip_data "
|
|
|
|
LLOGLN(0, ("clipboard_send_data_response: data is nil"));
|
|
|
|
"is nil"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -885,8 +884,8 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_FILE, "
|
|
|
|
LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_FILE, "
|
|
|
|
"sending last data tdiff %d", tdiff));
|
|
|
|
"sending last data tdiff %d", tdiff));
|
|
|
|
clipboard_send_data_response_for_file(g_last_clip_data,
|
|
|
|
clipboard_send_data_response(XRDP_CB_FILE, g_last_clip_data,
|
|
|
|
g_last_clip_size);
|
|
|
|
g_last_clip_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -905,8 +904,8 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_DIB, "
|
|
|
|
LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_DIB, "
|
|
|
|
"sending last data tdiff %d", tdiff));
|
|
|
|
"sending last data tdiff %d", tdiff));
|
|
|
|
clipboard_send_data_response_for_image(g_last_clip_data,
|
|
|
|
clipboard_send_data_response(XRDP_CB_BITMAP, g_last_clip_data,
|
|
|
|
g_last_clip_size);
|
|
|
|
g_last_clip_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -923,8 +922,8 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_UNICODETEXT, "
|
|
|
|
LLOGLN(10, ("clipboard_process_data_request: CB_FORMAT_UNICODETEXT, "
|
|
|
|
"sending last data tdiff %d", tdiff));
|
|
|
|
"sending last data tdiff %d", tdiff));
|
|
|
|
clipboard_send_data_response_for_image(g_last_clip_data,
|
|
|
|
clipboard_send_data_response(XRDP_CB_TEXT, g_last_clip_data,
|
|
|
|
g_last_clip_size);
|
|
|
|
g_last_clip_size);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -941,8 +940,6 @@ clipboard_process_data_request(struct stream *s, int clip_msg_status,
|
|
|
|
clipboard_send_data_response_failed();
|
|
|
|
clipboard_send_data_response_failed();
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//g_sleep(100); /* ? this seems to prevent case where XConvertSelection does not
|
|
|
|
|
|
|
|
// yeild a SelectionNotify */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1373,7 +1370,15 @@ clipboard_get_window_property(Window wnd, Atom prop, Atom *type, int *fmt,
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
lxdata_size = (lfmt / 8) * ln_items;
|
|
|
|
if (lfmt == 32)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/* 32 implies long */
|
|
|
|
|
|
|
|
lxdata_size = sizeof(long) * ln_items;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
lxdata_size = (lfmt / 8) * ln_items;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (lxdata_size < 1)
|
|
|
|
if (lxdata_size < 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1460,7 +1465,7 @@ clipboard_event_selection_notify(XEvent *xevent)
|
|
|
|
int got_bmp_image;
|
|
|
|
int got_bmp_image;
|
|
|
|
int got_file;
|
|
|
|
int got_file;
|
|
|
|
int send_format_announce;
|
|
|
|
int send_format_announce;
|
|
|
|
int atom;
|
|
|
|
Atom atom;
|
|
|
|
Atom *atoms;
|
|
|
|
Atom *atoms;
|
|
|
|
Atom type;
|
|
|
|
Atom type;
|
|
|
|
|
|
|
|
|
|
|
@ -1523,7 +1528,7 @@ clipboard_event_selection_notify(XEvent *xevent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (lxevent->target == g_targets_atom)
|
|
|
|
if (lxevent->target == g_targets_atom)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* on a 64 bit machine, actual_format_return of 32 implies long */
|
|
|
|
/* 32 implies long */
|
|
|
|
if ((type == XA_ATOM) && (fmt == 32))
|
|
|
|
if ((type == XA_ATOM) && (fmt == 32))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
atoms = (Atom *)data;
|
|
|
|
atoms = (Atom *)data;
|
|
|
@ -1937,12 +1942,14 @@ clipboard_event_property_notify(XEvent *xevent)
|
|
|
|
AnyPropertyType, &actual_type_return, &actual_format_return,
|
|
|
|
AnyPropertyType, &actual_type_return, &actual_format_return,
|
|
|
|
&nitems_returned, &bytes_left, (unsigned char **) &data);
|
|
|
|
&nitems_returned, &bytes_left, (unsigned char **) &data);
|
|
|
|
|
|
|
|
|
|
|
|
format_in_bytes = actual_format_return / 8;
|
|
|
|
if (actual_format_return == 32)
|
|
|
|
|
|
|
|
{
|
|
|
|
if ((actual_format_return == 32) && (sizeof(long) == 8))
|
|
|
|
/* 32 implies long */
|
|
|
|
|
|
|
|
format_in_bytes = sizeof(long);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* on a 64 bit machine, actual_format_return of 32 implies long */
|
|
|
|
format_in_bytes = actual_format_return / 8;
|
|
|
|
format_in_bytes = 8;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
new_data_len = nitems_returned * format_in_bytes;
|
|
|
|
new_data_len = nitems_returned * format_in_bytes;
|
|
|
|