--- sourceforge.net/trunk/rdesktop/cliprdr.c 2003/06/06 10:39:10 402 +++ sourceforge.net/trunk/rdesktop/cliprdr.c 2003/06/16 09:03:55 422 @@ -20,6 +20,9 @@ #include #include +#include +#include +#include #include "rdesktop.h" extern BOOL encryption; @@ -80,9 +83,8 @@ cliprdr_send_format_announce(void) { STREAM s; - - DEBUG_CLIPBOARD(("Sending (empty) format announce\n")); int number_of_formats = 1; + DEBUG_CLIPBOARD(("Sending (empty) format announce\n")); s = sec_init(encryption ? SEC_ENCRYPT : 0, number_of_formats * 36 + 12 + 4 + 4); out_uint32_le(s, number_of_formats * 36 + 12); out_uint32_le(s, 0x13); @@ -157,7 +159,7 @@ int format; Atom type_return; - Atom best_target; + Atom best_target, text_target; Atom *supported_targets; STREAM out; @@ -200,12 +202,19 @@ /* FIXME: We should choose format here based on what the server wanted */ supported_targets = (Atom *) data; + best_target = XInternAtom(display, "STRING", False); + text_target = XInternAtom(display, "TEXT", False); for (i = 0; i < nitems; i++) { DEBUG_CLIPBOARD(("Target %d: %s\n", i, XGetAtomName(display, supported_targets[i]))); + if (text_target == supported_targets[i]) + { + DEBUG_CLIPBOARD(("Other party supports TEXT, choosing that as best_target\n")); + best_target = supported_targets[i]; + } } - best_target = XInternAtom(display, "TEXT", False); + } @@ -311,7 +320,7 @@ XFree(data); - if (!rdesktop_clipboard_target_atom) + if (!rdesktop_is_selection_owner) cliprdr_send_format_announce(); }