diff options
author | Galik <[email protected]> | 2017-07-03 02:38:12 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-07-09 17:45:10 +0200 |
commit | d7656638ef5f76b5cbb768e777ee7f70a0c9129a (patch) | |
tree | 9b0fe6bc2e66a4526136aa8287c3cd041d24ba37 /src | |
parent | 5a5d9e5409472c18fb7e71c9859fcefa33036c18 (diff) | |
download | caja-d7656638ef5f76b5cbb768e777ee7f70a0c9129a.tar.bz2 caja-d7656638ef5f76b5cbb768e777ee7f70a0c9129a.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 5e206b24..52b47518 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -2472,48 +2472,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); |