Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#15 Here's a touchpad-freindlier version of scrolling

open
nobody
None
5
2007-07-15
2007-07-15
pen_sq
No

CotVNC normally goes nuts with scroll (mostly down) events when I scroll on my trackpad (two fingers, yay!). This filters away all those teensy scroll events that somehow fall on the wrong side of an if statement.

This is tested on an Intel Macbook 2.0Ghz, with trackpad and a logitech bluetooth mouse(+ wheel, naturally). The Client (Host? X has my head backwards) is a Debian box on Wired Gig ethernet, running XTightVnc, with KDE env. Played with scrolling in PAN(GTK) and Konqueror(KDE).

This is against CVS of July 15th, 07.

- (void)scrollWheel: (NSEvent *)theEvent
{
//printf("%s theEvent deltaX:%f Y:%f\n",__FILE__,[theEvent deltaX],[theEvent deltaY]);
if ( _viewOnly )
return;
if ( fabs([theEvent deltaY]) <= 0.05 ) //trackpads can send lots of really small moves, my notchy mouseWheel gives 0.1 per move
return;
[self sendAllPendingQueueEntriesNow];
int addMask;
NSPoint p = [_view convertPoint: [[_view window] convertScreenToBase: [NSEvent mouseLocation]]
fromView: nil];
if ( [theEvent deltaY] > 0.05 )
addMask = rfbButton4Mask;
else if ([theEvent deltaY] < -0.05 )
addMask = rfbButton5Mask;
else assert("An unknowable MouseWheel value!");
[self clearUnpublishedMouseMove];
[_connection mouseAt: p buttons: _pressedButtons | addMask]; // 'Mouse button down'
[_connection mouseAt: p buttons: _pressedButtons]; // 'Mouse button up'
}

Discussion

  • pen_sq
    pen_sq
    2007-07-15

     
    Attachments
  • Jeff Birac
    Jeff Birac
    2008-08-22

    Logged In: YES
    user_id=2189094
    Originator: NO

    The "0.05" -- I think of it as "scroll wheel sensitivity"-- seems a bit high (for my system); lists jump, not scroll, a little too quickly for my taste.

    Here's my fix...

    I defined a new symbol "SCROLLWHEEL_SENSITIVITY" in EventFilter.h, and set it smaller than 0.05:
    #define SCROLLWHEEL_SENSITIVITY 0.01

    Then I replaced each instance of "0.05" (careful, only in the patch in EventFilter.m) with the "SCROLLWHEEL_SENSITIVITY" symbol.

    This makes fine-tuning the scrollwheel much simpler.

     
  • dustinac
    dustinac
    2010-10-24

    This patch is included in Chicken, a fork/revival of Chicken of the VNC:

    https://sourceforge.net/projects/chicken/