From 9bc3d95d943f2c2543c7188c2565e7e02ba51ff1 Mon Sep 17 00:00:00 2001 From: Wouter Van Rooy Date: Sun, 3 Jun 2012 16:12:54 +0200 Subject: Implement regular copy-paste with ctrl-shift-c and ctrl-shift-v --- svte.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'svte.c') diff --git a/svte.c b/svte.c index 4465b76..ad10d43 100644 --- a/svte.c +++ b/svte.c @@ -54,6 +54,8 @@ static void configure_window(); static void tab_focus(GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data); static void set_window_title(guint page_num, term *t); +static void copy_clipboard(); +static void paste_clipboard(); static GQuark term_data_id = 0; @@ -107,7 +109,6 @@ static void quit() { gboolean event_key(GtkWidget *widget, GdkEventKey *event) { guint(g) = event->keyval; - if ((event->state & (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) == (GDK_CONTROL_MASK|GDK_SHIFT_MASK)) { if (g == GDK_T) { @@ -122,6 +123,14 @@ gboolean event_key(GtkWidget *widget, GdkEventKey *event) { tab_close(); return TRUE; } + if (g == GDK_V) { + paste_clipboard(); + return TRUE; + } + if (g == GDK_C) { + copy_clipboard(); + return TRUE; + } } if ((event->state & (GDK_MOD1_MASK) ) == (GDK_MOD1_MASK)) { if (g == GDK_Left) { @@ -152,6 +161,19 @@ gboolean event_button(GtkWidget *widget, GdkEventButton *button_event, struct te return FALSE; } +static void copy_clipboard(){ + gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(svte.notebook)); + struct term *t; + t = get_page_term(NULL, page); + vte_terminal_copy_clipboard(VTE_TERMINAL(t->vte)); +} + +static void paste_clipboard(){ + gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(svte.notebook)); + struct term *t; + t = get_page_term(NULL, page); + vte_terminal_paste_clipboard(VTE_TERMINAL(t->vte)); +} static void tab_close() { gint page = gtk_notebook_get_current_page(GTK_NOTEBOOK(svte.notebook)); -- cgit v1.2.3