mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-15 18:17:32 -05:00
Add GUI configuration for choice of clipboards.
On all platforms, you can now configure which clipboard the mouse pastes from, which clipboard Ctrl-Ins and Shift-Ins access, and which Ctrl-Shift-C and Ctrl-Shift-V access. In each case, the options are: - nothing at all - a clipboard which is implicitly written by the act of mouse selection (the PRIMARY selection on X, CLIP_LOCAL everywhere else) - the standard clipboard written by explicit copy/paste UI actions (CLIPBOARD on X, the unique system clipboard elsewhere). Also, you can control whether selecting text with the mouse _also_ writes to the explicitly accessed clipboard. The wording of the various messages changes between platforms, but the basic UI shape is the same everywhere.
This commit is contained in:
49
settings.c
49
settings.c
@ -447,6 +447,42 @@ static void wprefs(void *sesskey, const char *name,
|
||||
sfree(buf);
|
||||
}
|
||||
|
||||
static void write_clip_setting(void *handle, const char *savekey,
|
||||
Conf *conf, int confkey)
|
||||
{
|
||||
int val = conf_get_int(conf, confkey);
|
||||
switch (val) {
|
||||
case CLIPUI_NONE:
|
||||
default:
|
||||
write_setting_s(handle, savekey, "none");
|
||||
break;
|
||||
case CLIPUI_IMPLICIT:
|
||||
write_setting_s(handle, savekey, "implicit");
|
||||
break;
|
||||
case CLIPUI_EXPLICIT:
|
||||
write_setting_s(handle, savekey, "explicit");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void read_clip_setting(void *handle, const char *savekey,
|
||||
int def, Conf *conf, int confkey)
|
||||
{
|
||||
char *setting = read_setting_s(handle, savekey);
|
||||
int val;
|
||||
|
||||
if (!setting) {
|
||||
val = def;
|
||||
} else if (!strcmp(setting, "implicit")) {
|
||||
val = CLIPUI_IMPLICIT;
|
||||
} else if (!strcmp(setting, "explicit")) {
|
||||
val = CLIPUI_EXPLICIT;
|
||||
} else {
|
||||
val = CLIPUI_NONE;
|
||||
}
|
||||
conf_set_int(conf, confkey, val);
|
||||
}
|
||||
|
||||
char *save_settings(const char *section, Conf *conf)
|
||||
{
|
||||
void *sesskey;
|
||||
@ -638,6 +674,11 @@ void save_open_settings(void *sesskey, Conf *conf)
|
||||
}
|
||||
write_setting_s(sesskey, buf, buf2);
|
||||
}
|
||||
write_setting_i(sesskey, "MouseAutocopy",
|
||||
conf_get_int(conf, CONF_mouseautocopy));
|
||||
write_clip_setting(sesskey, "MousePaste", conf, CONF_mousepaste);
|
||||
write_clip_setting(sesskey, "CtrlShiftIns", conf, CONF_ctrlshiftins);
|
||||
write_clip_setting(sesskey, "CtrlShiftCV", conf, CONF_ctrlshiftcv);
|
||||
write_setting_s(sesskey, "LineCodePage", conf_get_str(conf, CONF_line_codepage));
|
||||
write_setting_i(sesskey, "CJKAmbigWide", conf_get_int(conf, CONF_cjk_ambig_wide));
|
||||
write_setting_i(sesskey, "UTF8Override", conf_get_int(conf, CONF_utf8_override));
|
||||
@ -1059,6 +1100,14 @@ void load_open_settings(void *sesskey, Conf *conf)
|
||||
}
|
||||
sfree(buf2);
|
||||
}
|
||||
gppi(sesskey, "MouseAutocopy", CLIPUI_DEFAULT_AUTOCOPY,
|
||||
conf, CONF_mouseautocopy);
|
||||
read_clip_setting(sesskey, "MousePaste", CLIPUI_DEFAULT_MOUSE,
|
||||
conf, CONF_mousepaste);
|
||||
read_clip_setting(sesskey, "CtrlShiftIns", CLIPUI_DEFAULT_INS,
|
||||
conf, CONF_ctrlshiftins);
|
||||
read_clip_setting(sesskey, "CtrlShiftCV", CLIPUI_NONE,
|
||||
conf, CONF_ctrlshiftcv);
|
||||
/*
|
||||
* The empty default for LineCodePage will be converted later
|
||||
* into a plausible default for the locale.
|
||||
|
Reference in New Issue
Block a user