[nautilus] view: threshold the delta information when scroll-zooming
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] view: threshold the delta information when scroll-zooming
- Date: Tue, 13 Mar 2012 14:27:29 +0000 (UTC)
commit f7b54cdba55a0856b201e62818059ac5007fac35
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Mar 13 10:25:34 2012 -0400
view: threshold the delta information when scroll-zooming
We don't want to zoom for every single event, since in case the device
supports smooth scrolling, we will get a lot of small events.
Pointed out by Stefano Facchini.
src/nautilus-view.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index f99a0f1..f58f97b 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -9483,16 +9483,21 @@ nautilus_view_handle_scroll_event (NautilusView *directory_view,
gdk_event_get_scroll_deltas ((const GdkEvent *) event,
&delta_x, &delta_y);
- if (delta_y > 0) {
+ /* threshold the delta, so that when events come from a device supporting
+ * smooth scrolling (e.g. a touchpad), we only change zoom level if the event
+ * is relevant enough.
+ */
+ if (delta_y > 0.25) {
/* emulate scroll down */
nautilus_view_bump_zoom_level (directory_view, -1);
return TRUE;
- } else if (delta_y < 0) {
+ } else if (delta_y < - 0.25) {
/* emulate scroll up */
nautilus_view_bump_zoom_level (directory_view, 1);
return TRUE;
} else {
- break;
+ /* eat event */
+ return TRUE;
}
case GDK_SCROLL_LEFT:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]