Fixed STR #2644: support horizontal wheel movement under X11 and MSWindows.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9624 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
27e406f751
commit
cbcf0c9312
2
CHANGES
2
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
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user