From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 11/12] ui/gtk: copy to clipboard support
Date: Tue, 10 May 2016 07:51:56 +0200 [thread overview]
Message-ID: <1462859517-30207-12-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1462859517-30207-1-git-send-email-kraxel@redhat.com>
From: "Michael S. Tsirkin" <mst@redhat.com>
This adds a menu item to copy current selection to clipboard.
Seems handy for copying out guest error messages.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1460924740-24513-1-git-send-email-mst@redhat.com
[ kraxel: fix build with CONFIG_VTE=n ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/ui/gtk.c b/ui/gtk.c
index 2e360e3..8201584 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -139,6 +139,7 @@ struct GtkDisplayState {
GtkWidget *view_menu_item;
GtkWidget *view_menu;
GtkWidget *full_screen_item;
+ GtkWidget *copy_item;
GtkWidget *zoom_in_item;
GtkWidget *zoom_out_item;
GtkWidget *zoom_fixed_item;
@@ -1263,6 +1264,16 @@ static void gd_menu_full_screen(GtkMenuItem *item, void *opaque)
gd_update_cursor(vc);
}
+static void gd_menu_copy(GtkMenuItem *item, void *opaque)
+{
+ GtkDisplayState *s = opaque;
+ VirtualConsole *vc = gd_vc_find_current(s);
+
+#if defined(CONFIG_VTE)
+ vte_terminal_copy_clipboard(VTE_TERMINAL(vc->vte.terminal));
+#endif
+}
+
static void gd_accel_full_screen(void *opaque)
{
GtkDisplayState *s = opaque;
@@ -1825,6 +1836,8 @@ static void gd_connect_signals(GtkDisplayState *s)
G_CALLBACK(gd_menu_powerdown), s);
g_signal_connect(s->quit_item, "activate",
G_CALLBACK(gd_menu_quit), s);
+ g_signal_connect(s->copy_item, "activate",
+ G_CALLBACK(gd_menu_copy), s);
g_signal_connect(s->full_screen_item, "activate",
G_CALLBACK(gd_menu_full_screen), s);
g_signal_connect(s->zoom_in_item, "activate",
@@ -1958,6 +1971,9 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s)
s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
+ s->copy_item = gtk_menu_item_new_with_mnemonic(_("_Copy"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->copy_item);
+
gtk_accel_group_connect(s->accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
g_cclosure_new_swap(G_CALLBACK(gd_accel_full_screen), s, NULL));
#if GTK_CHECK_VERSION(3, 8, 0)
--
1.8.3.1
next prev parent reply other threads:[~2016-05-10 5:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-10 5:51 [Qemu-devel] [PULL 00/12] ui patch queue Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 01/12] ui: gtk: fix crash when terminal inner-border is NULL Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 02/12] ui: sdl2: Release grab before opening console window Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 03/12] configure: build SDL if only SDL2 available Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 04/12] configure: error on unknown --with-sdlabi value Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 05/12] configure: add echo_version helper Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 06/12] configure: report GTK version Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 07/12] configure: report SDL version Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 08/12] configure: support vte-2.91 Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 09/12] ui: gtk: Fix a runtime warning on vte >= 0.37 Gerd Hoffmann
2016-05-10 5:51 ` [Qemu-devel] [PULL 10/12] ui: gtk: Fix some deprecation warnings Gerd Hoffmann
2016-05-10 5:51 ` Gerd Hoffmann [this message]
2016-05-10 5:51 ` [Qemu-devel] [PULL 12/12] spice/gl: add & use qemu_spice_gl_monitor_config Gerd Hoffmann
2016-05-10 14:08 ` [Qemu-devel] [PULL 00/12] ui patch queue Cole Robinson
2016-05-12 13:26 ` Peter Maydell
2016-05-12 13:57 ` Gerd Hoffmann
2016-05-13 7:56 ` Gerd Hoffmann
2016-05-13 10:13 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462859517-30207-12-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.