114 |
/* Denotes that an rdesktop (not this rdesktop) is owning the selection, |
/* Denotes that an rdesktop (not this rdesktop) is owning the selection, |
115 |
allowing us to interchange Windows native clipboard data directly. */ |
allowing us to interchange Windows native clipboard data directly. */ |
116 |
static int rdesktop_is_selection_owner = 0; |
static int rdesktop_is_selection_owner = 0; |
117 |
|
/* Time when we acquired the selection. */ |
118 |
|
static Time acquire_time = 0; |
119 |
|
|
120 |
/* Denotes that an INCR ("chunked") transfer is in progress. */ |
/* Denotes that an INCR ("chunked") transfer is in progress. */ |
121 |
static int g_waiting_for_INCR = 0; |
static int g_waiting_for_INCR = 0; |
616 |
} |
} |
617 |
else if (event->target == timestamp_atom) |
else if (event->target == timestamp_atom) |
618 |
{ |
{ |
619 |
xclip_provide_selection(event, XA_INTEGER, 32, (uint8 *) & g_last_gesturetime, 1); |
xclip_provide_selection(event, XA_INTEGER, 32, (uint8 *) & acquire_time, 1); |
620 |
return; |
return; |
621 |
} |
} |
622 |
else |
else |
800 |
void |
void |
801 |
ui_clip_format_announce(uint8 * data, uint32 length) |
ui_clip_format_announce(uint8 * data, uint32 length) |
802 |
{ |
{ |
803 |
XSetSelectionOwner(g_display, primary_atom, g_wnd, g_last_gesturetime); |
acquire_time = g_last_gesturetime; |
804 |
|
|
805 |
|
XSetSelectionOwner(g_display, primary_atom, g_wnd, acquire_time); |
806 |
if (XGetSelectionOwner(g_display, primary_atom) != g_wnd) |
if (XGetSelectionOwner(g_display, primary_atom) != g_wnd) |
807 |
{ |
{ |
808 |
warning("Failed to aquire ownership of PRIMARY clipboard\n"); |
warning("Failed to aquire ownership of PRIMARY clipboard\n"); |
814 |
rdesktop_clipboard_formats_atom, XA_STRING, 8, PropModeReplace, data, |
rdesktop_clipboard_formats_atom, XA_STRING, 8, PropModeReplace, data, |
815 |
length); |
length); |
816 |
|
|
817 |
XSetSelectionOwner(g_display, clipboard_atom, g_wnd, g_last_gesturetime); |
XSetSelectionOwner(g_display, clipboard_atom, g_wnd, acquire_time); |
818 |
if (XGetSelectionOwner(g_display, clipboard_atom) != g_wnd) |
if (XGetSelectionOwner(g_display, clipboard_atom) != g_wnd) |
819 |
warning("Failed to aquire ownership of CLIPBOARD clipboard\n"); |
warning("Failed to aquire ownership of CLIPBOARD clipboard\n"); |
820 |
} |
} |
825 |
{ |
{ |
826 |
BOOL free_data = False; |
BOOL free_data = False; |
827 |
|
|
828 |
|
if (length == 0) |
829 |
|
{ |
830 |
|
xclip_refuse_selection(&selection_request); |
831 |
|
has_selection_request = False; |
832 |
|
return; |
833 |
|
} |
834 |
|
|
835 |
if (selection_request.target == format_string_atom || selection_request.target == XA_STRING) |
if (selection_request.target == format_string_atom || selection_request.target == XA_STRING) |
836 |
{ |
{ |
837 |
/* We're expecting a CF_TEXT response */ |
/* We're expecting a CF_TEXT response */ |
1003 |
format_string_atom = XInternAtom(g_display, "STRING", False); |
format_string_atom = XInternAtom(g_display, "STRING", False); |
1004 |
format_utf8_string_atom = XInternAtom(g_display, "UTF8_STRING", False); |
format_utf8_string_atom = XInternAtom(g_display, "UTF8_STRING", False); |
1005 |
format_unicode_atom = XInternAtom(g_display, "text/unicode", False); |
format_unicode_atom = XInternAtom(g_display, "text/unicode", False); |
1006 |
|
|
1007 |
|
/* rdesktop sets _RDESKTOP_CLIPBOARD_FORMATS on the root window when acquiring the clipboard. |
1008 |
|
Other interested rdesktops can use this to notify their server of the available formats. */ |
1009 |
|
rdesktop_clipboard_formats_atom = |
1010 |
|
XInternAtom(g_display, "_RDESKTOP_CLIPBOARD_FORMATS", False); |
1011 |
|
XSelectInput(g_display, DefaultRootWindow(g_display), PropertyChangeMask); |
1012 |
|
|
1013 |
num_targets = 0; |
num_targets = 0; |
1014 |
targets[num_targets++] = targets_atom; |
targets[num_targets++] = targets_atom; |
1015 |
targets[num_targets++] = timestamp_atom; |
targets[num_targets++] = timestamp_atom; |
1016 |
targets[num_targets++] = rdesktop_clipboard_formats_atom; |
targets[num_targets++] = rdesktop_clipboard_formats_atom; |
|
targets[num_targets++] = format_string_atom; |
|
1017 |
#ifdef USE_UNICODE_CLIPBOARD |
#ifdef USE_UNICODE_CLIPBOARD |
1018 |
targets[num_targets++] = format_utf8_string_atom; |
targets[num_targets++] = format_utf8_string_atom; |
1019 |
#endif |
#endif |
1020 |
targets[num_targets++] = format_unicode_atom; |
targets[num_targets++] = format_unicode_atom; |
1021 |
|
targets[num_targets++] = format_string_atom; |
1022 |
targets[num_targets++] = XA_STRING; |
targets[num_targets++] = XA_STRING; |
|
|
|
|
/* rdesktop sets _RDESKTOP_CLIPBOARD_FORMATS on the root window when acquiring the clipboard. |
|
|
Other interested rdesktops can use this to notify their server of the available formats. */ |
|
|
rdesktop_clipboard_formats_atom = |
|
|
XInternAtom(g_display, "_RDESKTOP_CLIPBOARD_FORMATS", False); |
|
|
XSelectInput(g_display, DefaultRootWindow(g_display), PropertyChangeMask); |
|
1023 |
} |
} |