SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Mouse Scrolling in Vista 32 (only?)

Last post 05-11-2008 2:24 PM by DanielGrunwald. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 05-11-2008 11:49 AM

    • Ratheous
    • Not Ranked
    • Joined on 08-18-2006
    • Oregon
    • Posts 3

    Mouse Scrolling in Vista 32 (only?)

    When using SD 3.0 Beta 1 on Vista 32 with Microsoft Wireless Laser Mouse 5000/6000 models (versions with smooth, clickless scrollwheels) I found I had to spin the wheel extremely fast to get the editor to scroll at all. This irritated me, because I love these mice, and anything that distracts me from programming is bad.

     A quick look at TextAreaControl.cs turned up a variable called MAX_DELTA in HandleMouseWheel() which is assigned a value of 120, and a 'Delta' property of MouseEventArgs which together are used to calculate the distance to scroll on the event. A comment on the variable states: "basically it's constant now, but could be changed later by MS."  Well, it's later.

     Turns out that not all mice report the same Delta values, at least in Vista; I'm guessing XP always reports (at least) 120 because the same mouse scrolls SD normally on an XP machine. In Vista my mouse reports the Delta in increments of 30 (+/-); and System.Windows.Forms.SystemInformation.MouseWheelScrollLines = 4. 

     Bearing in mind that I know next to nothing about mouse scrolling, I made the following changes which work nicely on all my Vista and XP systems/mice.

    From:

    int multiplier = Math.Abs(e.Delta) / MAX_DELTA;

    /* ... */

    newValue = this.vScrollBar.Value -  (TextEditorProperties.MouseWheelScrollDown ? 1 : -1) * Math.Sign(e.Delta) * System.Windows.Forms.SystemInformation.MouseWheelScrollLines * vScrollBar.SmallChange * multiplier;

     To:

    int multiplier = Convert.ToInt32(Math.Ceiling(System.Windows.Forms.SystemInformation.MouseWheelScrollLines * ((float)Math.Abs(e.Delta) / MAX_DELTA)));

    /* ... */

    newValue = this.vScrollBar.Value - (TextEditorProperties.MouseWheelScrollDown ? 1 : -1) * Math.Sign(e.Delta) * vScrollBar.SmallChange * multiplier;

     Now multiplier equals between 1 and 6, depending on how fast I spin the wheel. Using a different (Logitech) mouse on my Vista machine, multiplier always equals 4. On XP (with every mouse I own) multiplier = 3. So in addition to working properly on Vista with these mice, I believe the results in XP are consistent with the original algorithm. It should also work acceptably with nonstandard devices like the tablet mentioned here: http://www.mail-archive.com/allbugs@openoffice.org/msg347990.html -- You can see here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=265810 that MS knows about the issue, but (shockingly) it's not high on their list of priorities.

    No doubt a similar change will be needed in CodeCompletionWindow.cs, but I haven't tested it. The issue might also apply to SD 2, but I don't use it and I haven't looked.

    May we find the wisdom to discover the right coffee, the will to choose it and the income to make it endure
  • 05-11-2008 12:32 PM In reply to

    Re: Mouse Scrolling in Vista 32 (only?)

    Yep ...

    You are right. This problem occures (only?) if you use Microsoft mice. I resolved this problem removing Microsoft Intellipoint software. Ofcource I wasn't happy doing this:) Some fix woud be reallly nice. At this point of my intensive life I coulnd't find time to look at source code so thanks that somebody did this.

  • 05-11-2008 2:24 PM In reply to

    Re: Mouse Scrolling in Vista 32 (only?)

    I don't have a mouse to reproduce this issue, but this should be fixed in revision 3064.
    Daniel Grunwald
Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.