Re: scroll wheel focus

< Lubos Lunak [February 13 2002]:
>         {
>         XEvent ev;
>         XNextEvent( dpy, &ev );
>         if( ev.type == ButtonPress )
>             {
>             XSendEvent( dpy, InputFocus, True, ButtonPressMask, &ev );

Here it works nicer if you send the event to what XGetInputFocus()
returns - also, most applications will look at ev.xbutton.window and
they won't do anything with the event if that's set to the root window
(so just set ev.xbutton.window to the same window you're sending the

I put something similar to this in my window manager and it works in
some cases.  Sometimes apps want ev.xbutton.subwindow to point to
something and won't work unless the wheel is actually over the right
widget.  Sometimes apps completely ignore sent events - like the xterm
I have has an option allowSendEvents which is off by default.

I don't see that it would be necessary to add a mouse-click proxying
protocol or anything.  If an app wants to work with a window manager
that does this, it can just deal with sent events like normal events
and perhaps ignore the subwindow and x, y members of XButtonEvent when
they point off the application.  The app (or toolkit) would then need
to do its own dispatching to the correct widget.

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