Author: bgbnbigben
Date: 2011-01-26 07:16:17 -0800 (Wed, 26 Jan 2011)
New Revision: 8317
Log:
Added in horizontal mouse scrolling for windows, though this still needs to be
tested as I've not yet booted my Vista box (for reasons unbeknownst to mankind,
Microsoft couldn't be bothered backporting WM_MOUSEHWHEEL to XP).
This change required a slight modification of the BUTTON enumeration to include
BUTTON4/5/6/7.
Further, fixed up STR #2325 and half of #1637 by including dirent.h on mingw
compilers
Modified:
trunk/fltk/events.h
trunk/src/win32/run.cxx
trunk/src/win32/scandir.c
Modified: trunk/fltk/events.h
===================================================================
--- trunk/fltk/events.h 2011-01-26 14:59:50 UTC (rev 8316)
+++ trunk/fltk/events.h 2011-01-26 15:16:17 UTC (rev 8317)
@@ -184,6 +184,10 @@
BUTTON1 = 0x01000000, /*!< Left mouse button held down */
BUTTON2 = 0x02000000, /*!< Middle mouse button held down */
BUTTON3 = 0x04000000, /*!< Right mouse button held down */
+ BUTTON4 = 0x08000000, /*!< Mouse wheel scroll up */
+ BUTTON5 = 0x10000000, /*!< Mouse wheel scroll down */
+ BUTTON6 = 0x20000000, /*!< Mouse wheel scroll left */
+ BUTTON7 = 0x40000000, /*!< Mouse wheel scroll right */
ANY_BUTTON = 0xff000000, /*!< Any mouse button (up to 8) */
#if defined(__APPLE__)
ACCELERATOR = CTRL,
Modified: trunk/src/win32/run.cxx
===================================================================
--- trunk/src/win32/run.cxx 2011-01-26 14:59:50 UTC (rev 8316)
+++ trunk/src/win32/run.cxx 2011-01-26 15:16:17 UTC (rev 8317)
@@ -38,6 +38,7 @@
#include <fltk/utf.h>
#include <fltk/Monitor.h>
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <limits.h>
@@ -114,6 +115,10 @@
# define WM_MOUSEWHEEL 0x020a
#endif
+#ifndef WM_MOUSEHWHEEL
+# define WM_MOUSEHWHEEL 0x020e
+#endif
+
#ifndef WHEEL_DELTA
# define WHEEL_DELTA 120 // according to MSDN.
#endif
@@ -1648,15 +1653,39 @@
return 0;}
case WM_MOUSEWHEEL: {
- static int delta = 0; // running total of all motion
- delta -= (SHORT)(HIWORD(wParam));
- if ((e_dy = delta / WHEEL_DELTA)) {
- delta -= e_dy * WHEEL_DELTA;
+ static int ydelta = 0; // running total of all motion
+ ydelta -= (SHORT)(HIWORD(wParam));
+ if ((e_dy = ydelta / WHEEL_DELTA)) {
+ if ((SHORT)(HIWORD(wParam)) < 0) {
+ e_keysym = WheelUp;
+ e_state |= BUTTON4;
+ } else {
+ e_keysym = WheelDown;
+ e_state |= BUTTON5;
+ }
+ ydelta -= e_dy * WHEEL_DELTA;
handle(MOUSEWHEEL, xmousewin ? xmousewin : window);
}
return 0;
}
+ case WM_MOUSEHWHEEL: {
+ puts("MOUSEHWHEEL!");
+ static int xdelta = 0;
+ xdelta -= (SHORT)(HIWORD(wParam));
+ if ((e_dx = xdelta / WHEEL_DELTA)) {
+ if ((SHORT)(HIWORD(wParam)) < 0) {
+ e_keysym = WheelLeft;
+ e_state |= BUTTON6;
+ } else {
+ e_keysym = WheelRight;
+ e_state |= BUTTON7;
+ }
+ xdelta -= e_dx * WHEEL_DELTA;
+ handle(MOUSEWHEEL, xmousewin ? xmousewin : window);
+ }
+ }
+
case WM_GETMINMAXINFO:
if (window) CreatedWindow::find(window)->set_minmax((LPMINMAXINFO)lParam);
break;
Modified: trunk/src/win32/scandir.c
===================================================================
--- trunk/src/win32/scandir.c 2011-01-26 14:59:50 UTC (rev 8316)
+++ trunk/src/win32/scandir.c 2011-01-26 15:16:17 UTC (rev 8317)
@@ -32,7 +32,11 @@
extern "C" {
#endif
+#if HAVE_DIRENT_H
+# include <dirent.h>
+#else
struct dirent { char d_name[1]; };
+#endif
int scandir(const char *dirname, struct dirent ***namelist,
int (*select)(struct dirent *),
@@ -97,4 +101,4 @@
//
// End of "$Id: scandir.c 1339 2006-04-03 22:47:29Z spitzak $".
-//
\ No newline at end of file
+//
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit