[nautilus] view: handle smooth scroll events for zooming



commit 1a76e044a2c9b834d00c4ea30f1e3af3321d8cdd
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Mar 8 10:06:38 2012 -0500

    view: handle smooth scroll events for zooming
    
    Instead of reaching the g_assert_not_reached() and crash.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671650

 src/nautilus-view.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 1be5be9..ed0c78c 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -9465,6 +9465,8 @@ gboolean
 nautilus_view_handle_scroll_event (NautilusView *directory_view,
 				   GdkEventScroll *event)
 {
+	gdouble delta_x, delta_y;
+
 	if (event->state & GDK_CONTROL_MASK) {
 		switch (event->direction) {
 		case GDK_SCROLL_UP:
@@ -9477,6 +9479,20 @@ nautilus_view_handle_scroll_event (NautilusView *directory_view,
 			nautilus_view_bump_zoom_level (directory_view, -1);
 			return TRUE;
 
+		case GDK_SCROLL_SMOOTH:
+			gdk_event_get_scroll_deltas ((const GdkEvent *) event,
+						     &delta_x, &delta_y);
+
+			if (delta_y > 0) {
+				nautilus_view_bump_zoom_level (directory_view, 1);
+				return TRUE;
+			} else if (delta_y < 0) {
+				nautilus_view_bump_zoom_level (directory_view, -1);
+				return TRUE;				
+			} else {
+				break;
+			}
+
 		case GDK_SCROLL_LEFT:
 		case GDK_SCROLL_RIGHT:
 			break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]