diff options
author | lukefromdc <[email protected]> | 2016-11-03 23:31:30 -0400 |
---|---|---|
committer | monsta <[email protected]> | 2017-01-22 13:00:38 +0300 |
commit | d773ac2760052190cccb7ca1161a005fb2464b7d (patch) | |
tree | 45251ec975577c7c897c0f9725d563e93277b95e | |
parent | e3d3a9a989d36f3e646adf1cc5125af831ea28f2 (diff) | |
download | caja-d773ac2760052190cccb7ca1161a005fb2464b7d.tar.bz2 caja-d773ac2760052190cccb7ca1161a005fb2464b7d.tar.xz |
GTK+3: fix mousewheel scrolling in compact view
with patch by ZenWalker to fix horizontal wheel scrolling
cherry-picked and squashed from:
https://github.com/mate-desktop/caja/commit/f34590dd7a71251515b90cd9812878b7d26d30b6
https://github.com/mate-desktop/caja/commit/ae053dbf2cc26ae74df5e782261c3a3bc7126763
https://github.com/mate-desktop/caja/commit/3e93f938000cdb24a6137daecd77fe010ae93f36
-rw-r--r-- | src/file-manager/fm-icon-view.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index 933f9869..ec167810 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -2494,6 +2494,30 @@ fm_icon_view_scroll_event (GtkWidget *widget, icon_view = FM_ICON_VIEW (widget); +#if GTK_CHECK_VERSION (3, 0, 0) + 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)) +#else if (icon_view->details->compact && (scroll_event->direction == GDK_SCROLL_UP || scroll_event->direction == GDK_SCROLL_DOWN)) @@ -2507,6 +2531,7 @@ fm_icon_view_scroll_event (GtkWidget *widget, scroll_event_copy = (GdkEventScroll *) event_copy; if (scroll_event_copy->direction == GDK_SCROLL_UP) +#endif { scroll_event_copy->direction = GDK_SCROLL_LEFT; } |