Robert van der Kamp <[EMAIL PROTECTED]> writes:

| Hi Lyxers!
| 
| Back on the list again (after aprox. 3 years).
| Downloaded lyx 1.0.3. I can see you've been quite busy.
| For the moment I don't have concrete developing plans with Lyx,
| I'll just watch this list for a while...
| 
| Anyway, here's a small patch for BufferView.C, method
| BufferView::WorkAreaButtonPress(), line 986, where buttons
| 4 and 5 (the scroll wheel) are handled. Added acceleration support:
| the faster the wheel is turned, the faster the screen is scrolled.
| Something I also added to Xemacs, works really nice.

I used your patch and did it slightly different. My way seems much
more responsive.

        // I am not quite sure if this is the correct place to put
this,
        // but it will not cause any harm.
        // Patch from Mark Huang ([EMAIL PROTECTED]) to make LyX
recognise
        // button 4 and 5. This enables LyX use use the scrollwhell on
        // certain mice for something useful. (Lgb)
        // Added wheel acceleration detection code. (Rvdk)

        static Time lastTime = 0;
        if (ev->xbutton.button == 5){   
                int diff = ev->xbutton.time - lastTime;
                int scroll = int(1.0 + (4.0/(abs(diff)+1.0))*200.0);
                ScrollUp(scroll);
                lastTime = ev->xbutton.time;
                return 0;
        }
        
        if (ev->xbutton.button == 4){
                int diff = ev->xbutton.time - lastTime;
                int scroll = int(1.0 + (4.0/(abs(diff)+1.0))*200.0);
                ScrollDown(scroll);
                lastTime = ev->xbutton.time;
                return 0;
        }

Note also that I reversed the scroll-wheel. Logically it was backwards.
(it is not a flight-stick you know ... )

I have no idea on how the "function" I use for scroll handles on other
systems. So comments are welcome.

        Lgb

Reply via email to