133 |
xclip_handle_SelectionRequest(XSelectionRequestEvent * event) |
xclip_handle_SelectionRequest(XSelectionRequestEvent * event) |
134 |
{ |
{ |
135 |
unsigned long nitems, bytes_left; |
unsigned long nitems, bytes_left; |
136 |
|
unsigned char *prop_return; |
137 |
uint32 *wanted_format; |
uint32 *wanted_format; |
138 |
int format, res; |
int format, res; |
139 |
Atom type; |
Atom type; |
158 |
res = XGetWindowProperty(g_display, event->requestor, |
res = XGetWindowProperty(g_display, event->requestor, |
159 |
rdesktop_clipboard_target_atom, 0, 1, True, XA_INTEGER, |
rdesktop_clipboard_target_atom, 0, 1, True, XA_INTEGER, |
160 |
&type, &format, &nitems, &bytes_left, |
&type, &format, &nitems, &bytes_left, |
161 |
(unsigned char **) &wanted_format); |
&prop_return); |
162 |
|
wanted_format = (uint32 *) prop_return; |
163 |
format = (res == Success) ? *wanted_format : CF_TEXT; |
format = (res == Success) ? *wanted_format : CF_TEXT; |
164 |
|
/* FIXME: Need to free returned data? */ |
165 |
} |
} |
166 |
else |
else |
167 |
{ |
{ |
200 |
{ |
{ |
201 |
res = XGetWindowProperty(g_display, DefaultRootWindow(g_display), |
res = XGetWindowProperty(g_display, DefaultRootWindow(g_display), |
202 |
rdesktop_clipboard_formats_atom, 0, |
rdesktop_clipboard_formats_atom, 0, |
203 |
XMaxRequestSize(g_display), False, XA_STRING, &type, &format, |
XMaxRequestSize(g_display), False, XA_STRING, &type, |
204 |
&nitems, &bytes_left, &data); |
&format, &nitems, &bytes_left, &data); |
205 |
|
|
206 |
if ((res == Success) && (nitems > 0)) |
if ((res == Success) && (nitems > 0)) |
207 |
{ |
{ |
299 |
clipboard_atom = XInternAtom(g_display, "CLIPBOARD", False); |
clipboard_atom = XInternAtom(g_display, "CLIPBOARD", False); |
300 |
targets_atom = XInternAtom(g_display, "TARGETS", False); |
targets_atom = XInternAtom(g_display, "TARGETS", False); |
301 |
timestamp_atom = XInternAtom(g_display, "TIMESTAMP", False); |
timestamp_atom = XInternAtom(g_display, "TIMESTAMP", False); |
302 |
rdesktop_clipboard_target_atom = XInternAtom(g_display, "_RDESKTOP_CLIPBOARD_TARGET", False); |
rdesktop_clipboard_target_atom = |
303 |
|
XInternAtom(g_display, "_RDESKTOP_CLIPBOARD_TARGET", False); |
304 |
incr_atom = XInternAtom(g_display, "INCR", False); |
incr_atom = XInternAtom(g_display, "INCR", False); |
305 |
targets[0] = targets_atom; |
targets[0] = targets_atom; |
306 |
targets[1] = XInternAtom(g_display, "TEXT", False); |
targets[1] = XInternAtom(g_display, "TEXT", False); |