mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Sort out clipboard-related menu items.
The gtkapp.c menu now has a Copy as well as Paste option; those menu items, as well as the corresponding ones on the context menu and Copy All, now address sets of clipboards parametrised between OS X and ordinary GTK in unix.h. Also I've tweaked the wording of the context-menu items to not use the X-specific terminology "CLIPBOARD" on OS X.
This commit is contained in:
parent
1ed2f98c89
commit
7bc637ad07
@ -124,12 +124,20 @@ static void startup(GApplication *app, gpointer user_data)
|
|||||||
|
|
||||||
section = g_menu_new();
|
section = g_menu_new();
|
||||||
g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
|
g_menu_append_section(menu, NULL, G_MENU_MODEL(section));
|
||||||
|
g_menu_append(section, "Copy", "win.copy");
|
||||||
g_menu_append(section, "Paste", "win.paste");
|
g_menu_append(section, "Paste", "win.paste");
|
||||||
|
|
||||||
gtk_application_set_menubar(GTK_APPLICATION(app),
|
gtk_application_set_menubar(GTK_APPLICATION(app),
|
||||||
G_MENU_MODEL(menubar));
|
G_MENU_MODEL(menubar));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void copy_cb(GSimpleAction *action,
|
||||||
|
GVariant *parameter,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
copy_menu_action(user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static void paste_cb(GSimpleAction *action,
|
static void paste_cb(GSimpleAction *action,
|
||||||
GVariant *parameter,
|
GVariant *parameter,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -138,6 +146,7 @@ static void paste_cb(GSimpleAction *action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const GActionEntry win_actions[] = {
|
static const GActionEntry win_actions[] = {
|
||||||
|
{ "copy", copy_cb },
|
||||||
{ "paste", paste_cb },
|
{ "paste", paste_cb },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3243,10 +3243,17 @@ void init_clipboard(struct gui_data *inst)
|
|||||||
|
|
||||||
#endif /* JUST_USE_GTK_CLIPBOARD_UTF8 */
|
#endif /* JUST_USE_GTK_CLIPBOARD_UTF8 */
|
||||||
|
|
||||||
|
void copy_menu_action(void *frontend)
|
||||||
|
{
|
||||||
|
struct gui_data *inst = (struct gui_data *)frontend;
|
||||||
|
static const int clips[] = { MENU_CLIPBOARD };
|
||||||
|
term_request_copy(inst->term, clips, lenof(clips));
|
||||||
|
}
|
||||||
|
|
||||||
void paste_menu_action(void *frontend)
|
void paste_menu_action(void *frontend)
|
||||||
{
|
{
|
||||||
struct gui_data *inst = (struct gui_data *)frontend;
|
struct gui_data *inst = (struct gui_data *)frontend;
|
||||||
term_request_paste(inst->term, CLIP_CLIPBOARD);
|
term_request_paste(inst->term, MENU_CLIPBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_window_titles(struct gui_data *inst)
|
static void set_window_titles(struct gui_data *inst)
|
||||||
@ -4290,20 +4297,20 @@ void reset_terminal_menuitem(GtkMenuItem *item, gpointer data)
|
|||||||
void copy_clipboard_menuitem(GtkMenuItem *item, gpointer data)
|
void copy_clipboard_menuitem(GtkMenuItem *item, gpointer data)
|
||||||
{
|
{
|
||||||
struct gui_data *inst = (struct gui_data *)data;
|
struct gui_data *inst = (struct gui_data *)data;
|
||||||
static const int clips[] = { CLIP_CLIPBOARD };
|
static const int clips[] = { MENU_CLIPBOARD };
|
||||||
term_request_copy(inst->term, clips, lenof(clips));
|
term_request_copy(inst->term, clips, lenof(clips));
|
||||||
}
|
}
|
||||||
|
|
||||||
void paste_clipboard_menuitem(GtkMenuItem *item, gpointer data)
|
void paste_clipboard_menuitem(GtkMenuItem *item, gpointer data)
|
||||||
{
|
{
|
||||||
struct gui_data *inst = (struct gui_data *)data;
|
struct gui_data *inst = (struct gui_data *)data;
|
||||||
term_request_paste(inst->term, CLIP_CLIPBOARD);
|
term_request_paste(inst->term, MENU_CLIPBOARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_all_menuitem(GtkMenuItem *item, gpointer data)
|
void copy_all_menuitem(GtkMenuItem *item, gpointer data)
|
||||||
{
|
{
|
||||||
struct gui_data *inst = (struct gui_data *)data;
|
struct gui_data *inst = (struct gui_data *)data;
|
||||||
static const int clips[] = { CLIP_PRIMARY, CLIP_CLIPBOARD };
|
static const int clips[] = { COPYALL_CLIPBOARDS };
|
||||||
term_copyall(inst->term, clips, lenof(clips));
|
term_copyall(inst->term, clips, lenof(clips));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5224,8 +5231,10 @@ void new_session_window(Conf *conf, const char *geometry_string)
|
|||||||
MKMENUITEM("Clear Scrollback", clear_scrollback_menuitem);
|
MKMENUITEM("Clear Scrollback", clear_scrollback_menuitem);
|
||||||
MKMENUITEM("Reset Terminal", reset_terminal_menuitem);
|
MKMENUITEM("Reset Terminal", reset_terminal_menuitem);
|
||||||
MKSEP();
|
MKSEP();
|
||||||
MKMENUITEM("Copy to CLIPBOARD", copy_clipboard_menuitem);
|
MKMENUITEM("Copy to " CLIPNAME_EXPLICIT_OBJECT,
|
||||||
MKMENUITEM("Paste from CLIPBOARD", paste_clipboard_menuitem);
|
copy_clipboard_menuitem);
|
||||||
|
MKMENUITEM("Paste from " CLIPNAME_EXPLICIT_OBJECT,
|
||||||
|
paste_clipboard_menuitem);
|
||||||
MKMENUITEM("Copy All", copy_all_menuitem);
|
MKMENUITEM("Copy All", copy_all_menuitem);
|
||||||
MKSEP();
|
MKSEP();
|
||||||
s = dupcat("About ", appname, NULL);
|
s = dupcat("About ", appname, NULL);
|
||||||
|
@ -141,6 +141,8 @@ unsigned long getticks(void);
|
|||||||
#define CLIPUI_DEFAULT_AUTOCOPY FALSE
|
#define CLIPUI_DEFAULT_AUTOCOPY FALSE
|
||||||
#define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT
|
#define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT
|
||||||
#define CLIPUI_DEFAULT_INS CLIPUI_EXPLICIT
|
#define CLIPUI_DEFAULT_INS CLIPUI_EXPLICIT
|
||||||
|
#define MENU_CLIPBOARD CLIP_SYSTEM
|
||||||
|
#define COPYALL_CLIPBOARDS CLIP_SYSTEM
|
||||||
#else
|
#else
|
||||||
#define MOUSE_SELECT_CLIPBOARD CLIP_PRIMARY
|
#define MOUSE_SELECT_CLIPBOARD CLIP_PRIMARY
|
||||||
#define MOUSE_PASTE_CLIPBOARD CLIP_PRIMARY
|
#define MOUSE_PASTE_CLIPBOARD CLIP_PRIMARY
|
||||||
@ -152,6 +154,8 @@ unsigned long getticks(void);
|
|||||||
#define CLIPUI_DEFAULT_AUTOCOPY FALSE
|
#define CLIPUI_DEFAULT_AUTOCOPY FALSE
|
||||||
#define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT
|
#define CLIPUI_DEFAULT_MOUSE CLIPUI_IMPLICIT
|
||||||
#define CLIPUI_DEFAULT_INS CLIPUI_IMPLICIT
|
#define CLIPUI_DEFAULT_INS CLIPUI_IMPLICIT
|
||||||
|
#define MENU_CLIPBOARD CLIP_CLIPBOARD
|
||||||
|
#define COPYALL_CLIPBOARDS CLIP_PRIMARY, CLIP_CLIPBOARD
|
||||||
/* X11 supports arbitrary named clipboards */
|
/* X11 supports arbitrary named clipboards */
|
||||||
#define NAMED_CLIPBOARDS
|
#define NAMED_CLIPBOARDS
|
||||||
#endif
|
#endif
|
||||||
@ -181,6 +185,7 @@ GtkWidget *make_gtk_toplevel_window(void *frontend);
|
|||||||
void gtkcomm_setup(void);
|
void gtkcomm_setup(void);
|
||||||
|
|
||||||
/* Defined in gtkwin.c */
|
/* Defined in gtkwin.c */
|
||||||
|
void copy_menu_action(void *frontend);
|
||||||
void paste_menu_action(void *frontend);
|
void paste_menu_action(void *frontend);
|
||||||
|
|
||||||
/* Things pty.c needs from pterm.c */
|
/* Things pty.c needs from pterm.c */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user