Smooth scrolling and button emulation

Peter Hutterer peter.hutterer at who-t.net
Wed Oct 3 15:30:36 PDT 2012


On Wed, Oct 03, 2012 at 07:17:08PM +0200, Sascha Hlusiak wrote:
> Hi Peter,
> 
> I'd like to implement smooth scrolling in the joystick input module. By 
> calling 
> 
> SetScrollValuator(pDevice, 2, SCROLL_TYPE_VERTICAL, 100, 0);
> 
> I can set the scroll resolution of the valuator 2 to 100. As far as I 
> understand, I now can send valuator movement that XI2 applications already 
> can use for smooth scrolling.

correct.

> In the case for legacy button scroll events, the server keeps track of the 
> accumulated scroll delta and after reaching 100, will generate a XI1/legacy 
> scroll button down/up sequence. Is there a way to reset that server internal 
> delta to 0 after scrolling stops? It seems that smooth scrolling might leave 
> that value at 99, which makes it impossible for me to predict when the next 
> legacy button scroll event will happen. 

no, not really. this is a missing API but I do wonder how useful this API
would be. The scroll resolution is supposed to represent one unit of
scrolling, so it should be hard to repeatedly accumulate 99 - that would
just mean the resolution is too high, wouldn't it?

> In the case of the joystick module, where deflecting the axis generates a 
> whole scroll unit, followed by smooth scrolling, this results in sometimes 
> two units from the start. 

I'm not sure what you mean by "Followed by smooth scrolling". Once you
enable smooth scrolling, you don't send button 4/5 presses anymore, only the
valuator events. the rest is handled in the server. are you still setting
button events as well?

> Did I miss something in the API?
> 
> Is there any bigger application out there that uses smooth scrolling right 
> now? AFAIK, no major browser does. 

I think GTK 3.6 has it implemented already, though for driver testing I do
recommend xinput to make sure the events arrive as-is.

Cheers,
   Peter




More information about the xorg-devel mailing list