53 |
extern Display *g_display; |
extern Display *g_display; |
54 |
extern Window g_wnd; |
extern Window g_wnd; |
55 |
extern Time g_last_gesturetime; |
extern Time g_last_gesturetime; |
56 |
extern BOOL g_rdpclip; |
extern RD_BOOL g_rdpclip; |
57 |
|
|
58 |
/* Mode of operation. |
/* Mode of operation. |
59 |
- Auto: Look at both PRIMARY and CLIPBOARD and use the most recent. |
- Auto: Look at both PRIMARY and CLIPBOARD and use the most recent. |
60 |
- Non-auto: Look at just CLIPBOARD. */ |
- Non-auto: Look at just CLIPBOARD. */ |
61 |
static BOOL auto_mode = True; |
static RD_BOOL auto_mode = True; |
62 |
/* Atoms of the two X selections we're dealing with: CLIPBOARD (explicit-copy) and PRIMARY (selection-copy) */ |
/* Atoms of the two X selections we're dealing with: CLIPBOARD (explicit-copy) and PRIMARY (selection-copy) */ |
63 |
static Atom clipboard_atom, primary_atom; |
static Atom clipboard_atom, primary_atom; |
64 |
/* Atom of the TARGETS clipboard target */ |
/* Atom of the TARGETS clipboard target */ |
92 |
/* State variables that indicate if we're currently probing the targets of the |
/* State variables that indicate if we're currently probing the targets of the |
93 |
selection owner. reprobe_selections indicate that the ownership changed in |
selection owner. reprobe_selections indicate that the ownership changed in |
94 |
the middle of the current probe so it should be restarted. */ |
the middle of the current probe so it should be restarted. */ |
95 |
static BOOL probing_selections, reprobe_selections; |
static RD_BOOL probing_selections, reprobe_selections; |
96 |
/* Atoms _RDESKTOP_PRIMARY_OWNER and _RDESKTOP_CLIPBOARD_OWNER. Used as properties |
/* Atoms _RDESKTOP_PRIMARY_OWNER and _RDESKTOP_CLIPBOARD_OWNER. Used as properties |
97 |
on the root window to indicate which selections that are owned by rdesktop. */ |
on the root window to indicate which selections that are owned by rdesktop. */ |
98 |
static Atom rdesktop_primary_owner_atom, rdesktop_clipboard_owner_atom; |
static Atom rdesktop_primary_owner_atom, rdesktop_clipboard_owner_atom; |
105 |
the context to proceed. */ |
the context to proceed. */ |
106 |
static XSelectionRequestEvent selection_request; |
static XSelectionRequestEvent selection_request; |
107 |
/* Denotes we have a pending selection request. */ |
/* Denotes we have a pending selection request. */ |
108 |
static Bool has_selection_request; |
static RD_BOOL has_selection_request; |
109 |
/* Stores the clipboard format (CF_TEXT, CF_UNICODETEXT etc.) requested in the last |
/* Stores the clipboard format (CF_TEXT, CF_UNICODETEXT etc.) requested in the last |
110 |
CLIPDR_DATA_REQUEST (= the RDP server requesting clipboard data from us). |
CLIPDR_DATA_REQUEST (= the RDP server requesting clipboard data from us). |
111 |
When we receive this data from whatever X client offering it, this variable gives us |
When we receive this data from whatever X client offering it, this variable gives us |
117 |
static int num_targets; |
static int num_targets; |
118 |
/* Denotes that an rdesktop (not this rdesktop) is owning the selection, |
/* Denotes that an rdesktop (not this rdesktop) is owning the selection, |
119 |
allowing us to interchange Windows native clipboard data directly. */ |
allowing us to interchange Windows native clipboard data directly. */ |
120 |
static BOOL rdesktop_is_selection_owner = False; |
static RD_BOOL rdesktop_is_selection_owner = False; |
121 |
/* Time when we acquired the selection. */ |
/* Time when we acquired the selection. */ |
122 |
static Time acquire_time = 0; |
static Time acquire_time = 0; |
123 |
|
|
157 |
{ |
{ |
158 |
uint8 *result; |
uint8 *result; |
159 |
uint16 *inptr, *outptr; |
uint16 *inptr, *outptr; |
160 |
Bool swap_endianess; |
RD_BOOL swap_endianess; |
161 |
|
|
162 |
/* Worst case: Every char is LF */ |
/* Worst case: Every char is LF */ |
163 |
result = xmalloc((*size * 2) + 2); |
result = xmalloc((*size * 2) + 2); |
283 |
/* Replies with clipboard data to RDP, converting it from the target format |
/* Replies with clipboard data to RDP, converting it from the target format |
284 |
to the expected RDP format as necessary. Returns true if data was sent. |
to the expected RDP format as necessary. Returns true if data was sent. |
285 |
*/ |
*/ |
286 |
static Bool |
static RD_BOOL |
287 |
xclip_send_data_with_convert(uint8 * source, size_t source_size, Atom target) |
xclip_send_data_with_convert(uint8 * source, size_t source_size, Atom target) |
288 |
{ |
{ |
289 |
DEBUG_CLIPBOARD(("xclip_send_data_with_convert: target=%s, size=%u\n", |
DEBUG_CLIPBOARD(("xclip_send_data_with_convert: target=%s, size=%u\n", |
958 |
void |
void |
959 |
ui_clip_handle_data(uint8 * data, uint32 length) |
ui_clip_handle_data(uint8 * data, uint32 length) |
960 |
{ |
{ |
961 |
BOOL free_data = False; |
RD_BOOL free_data = False; |
962 |
|
|
963 |
if (length == 0) |
if (length == 0) |
964 |
{ |
{ |