]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix horizontal mouse wheel scrolling in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Sep 2013 00:20:06 +0000 (00:20 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 6 Sep 2013 00:20:06 +0000 (00:20 +0000)
Change the value of the appropriate adjustment instead of always using the
vertical one.

Closes #15469.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/gtk/window.cpp

index 2d108769d36aec54b3f21400e561157601520ef7..8fa6d43046f4aeb8f1eb33e7917084ce132e9254 100644 (file)
@@ -576,6 +576,7 @@ All (GUI):
 
 wxGTK:
 
 
 wxGTK:
 
+- Fix horizontal mouse wheel scrolling (minoki).
 - Fix wxMenu::GetTitle() before the menu is appended to the bar (David Hart).
 
 wxMSW:
 - Fix wxMenu::GetTitle() before the menu is appended to the bar (David Hart).
 
 wxMSW:
index 14fe92ca2451e4058bb2dd02aeecb5e2ce4d33a9..81b957556c9c765815c0629d75ff5a39727e760a 100644 (file)
@@ -1693,13 +1693,29 @@ window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
     if (win->GTKProcessEvent(event))
       return TRUE;
 
     if (win->GTKProcessEvent(event))
       return TRUE;
 
-    GtkRange *range = win->m_scrollBar[wxWindow::ScrollDir_Vert];
+    GtkRange *range;
+    switch (gdk_event->direction)
+    {
+        case GDK_SCROLL_UP:
+        case GDK_SCROLL_DOWN:
+            range = win->m_scrollBar[wxWindow::ScrollDir_Vert];
+            break;
+
+        case GDK_SCROLL_LEFT:
+        case GDK_SCROLL_RIGHT:
+            range = win->m_scrollBar[wxWindow::ScrollDir_Horz];
+            break;
+
+        default:
+            return false;
+    }
 
     if (range && gtk_widget_get_visible(GTK_WIDGET(range)))
     {
         GtkAdjustment* adj = gtk_range_get_adjustment(range);
         double delta = gtk_adjustment_get_step_increment(adj) * 3;
 
     if (range && gtk_widget_get_visible(GTK_WIDGET(range)))
     {
         GtkAdjustment* adj = gtk_range_get_adjustment(range);
         double delta = gtk_adjustment_get_step_increment(adj) * 3;
-        if (gdk_event->direction == GDK_SCROLL_UP)
+        if (gdk_event->direction == GDK_SCROLL_UP ||
+            gdk_event->direction == GDK_SCROLL_LEFT)
             delta = -delta;
 
         gtk_range_set_value(range, gtk_adjustment_get_value(adj) + delta);
             delta = -delta;
 
         gtk_range_set_value(range, gtk_adjustment_get_value(adj) + delta);