aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWouter Van Rooy <woutervanrooy@gmail.com>2012-06-03 16:12:54 +0200
committerWouter Van Rooy <woutervanrooy@gmail.com>2012-06-03 16:12:54 +0200
commit9bc3d95d943f2c2543c7188c2565e7e02ba51ff1 (patch)
tree1b8381d40f0c0990c4bee7866f1fbc9609edd169
parent07b5d1ac58823b14a52489f52e052d463ae0149f (diff)
Implement regular copy-paste with ctrl-shift-c and ctrl-shift-v
-rw-r--r--svte.c24
1 files changed, 23 insertions, 1 deletions
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));