aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-05-15 22:23:10 +0800
committerMilan Crha <mcrha@redhat.com>2012-05-15 22:24:29 +0800
commit5e379370ae0653c229308e1d7af31a54739ccc7e (patch)
treea9079e286e9e6a006d58ffa064d53d50091aab03 /modules
parent0f7f848300bb2282cde20777c26168bdffe2d955 (diff)
downloadgsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.tar
gsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.tar.gz
gsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.tar.bz2
gsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.tar.lz
gsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.tar.xz
gsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.tar.zst
gsoc2013-evolution-5e379370ae0653c229308e1d7af31a54739ccc7e.zip
Bug #671585 - Add support for smooth scrolling devices
Diffstat (limited to 'modules')
-rw-r--r--modules/calendar/e-cal-shell-view-private.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 4526570202..c256c9aebe 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -202,19 +202,40 @@ cal_shell_view_date_navigator_selection_changed_cb (ECalShellView *cal_shell_vie
gnome_calendar_notify_dates_shown_changed (calendar);
}
-static void
+static gboolean
cal_shell_view_date_navigator_scroll_event_cb (ECalShellView *cal_shell_view,
GdkEventScroll *event,
ECalendar *date_navigator)
{
ECalendarItem *calitem;
GDate start_date, end_date;
+ GdkScrollDirection direction;
calitem = date_navigator->calitem;
if (!e_calendar_item_get_selection (calitem, &start_date, &end_date))
- return;
+ return FALSE;
+
+ direction = event->direction;
+
+ #if GTK_CHECK_VERSION(3,3,18)
+ if (direction == GDK_SCROLL_SMOOTH) {
+ static gdouble total_delta_y = 0.0;
+
+ total_delta_y += event->delta_y;
- switch (event->direction) {
+ if (total_delta_y >= 1.0) {
+ total_delta_y = 0.0;
+ direction = GDK_SCROLL_DOWN;
+ } else if (total_delta_y <= -1.0) {
+ total_delta_y = 0.0;
+ direction = GDK_SCROLL_UP;
+ } else {
+ return FALSE;
+ }
+ }
+ #endif
+
+ switch (direction) {
case GDK_SCROLL_UP:
g_date_subtract_months (&start_date, 1);
g_date_subtract_months (&end_date, 1);
@@ -226,7 +247,7 @@ cal_shell_view_date_navigator_scroll_event_cb (ECalShellView *cal_shell_view,
break;
default:
- g_return_if_reached ();
+ g_return_val_if_reached (FALSE);
}
/* XXX Does ECalendarItem emit a signal for this? If so, maybe
@@ -235,6 +256,8 @@ cal_shell_view_date_navigator_scroll_event_cb (ECalShellView *cal_shell_view,
cal_shell_view_date_navigator_selection_changed_cb (
cal_shell_view, calitem);
+
+ return TRUE;
}
static void