summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/terminal-window.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/src/terminal-window.c b/src/terminal-window.c
index e7b53a2..132b98b 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -157,6 +157,9 @@ static void notebook_page_removed_callback (GtkWidget *notebook,
GtkWidget *container,
guint page_num,
TerminalWindow *window);
+static gboolean notebook_scroll_event_cb (GtkWidget *notebook,
+ GdkEventScroll *event,
+ TerminalWindow *window);
/* Menu action callbacks */
static void file_new_window_callback (GtkAction *action,
@@ -2022,7 +2025,11 @@ terminal_window_init (TerminalWindow *window)
g_signal_connect_data (priv->notebook, "page-reordered",
G_CALLBACK (terminal_window_update_tabs_menu_sensitivity),
window, NULL, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
-
+
+ gtk_widget_add_events (priv->notebook, GDK_SCROLL_MASK);
+ g_signal_connect (priv->notebook, "scroll-event",
+ G_CALLBACK (notebook_scroll_event_cb), window);
+
g_signal_connect (priv->notebook, "create-window",
G_CALLBACK (handle_tab_droped_on_desktop), window);
@@ -2885,6 +2892,50 @@ terminal_window_update_copy_selection (TerminalScreen *screen,
TERMINAL_PROFILE_COPY_SELECTION);
}
+static gboolean
+notebook_scroll_event_cb (GtkWidget *widget,
+ GdkEventScroll *event,
+ TerminalWindow *window)
+{
+ GtkNotebook *notebook = GTK_NOTEBOOK (widget);
+ GtkWidget *child, *event_widget, *action_widget;
+
+ child = gtk_notebook_get_nth_page (notebook, gtk_notebook_get_current_page (notebook));
+ if (child == NULL)
+ return FALSE;
+
+ event_widget = gtk_get_event_widget ((GdkEvent *) event);
+
+ /* Ignore scroll events from the content of the page */
+ if (event_widget == NULL ||
+ event_widget == child ||
+ gtk_widget_is_ancestor (event_widget, child))
+ return FALSE;
+
+ /* And also from the action widgets */
+ action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START);
+ if (event_widget == action_widget ||
+ (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
+ return FALSE;
+ action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END);
+ if (event_widget == action_widget ||
+ (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget)))
+ return FALSE;
+
+ switch (event->direction) {
+ case GDK_SCROLL_RIGHT:
+ case GDK_SCROLL_DOWN:
+ gtk_notebook_next_page (notebook);
+ break;
+ case GDK_SCROLL_LEFT:
+ case GDK_SCROLL_UP:
+ gtk_notebook_prev_page (notebook);
+ break;
+ }
+
+ return TRUE;
+}
+
void
terminal_window_update_geometry (TerminalWindow *window)
{