2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Protocol services - Clipboard functions |
Protocol services - Clipboard functions |
4 |
Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 |
Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 |
5 |
Copyright (C) Matthew Chapman 2003 |
Copyright (C) Matthew Chapman 2003-2008 |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
8 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
33 |
|
|
34 |
static VCHANNEL *cliprdr_channel; |
static VCHANNEL *cliprdr_channel; |
35 |
|
|
36 |
|
static uint8 *last_formats = NULL; |
37 |
|
static uint32 last_formats_length = 0; |
38 |
|
|
39 |
static void |
static void |
40 |
cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length) |
cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length) |
41 |
{ |
{ |
78 |
cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length) |
cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length) |
79 |
{ |
{ |
80 |
DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n")); |
DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n")); |
81 |
|
|
82 |
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data, |
cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data, |
83 |
formats_data_length); |
formats_data_length); |
84 |
|
|
85 |
|
if (formats_data != last_formats) |
86 |
|
{ |
87 |
|
if (last_formats) |
88 |
|
xfree(last_formats); |
89 |
|
|
90 |
|
last_formats = xmalloc(formats_data_length); |
91 |
|
memcpy(last_formats, formats_data, formats_data_length); |
92 |
|
last_formats_length = formats_data_length; |
93 |
|
} |
94 |
} |
} |
95 |
|
|
96 |
void |
void |
126 |
|
|
127 |
if (status == CLIPRDR_ERROR) |
if (status == CLIPRDR_ERROR) |
128 |
{ |
{ |
129 |
if (type == CLIPRDR_FORMAT_ACK) |
switch (type) |
130 |
{ |
{ |
131 |
/* FIXME: We seem to get this when we send an announce while the server is |
case CLIPRDR_FORMAT_ACK: |
132 |
still processing a paste. Try sending another announce. */ |
/* FIXME: We seem to get this when we send an announce while the server is |
133 |
cliprdr_send_simple_native_format_announce(CF_TEXT); |
still processing a paste. Try sending another announce. */ |
134 |
return; |
cliprdr_send_native_format_announce(last_formats, |
135 |
|
last_formats_length); |
136 |
|
break; |
137 |
|
case CLIPRDR_DATA_RESPONSE: |
138 |
|
ui_clip_request_failed(); |
139 |
|
break; |
140 |
|
default: |
141 |
|
DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type)); |
142 |
} |
} |
143 |
|
|
|
DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type)); |
|
144 |
return; |
return; |
145 |
} |
} |
146 |
|
|
169 |
} |
} |
170 |
} |
} |
171 |
|
|
172 |
BOOL |
void |
173 |
|
cliprdr_set_mode(const char *optarg) |
174 |
|
{ |
175 |
|
ui_clip_set_mode(optarg); |
176 |
|
} |
177 |
|
|
178 |
|
RD_BOOL |
179 |
cliprdr_init(void) |
cliprdr_init(void) |
180 |
{ |
{ |
181 |
cliprdr_channel = |
cliprdr_channel = |