Author: manolo
Date: 2012-06-21 01:52:29 -0700 (Thu, 21 Jun 2012)
New Revision: 9624
Log:
Fixed STR #2644: support horizontal wheel movement under X11 and MSWindows.

Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/src/Fl_win32.cxx
   branches/branch-1.3/src/Fl_x.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2012-06-19 20:13:16 UTC (rev 9623)
+++ branches/branch-1.3/CHANGES 2012-06-21 08:52:29 UTC (rev 9624)
@@ -32,6 +32,8 @@
        (STR #2600)
        - Improved the description of page size and orientation by 
        Fl_PostScript_File_Device.
+       - Added support for horizontal wheel movement under X11 and MSWindows 
Vista
+       and above (STR #2644).
 
 CHANGES IN FLTK 1.3.0
 

Modified: branches/branch-1.3/src/Fl_win32.cxx
===================================================================
--- branches/branch-1.3/src/Fl_win32.cxx        2012-06-19 20:13:16 UTC (rev 
9623)
+++ branches/branch-1.3/src/Fl_win32.cxx        2012-06-21 08:52:29 UTC (rev 
9624)
@@ -1115,12 +1115,28 @@
   case WM_MOUSEWHEEL: {
     static int delta = 0; // running total of all motion
     delta += (SHORT)(HIWORD(wParam));
+    Fl::e_dx = 0;
     Fl::e_dy = -delta / WHEEL_DELTA;
     delta += Fl::e_dy * WHEEL_DELTA;
     if (Fl::e_dy) Fl::handle(FL_MOUSEWHEEL, window);
     return 0;
   }
 
+// This is only defined on Vista and upwards...
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020E
+#endif
+      
+  case WM_MOUSEHWHEEL: {
+      static int delta = 0; // running total of all motion
+      delta += (SHORT)(HIWORD(wParam));
+      Fl::e_dy = 0;
+      Fl::e_dx = delta / WHEEL_DELTA;
+      delta -= Fl::e_dx * WHEEL_DELTA;
+      if (Fl::e_dx) Fl::handle(FL_MOUSEWHEEL, window);
+      return 0;
+    }
+
   case WM_GETMINMAXINFO:
     Fl_X::i(window)->set_minmax((LPMINMAXINFO)lParam);
     break;

Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx    2012-06-19 20:13:16 UTC (rev 9623)
+++ branches/branch-1.3/src/Fl_x.cxx    2012-06-21 08:52:29 UTC (rev 9624)
@@ -1506,12 +1506,19 @@
   case ButtonPress:
     Fl::e_keysym = FL_Button + xevent.xbutton.button;
     set_event_xy();
+    Fl::e_dx = Fl::e_dy = 0;
     if (xevent.xbutton.button == Button4) {
       Fl::e_dy = -1; // Up
       event = FL_MOUSEWHEEL;
     } else if (xevent.xbutton.button == Button5) {
       Fl::e_dy = +1; // Down
       event = FL_MOUSEWHEEL;
+    } else if (xevent.xbutton.button == 6) {
+       Fl::e_dx = -1; // Left
+       event = FL_MOUSEWHEEL;
+    } else if (xevent.xbutton.button == 7) {
+       Fl::e_dx = +1; // Right
+       event = FL_MOUSEWHEEL;
     } else {
       Fl::e_state |= (FL_BUTTON1 << (xevent.xbutton.button-1));
       event = FL_PUSH;

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to