summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES2
-rw-r--r--src/Fl_win32.cxx16
-rw-r--r--src/Fl_x.cxx7
3 files changed, 25 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index d2b8e0c8c..59040f5d9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -32,6 +32,8 @@ CHANGES IN FLTK 1.3.1
(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
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx
index 18a34dd05..e1107cb6a 100644
--- a/src/Fl_win32.cxx
+++ b/src/Fl_win32.cxx
@@ -1115,12 +1115,28 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
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;
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index ef3906a4e..fa48e5fef 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1506,12 +1506,19 @@ int fl_handle(const XEvent& thisevent)
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;