Re: scroll wheel focus



On Wed 13. February 2002 07:41, Havoc Pennington wrote:
> Hi,
>
> I just got a scroll wheel mouse for the first time, and I noticed that
> it has strict mouse focus; i.e. you must have the pointer inside the
> widget to be scrolled. Does it work this way on Windows? It seems sort
> of strange to me. As a user I expected the wheel to operate on the
> active widget in the active window.
>
> Of course if you know how the scroll wheel is implemented on X it
> obviously works this way, since button presses go to the window under
> the pointer.
>
> Assuming this needs fixing, how would we do it?
>

 You must have been reading my mind this morning, haven't you? See the 
attachment. However, when the wheel works that way, it doesn't feel very 
comfortable (even though I otherwise hate focus-follows-mouse ... maybe I 
just got used to the way the wheel works in X).
 I also tried on a Windows machine here, and Windows doesn't strictly send 
wheel events to the focused widget. When viewing a WWW page with a textfield 
in IE, scrollwheelling down scrolls the textfield to the bottom and when it 
can't scroll anymore, the whole WWW page scrolls. Also, when I tried in that 
Windows Evolution clone :) , I didn't have to click the messages list in 
order to be able to scrollwheel it.
 It looks like this needs toolkit support (in Mozilla, the wheel also doesn't 
have focus-follows-mouse behaviour). Also, with the attached utility, I can't 
change volume by scrollwheeling over a mixer applet :(. Maybe one or the 
other behaviour should work only if some modifier key is pressed.

-- 
 Lubos Lunak
 llunak suse cz ; l lunak kde org
 http://dforce.sh.cvut.cz/~seli
#include <X11/Xlib.h>

int main()
    {
    Display* dpy = XOpenDisplay( NULL );
    if( dpy == NULL )
        return 1;
    XGrabButton( dpy, Button4, AnyModifier, DefaultRootWindow( dpy ), False,
        ButtonPressMask | ButtonReleaseMask , GrabModeSync, GrabModeAsync, None, None );
    XGrabButton( dpy, Button5, AnyModifier, DefaultRootWindow( dpy ), False,
        ButtonPressMask | ButtonReleaseMask , GrabModeSync, GrabModeAsync, None, None );
    for(;;)
        {
        XEvent ev;
        XNextEvent( dpy, &ev );
        if( ev.type == ButtonPress )
            {
            XSendEvent( dpy, InputFocus, True, ButtonPressMask, &ev );
            XAllowEvents( dpy, SyncPointer, CurrentTime );
            }
        else if( ev.type == ButtonRelease )
            {
            XSendEvent( dpy, InputFocus, True, ButtonReleaseMask, &ev );
            XAllowEvents( dpy, SyncPointer, CurrentTime );
            }
        }
    }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]