Control clipboard behaviour (and even disable it) using command line options.
git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@1206 423420c4-83ab-492f-b58f-81f9feb106b5
This commit is contained in:
parent
2e80d53a30
commit
ba2f441f18
@ -163,6 +163,12 @@ cliprdr_process(STREAM s)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cliprdr_set_mode(const char *optarg)
|
||||||
|
{
|
||||||
|
ui_clip_set_mode(optarg);
|
||||||
|
}
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
cliprdr_init(void)
|
cliprdr_init(void)
|
||||||
{
|
{
|
||||||
|
2
proto.h
2
proto.h
@ -54,6 +54,7 @@ void cliprdr_send_simple_native_format_announce(uint32 format);
|
|||||||
void cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length);
|
void cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length);
|
||||||
void cliprdr_send_data_request(uint32 format);
|
void cliprdr_send_data_request(uint32 format);
|
||||||
void cliprdr_send_data(uint8 * data, uint32 length);
|
void cliprdr_send_data(uint8 * data, uint32 length);
|
||||||
|
void cliprdr_set_mode(const char *optarg);
|
||||||
BOOL cliprdr_init(void);
|
BOOL cliprdr_init(void);
|
||||||
/* disk.c */
|
/* disk.c */
|
||||||
int disk_enum_devices(uint32 * id, char *optarg);
|
int disk_enum_devices(uint32 * id, char *optarg);
|
||||||
@ -205,6 +206,7 @@ void ui_clip_format_announce(uint8 * data, uint32 length);
|
|||||||
void ui_clip_handle_data(uint8 * data, uint32 length);
|
void ui_clip_handle_data(uint8 * data, uint32 length);
|
||||||
void ui_clip_request_data(uint32 format);
|
void ui_clip_request_data(uint32 format);
|
||||||
void ui_clip_sync(void);
|
void ui_clip_sync(void);
|
||||||
|
void ui_clip_set_mode(const char *optarg);
|
||||||
void xclip_init(void);
|
void xclip_init(void);
|
||||||
/* xkeymap.c */
|
/* xkeymap.c */
|
||||||
BOOL xkeymap_from_locale(const char *locale);
|
BOOL xkeymap_from_locale(const char *locale);
|
||||||
|
26
rdesktop.c
26
rdesktop.c
@ -84,6 +84,7 @@ BOOL g_fullscreen = False;
|
|||||||
BOOL g_grab_keyboard = True;
|
BOOL g_grab_keyboard = True;
|
||||||
BOOL g_hide_decorations = False;
|
BOOL g_hide_decorations = False;
|
||||||
BOOL g_use_rdp5 = True;
|
BOOL g_use_rdp5 = True;
|
||||||
|
BOOL g_rdpclip = True;
|
||||||
BOOL g_console_session = False;
|
BOOL g_console_session = False;
|
||||||
BOOL g_numlock_sync = False;
|
BOOL g_numlock_sync = False;
|
||||||
BOOL lspci_enabled = False;
|
BOOL lspci_enabled = False;
|
||||||
@ -180,6 +181,13 @@ usage(char *program)
|
|||||||
" or mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");
|
" or mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n");
|
||||||
fprintf(stderr, " '-r sound:[local|off|remote]': enable sound redirection\n");
|
fprintf(stderr, " '-r sound:[local|off|remote]': enable sound redirection\n");
|
||||||
fprintf(stderr, " remote would leave sound on server\n");
|
fprintf(stderr, " remote would leave sound on server\n");
|
||||||
|
fprintf(stderr,
|
||||||
|
" '-r clipboard:[on|off|auto|PRIMARYCLIPBOARD|CLIPBOARD]': enable clip-\n");
|
||||||
|
fprintf(stderr, " board redirection.\n");
|
||||||
|
fprintf(stderr,
|
||||||
|
" 'on|auto|PRIMARYCLIPBOARD' looks at both PRIMARY and\n");
|
||||||
|
fprintf(stderr, " CLIPBOARD when sending data to server.\n");
|
||||||
|
fprintf(stderr, " 'CLIPBOARD' looks at only CLIPBOARD.\n");
|
||||||
fprintf(stderr, " -0: attach to console\n");
|
fprintf(stderr, " -0: attach to console\n");
|
||||||
fprintf(stderr, " -4: use RDP version 4\n");
|
fprintf(stderr, " -4: use RDP version 4\n");
|
||||||
fprintf(stderr, " -5: use RDP version 5 (default)\n");
|
fprintf(stderr, " -5: use RDP version 5 (default)\n");
|
||||||
@ -705,9 +713,25 @@ main(int argc, char *argv[])
|
|||||||
g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);
|
g_rdpdr_clientname = xmalloc(strlen(optarg + 11) + 1);
|
||||||
strcpy(g_rdpdr_clientname, optarg + 11);
|
strcpy(g_rdpdr_clientname, optarg + 11);
|
||||||
}
|
}
|
||||||
|
else if (str_startswith(optarg, "clipboard"))
|
||||||
|
{
|
||||||
|
optarg += 9;
|
||||||
|
|
||||||
|
if (*optarg == ':')
|
||||||
|
{
|
||||||
|
optarg++;
|
||||||
|
|
||||||
|
if (str_startswith(optarg, "off"))
|
||||||
|
g_rdpclip = False;
|
||||||
|
else
|
||||||
|
cliprdr_set_mode(optarg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_rdpclip = True;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound\n");
|
warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound, clipboard\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
30
xclip.c
30
xclip.c
@ -53,7 +53,12 @@
|
|||||||
extern Display *g_display;
|
extern Display *g_display;
|
||||||
extern Window g_wnd;
|
extern Window g_wnd;
|
||||||
extern Time g_last_gesturetime;
|
extern Time g_last_gesturetime;
|
||||||
|
extern BOOL g_rdpclip;
|
||||||
|
|
||||||
|
/* Mode of operation.
|
||||||
|
- Auto: Look at both PRIMARY and CLIPBOARD and use the most recent.
|
||||||
|
- Non-auto: Look at just CLIPBOARD. */
|
||||||
|
static BOOL auto_mode = True;
|
||||||
/* 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) */
|
||||||
static Atom clipboard_atom, primary_atom;
|
static Atom clipboard_atom, primary_atom;
|
||||||
/* Atom of the TARGETS clipboard target */
|
/* Atom of the TARGETS clipboard target */
|
||||||
@ -902,7 +907,11 @@ ui_clip_request_data(uint32 format)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
primary_owner = XGetSelectionOwner(g_display, primary_atom);
|
if (auto_mode)
|
||||||
|
primary_owner = XGetSelectionOwner(g_display, primary_atom);
|
||||||
|
else
|
||||||
|
primary_owner = None;
|
||||||
|
|
||||||
clipboard_owner = XGetSelectionOwner(g_display, clipboard_atom);
|
clipboard_owner = XGetSelectionOwner(g_display, clipboard_atom);
|
||||||
|
|
||||||
/* Both available */
|
/* Both available */
|
||||||
@ -943,10 +952,29 @@ ui_clip_sync(void)
|
|||||||
cliprdr_send_simple_native_format_announce(RDP_CF_TEXT);
|
cliprdr_send_simple_native_format_announce(RDP_CF_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ui_clip_set_mode(const char *optarg)
|
||||||
|
{
|
||||||
|
g_rdpclip = True;
|
||||||
|
|
||||||
|
if (str_startswith(optarg, "auto") || str_startswith(optarg, "on")
|
||||||
|
|| str_startswith(optarg, "PRIMARYCLIPBOARD"))
|
||||||
|
auto_mode = True;
|
||||||
|
else if (str_startswith(optarg, "CLIPBOARD"))
|
||||||
|
auto_mode = False;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
warning("Invalid clipboard mode '%s'.\n", optarg);
|
||||||
|
g_rdpclip = False;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xclip_init(void)
|
xclip_init(void)
|
||||||
{
|
{
|
||||||
|
if (!g_rdpclip)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!cliprdr_init())
|
if (!cliprdr_init())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user