From ac4f84c88ab6526d78efa2b9639cca614a67bc3a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Yao=20Wei=20(=E9=AD=8F=E9=8A=98=E5=BB=B7)?= Date: Thu, 16 Aug 2012 15:33:39 +0800 Subject: [PATCH] fix passing ctrl-c when pressing ctrl-shift-c. drop dirty hack. --- src/lxterminal.c | 107 ++++++++++++++++++------------------------------------ 1 files changed, 36 insertions(+), 71 deletions(-) Index: lxterminal-0.1.11/src/lxterminal.c =================================================================== --- lxterminal-0.1.11.orig/src/lxterminal.c 2012-10-30 09:50:01.811232668 +0100 +++ lxterminal-0.1.11/src/lxterminal.c 2012-10-31 16:12:37.094372192 +0100 @@ -69,29 +69,28 @@ /* Menu and accelerator event handlers. */ static void terminal_initialize_switch_tab_accelerator(Term * term); static void terminal_update_alt(LXTerminal *terminal); -static void terminal_switch_tab_accelerator(Term * term); +static gboolean terminal_switch_tab_accelerator(Term * term); static void terminal_new_window_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_new_window_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_new_window_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_new_tab_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_new_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_close_tab_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_close_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_new_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_copy_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_copy_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_copy_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_paste_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_paste_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_paste_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_name_tab_response_event(GtkWidget * dialog, gint response, LXTerminal * terminal); static void terminal_name_tab_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_name_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_name_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_previous_tab_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_previous_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_previous_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_next_tab_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_next_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_next_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_move_tab_execute(LXTerminal * terminal, gint direction); static void terminal_move_tab_left_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_move_tab_left_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_move_tab_left_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_move_tab_right_activate_event(GtkAction * action, LXTerminal * terminal); -static void terminal_move_tab_right_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); +static gboolean terminal_move_tab_right_accelerator(LXTerminal * terminal, guint action, GtkWidget * item); static void terminal_about_activate_event(GtkAction * action, LXTerminal * terminal); /* Window creation, destruction, and control. */ @@ -349,11 +348,14 @@ /* Handler for accelerator n, where n is a digit. * Switch to the tab selected by the digit, if it exists. */ -static void terminal_switch_tab_accelerator(Term * term) +static gboolean terminal_switch_tab_accelerator(Term * term) { LXTerminal * terminal = term->parent; - if (term->index < gtk_notebook_get_n_pages(GTK_NOTEBOOK(terminal->notebook))) + if (term->index < gtk_notebook_get_n_pages(GTK_NOTEBOOK(terminal->notebook))) { gtk_notebook_set_current_page(GTK_NOTEBOOK(terminal->notebook), term->index); + return TRUE; + } + return FALSE; } /* Handler for "activate" signal on File/New Window menu item. @@ -366,9 +368,10 @@ } /* Handler for accelerator N. Open a new window. */ -static void terminal_new_window_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_new_window_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_new_window_activate_event(NULL, terminal); + return TRUE; } /* Handler for "activate" signal on File/New Tab menu item. @@ -427,9 +430,10 @@ } /* Handler for accelerator T. Open a new tab. */ -static void terminal_new_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_new_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_new_tab_activate_event(NULL, terminal); + return TRUE; } /* Handler for "activate" signal on File/Close Tab menu item. @@ -441,9 +445,10 @@ } /* Handler for accelerator W. Close the current tab. */ -static void terminal_close_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_close_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_close_tab_activate_event(NULL, terminal); + return TRUE; } /* Handler for "activate" signal on Edit/Copy menu item. @@ -455,9 +460,10 @@ } /* Handler for accelerator C. Copy to the clipboard. */ -static void terminal_copy_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_copy_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_copy_activate_event(NULL, terminal); + return TRUE; } /* Handler for "activate" signal on Edit/Paste menu item. @@ -469,9 +475,10 @@ } /* Handler for accelerator V. Paste from the clipboard. */ -static void terminal_paste_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_paste_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_paste_activate_event(NULL, terminal); + return TRUE; } /* Handler for "response" signal on Name Tab dialog. */ @@ -550,9 +557,10 @@ } /* Handler for accelerator R. Name the tab. */ -static void terminal_name_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_name_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_name_tab_activate_event(NULL, terminal); + return TRUE; } /* Handler for "activate" signal on Tabs/Previous Tab menu item. @@ -567,10 +575,11 @@ } /* Handler for accelerator . Cycle through tabs in the reverse direction. */ -static void terminal_previous_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_previous_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { GtkAction *_action = gtk_action_group_get_action(terminal->action_group, "Tabs_PreviousTab"); gtk_action_activate(_action); + return TRUE; } /* Handler for "activate" signal on Tabs/Next Tab menu item. @@ -585,10 +594,11 @@ } /* Handler for accelerator . Cycle through tabs in the forward direction. */ -static void terminal_next_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_next_tab_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { GtkAction *_action = gtk_action_group_get_action(terminal->action_group, "Tabs_NextTab"); gtk_action_activate(_action); + return TRUE; } /* Helper for move tab left and right. */ @@ -626,9 +636,10 @@ } /* Handler for accelerator . Move the tab one position in the reverse direction. */ -static void terminal_move_tab_left_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_move_tab_left_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_move_tab_execute(terminal, -1); + return TRUE; } /* Handler for "activate" signal on Tabs/Move Tab Right menu item. @@ -639,9 +650,10 @@ } /* Handler for accelerator . Move the tab one position in the forward direction. */ -static void terminal_move_tab_right_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) +static gboolean terminal_move_tab_right_accelerator(LXTerminal * terminal, guint action, GtkWidget * item) { terminal_move_tab_execute(terminal, 1); + return TRUE; } /* Handler for "activate" signal on Help/About menu item. */