Bug 5634 - WM_MOUSEWHEEL isn't handeled correctry
Summary: WM_MOUSEWHEEL isn't handeled correctry
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 5501 5659 6973 6986 (view as bug list)
Depends on:
Blocks: 7101
  Show dependency tree
 
Reported: 2001-11-07 14:28 EST by Tetsuro Asahata CLA
Modified: 2014-05-16 18:22 EDT (History)
9 users (show)

See Also:


Attachments
Proposed fix: patch to SWT.win32.org.eclipse.swt.widgets.Control.java (980 bytes, patch)
2001-12-17 03:05 EST, Mario K CLA
no flags Details | Diff
Cleaner solution for handling mouse wheel events in Windows (2.16 KB, patch)
2001-12-19 01:51 EST, Mario K CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tetsuro Asahata CLA 2001-11-07 14:28:58 EST
org.eclipse.swt.widgets.Control.WM_MOUSEWHEEL(int, int) 
is just calling  OS.DefWindowProc (handle, OS.WM_MOUSEWHEEL, wParam, lParam);
and the comment said

* Feature in Windows.  If the WM_MOUSEWHEEL is handled by
* the control, it may not send WM_VSCROLL and WM_HSCROLL
* messages.  The fix is to intercept the WM_MOUSEWHEEL message
* and call the DefWindowProc which will convert the message to 
* send the appropriate WM_HSCROLL or WM_VSCROLL message.

But this is probably not true.

On WindowsXP with OS's default mouse driver for Microsoft Wheel Mouse,
all editors such as DefaultText Editor or Java Editor don't scroll
by mouse wheel.

If the Microsoft IntelliPoint driver(4.0) is installed, then they start  
working.
IntelliPoint driver has additional functionality which enables
mouse wheel to virtually all apprications.
(You can turn on/off this feature from mouse properties
->wheel tab->Wheel Troubleshooter->Advanced button.)

If the feature is turned off, then all eclipse editors 
don't work with mouse wheel.

However, help viewer will work on such environment since
it is actually InternetExplorer, and it directry supports
WM_MOUSEWHEEL event.

I guess SWT also need to handle the event directry.
Comment 1 Mike Wilson CLA 2001-11-07 14:56:06 EST
I agree that we should handle it directly.
Comment 2 Mike Wilson CLA 2001-12-11 13:36:59 EST
*** Bug 5501 has been marked as a duplicate of this bug. ***
Comment 3 Brian Thomson CLA 2001-12-12 23:25:34 EST
On Linux, since the X protocol doesn't define wheel events, the usual solution
is to have the server map wheel movement into button 4 and button 5 events. Most
applications don't bind actions to these natively, so the usual next step is to
provide a Translation Table resource that maps them to scroll actions, but SWT
could support the buttons directly.  For the full story, see
http://koala.ilog.fr/colas/mouse-wheel-scroll/

Brian Thomson, IBM
Comment 4 Mario K CLA 2001-12-17 03:05:55 EST
Created attachment 180 [details]
Proposed fix: patch to SWT.win32.org.eclipse.swt.widgets.Control.java
Comment 5 Mario K CLA 2001-12-17 03:26:00 EST
I'm using Eclipse on Win2k and was experiencing the same problem. After some 
research I came to the same conclusion Veronika did: WM_MOUSEWHEEL (int 
wParam, int lParam) call to OS.DefWindowProc does not handle events by 
default. I got the mouse wheel working by generating a WM_VSCROLL event from 
WM_MOUSEWHEEL after detecting that the event wasn't handled automatically. The 
proposed solution is attached.

Although the mouse wheel does work, it scrolls only a single line at a time. 
The current rate is too slow to scroll through long files. Windows defaults 
the number of lines to scroll to 3.
Comment 6 Bernard Spanyar CLA 2001-12-17 15:04:37 EST
Should also be fixed on the Motif/Linux distribution.
Bernard
Comment 7 Mario K CLA 2001-12-19 01:51:43 EST
Created attachment 198 [details]
Cleaner solution for handling mouse wheel events in Windows
Comment 8 Mario K CLA 2001-12-19 02:07:17 EST
A better way to handle WM_MOUSEWHEEL is to process them in the Scrollable 
class. The second patch does just that, replacing the first one.

After digging through some windows documentation I found lots of information 
on how to handle WM_MOUSEWHEEL events. I tried to build all the documented 
rules into the code. It seems to be working very well.

There is one workaround in the code though because I needed to make a system 
call that is not available in the current library. The code is using an 
overloaded version of OS.SystemParametersInfo but the new builds of the 
library should include the signature to support SPI_GETWHEELSCROLLLINES calls.
Comment 9 Mike Wilson CLA 2001-12-19 11:21:29 EST
*** Bug 6986 has been marked as a duplicate of this bug. ***
Comment 10 Mike Wilson CLA 2001-12-19 11:21:48 EST
*** Bug 5659 has been marked as a duplicate of this bug. ***
Comment 11 Kevin Haaland CLA 2001-12-19 15:35:21 EST
*** Bug 6973 has been marked as a duplicate of this bug. ***
Comment 12 Veronika Irvine CLA 2002-01-04 17:06:40 EST
Fixed in > 20020104 for Windows.

The fix implemented is not the same as the fixed described by Mario.  The 
implemented fix allows the native widgets to implement WM_MOUSEWHEEL in their 
own way and only provides a workaround for custom or emulated widgets.  It 
handles horizontal and vertical scrolling and sends WM_VSCROLL and WM_HSCROLL 
messages.

The fix is only for the Windows platform - I am still investigating the other 
windowing systems we support.
Comment 13 OTI Support CLA 2002-03-20 20:02:58 EST
This report is marked as 1.0.  One of the listed duplicate reports
is for 2.0.   What version is this fix targeted for?
Comment 14 Veronika Irvine CLA 2002-03-21 15:05:58 EST
This bug has been fixed in the 2.0 stream only.
Comment 15 Steve Northover CLA 2002-08-09 17:37:50 EDT
This PR has been fixed on Windows for a while.  Brian, if you feel that the 
support on Linux is insufficient, can you enter a new PR that describes the 
work you would like done on Linux?