diff options
author | Galik <[email protected]> | 2017-07-03 02:38:12 +0100 |
---|---|---|
committer | Galik <[email protected]> | 2017-07-03 02:38:12 +0100 |
commit | 87687fcb9440d58e8cbfe58889a7b71a02499a2a (patch) | |
tree | 61f045371d5178887000992d4acbcdd20e2c88fe /src | |
parent | 45bc0ea7fdf5efa670a83b5f6f8d4f91a13f6b15 (diff) | |
download | caja-87687fcb9440d58e8cbfe58889a7b71a02499a2a.tar.bz2 caja-87687fcb9440d58e8cbfe58889a7b71a02499a2a.tar.xz |
fix vertical Compact View scrolling in fm_icon_view_scroll_event()
Was always scrolling to right when using sideways scrolling devices.
Now scrolls left or right with sideways scrolling devices and adjusts
vertical scrolling devices to scroll sideways.
Diffstat (limited to 'src')
-rw-r--r-- | src/file-manager/fm-icon-view.c | 49 |
1 files changed, 15 insertions, 34 deletions
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index dab35561..4b416187 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -2479,48 +2479,29 @@ fm_icon_view_scroll_event (GtkWidget *widget, GdkEventScroll *scroll_event) { FMIconView *icon_view; - GdkEvent *event_copy; - GdkEventScroll *scroll_event_copy; gboolean ret; icon_view = FM_ICON_VIEW (widget); - if (icon_view->details->compact && - (scroll_event->direction == GDK_SCROLL_UP || - scroll_event->direction == GDK_SCROLL_DOWN || - scroll_event->direction == GDK_SCROLL_SMOOTH)) { - ret = fm_directory_view_handle_scroll_event (FM_DIRECTORY_VIEW (icon_view), scroll_event); - if (!ret) - { - /* in column-wise layout, re-emit vertical mouse scroll events as horizontal ones, - * if they don't bump zoom */ - event_copy = gdk_event_copy ((GdkEvent *) scroll_event); - - scroll_event_copy = (GdkEventScroll *) event_copy; - - /* transform vertical integer smooth scroll events into horizontal events */ - if (scroll_event_copy->direction == GDK_SCROLL_SMOOTH && scroll_event_copy->delta_x == 0) { - if (scroll_event_copy->delta_y == 1.0) { - scroll_event_copy->direction = GDK_SCROLL_DOWN; - } else if (scroll_event_copy->delta_y == -1.0) { - scroll_event_copy->direction = GDK_SCROLL_UP; - } - } - if ((scroll_event_copy->direction == GDK_SCROLL_UP) || (scroll_event_copy->delta_x == -1.0)) + if(icon_view->details->compact) + { + if((ret = fm_directory_view_handle_scroll_event(FM_DIRECTORY_VIEW(icon_view), scroll_event))) + return ret; + if(scroll_event->direction == GDK_SCROLL_UP) + scroll_event->direction = GDK_SCROLL_LEFT; + else if(scroll_event->direction == GDK_SCROLL_DOWN) + scroll_event->direction = GDK_SCROLL_RIGHT; + else if(scroll_event->direction == GDK_SCROLL_SMOOTH) + { + /* no x value implies only vertical scrolling enabled */ + if(scroll_event->delta_x == 0.0) { - scroll_event_copy->direction = GDK_SCROLL_LEFT; - } - else - { - scroll_event_copy->direction = GDK_SCROLL_RIGHT; + /* convert vertical to horizontal */ + scroll_event->delta_x = scroll_event->delta_y; + scroll_event->delta_y = 0.0; } - - ret = gtk_widget_event (widget, event_copy); - gdk_event_free (event_copy); } - - return ret; } return GTK_WIDGET_CLASS (fm_icon_view_parent_class)->scroll_event (widget, scroll_event); |