Add Nautilus 3 compatibility

This commit is contained in:
matt335672 2021-09-14 15:00:01 +01:00
parent 253ea6eb6d
commit 2dbec63327
5 changed files with 46 additions and 3 deletions

View File

@ -290,6 +290,14 @@ features:-
.P
- copying-and-pasting of files
.RE
.TP
\fBUseNautilus3FlistFormat\fR=\fI[false|true]\fR
Defaults to \fIfalse\fR.
Set to \fItrue\fR to make file copy-paste compatible with Nautilus from
GNOME 3 versions later than 3.29.92. Do not use this for any other reason.
This setting will be removed in a later version of xrdp, when GNOME 3 is
no longer supported.
.SH "SESSIONS VARIABLES"
All entries in the \fB[SessionVariables]\fR section are set as

View File

@ -39,7 +39,7 @@
#define DEFAULT_ENABLE_FUSE_MOUNT 1
#define DEFAULT_FUSE_MOUNT_NAME "xrdp-client"
#define DEFAULT_FILE_UMASK 077
#define DEFAULT_USE_NAUTILUS3_FLIST_FORMAT 0
/**
* Type used for passing a logging function about
*/
@ -161,7 +161,7 @@ read_config_chansrv(log_func_t logmsg,
{
cfg->enable_fuse_mount = g_text2bool(value);
}
if (g_strcasecmp(name, "FuseMountName") == 0)
else if (g_strcasecmp(name, "FuseMountName") == 0)
{
g_free(cfg->fuse_mount_name);
cfg->fuse_mount_name = g_strdup(value);
@ -176,6 +176,10 @@ read_config_chansrv(log_func_t logmsg,
{
cfg->file_umask = strtol(value, NULL, 0);
}
else if (g_strcasecmp(name, "UseNautilus3FlistFormat") == 0)
{
cfg->use_nautilus3_flist_format = g_text2bool(value);
}
}
return error;
@ -206,6 +210,7 @@ new_config(void)
cfg->restrict_outbound_clipboard = DEFAULT_RESTRICT_OUTBOUND_CLIPBOARD;
cfg->fuse_mount_name = fuse_mount_name;
cfg->file_umask = DEFAULT_FILE_UMASK;
cfg->use_nautilus3_flist_format = DEFAULT_USE_NAUTILUS3_FLIST_FORMAT;
}
return cfg;
@ -290,6 +295,8 @@ config_dump(struct config_chansrv *config)
g_bool2text(config->enable_fuse_mount));
g_writeln(" FuseMountName: %s", config->fuse_mount_name);
g_writeln(" FileMask: 0%o", config->file_umask);
g_writeln(" Nautilus 3 Flist Format: %s",
g_bool2text(config->use_nautilus3_flist_format));
}
/******************************************************************************/

View File

@ -36,6 +36,9 @@ struct config_chansrv
char *fuse_mount_name;
/** FileUmask from sesman.ini */
mode_t file_umask;
/** Whether to use nautilus3-compatible file lists for the clipboard */
int use_nautilus3_flist_format;
};

View File

@ -1244,7 +1244,28 @@ clipboard_process_data_response_for_file(struct stream *s,
else if ((g_clip_c2s.type == XA_STRING) ||
(g_clip_c2s.type == g_utf8_atom))
{
rv = clipboard_c2s_in_files(s, g_clip_c2s.data, flist_size, "");
if (g_cfg->use_nautilus3_flist_format)
{
/*
* This file list format is only used by GNOME 3
* versions >= 3.29.92. It is not used by GNOME 4. Remove
* this workaround when GNOME 3 is no longer supported by
* long-term distros */
#define LIST_PREFIX "x-special/nautilus-clipboard\ncopy\n"
#define LIST_PREFIX_LEN (sizeof(LIST_PREFIX) - 1)
g_strcpy(g_clip_c2s.data, LIST_PREFIX);
rv = clipboard_c2s_in_files(s,
g_clip_c2s.data + LIST_PREFIX_LEN,
flist_size - LIST_PREFIX_LEN - 1,
"file://");
g_strcat(g_clip_c2s.data, "\n");
#undef LIST_PREFIX_LEN
#undef LIST_PREFIX
}
else
{
rv = clipboard_c2s_in_files(s, g_clip_c2s.data, flist_size, "");
}
}
else
{

View File

@ -125,6 +125,10 @@ FuseMountName=thinclient_drives
FileUmask=077
; Can be used to disable FUSE functionality - see sesman.ini(5)
#EnableFuseMount=false
; Uncomment this line only if you are using GNOME 3 versions 3.29.92
; and up, and you wish to cut-paste files between Nautilus and Windows. Do
; not use this setting for GNOME 4, or other file managers
#UseNautilus3FlistFormat=true
[ChansrvLogging]
; Note: one log file is created per display and the LogFile config value