summaryrefslogtreecommitdiff
path: root/src/eom-util.c
diff options
context:
space:
mode:
authortamplan <[email protected]>2020-05-18 17:37:08 +0200
committerraveit65 <[email protected]>2020-07-13 10:33:43 +0200
commitc331ec988f543ddfd5e0636d15f7aeafeefa1b0f (patch)
tree55519a1021d2d1cbf5180bb2c680937b640c25f6 /src/eom-util.c
parent4b2acec0f78ca3402185e29aff0873c21f4b735e (diff)
downloadeom-c331ec988f543ddfd5e0636d15f7aeafeefa1b0f.tar.bz2
eom-c331ec988f543ddfd5e0636d15f7aeafeefa1b0f.tar.xz
Add tab scrolling support for dialog windows
Diffstat (limited to 'src/eom-util.c')
-rw-r--r--src/eom-util.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/eom-util.c b/src/eom-util.c
index 1dc42fa..69692d5 100644
--- a/src/eom-util.c
+++ b/src/eom-util.c
@@ -427,3 +427,64 @@ eom_util_show_file_in_filemanager (GFile *file, GtkWindow *toplevel)
if (!done)
_eom_util_show_file_in_filemanager_fallback (file, toplevel);
}
+
+gboolean
+eom_notebook_page_scroll_event_cb (GtkWidget *widget,
+ GdkEventScroll *event)
+
+{
+ 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;
+ case GDK_SCROLL_SMOOTH:
+ switch (gtk_notebook_get_tab_pos (notebook))
+ {
+ case GTK_POS_LEFT:
+ case GTK_POS_RIGHT:
+ if (event->delta_y > 0)
+ gtk_notebook_next_page (notebook);
+ else if (event->delta_y < 0)
+ gtk_notebook_prev_page (notebook);
+ break;
+ case GTK_POS_TOP:
+ case GTK_POS_BOTTOM:
+ if (event->delta_x > 0)
+ gtk_notebook_next_page (notebook);
+ else if (event->delta_x < 0)
+ gtk_notebook_prev_page (notebook);
+ break;
+ }
+ break;
+ }
+
+ return TRUE;
+}