Re: Tracking Events On Another Window

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

 



On Tue, 16 Feb 1999, Kieran O' Sullivan wrote:

It's only allowed for a single application to select for
buttonpress events in a window. In the case of the root
window, the window manager already does that before any
app, so you can't do what you want directly. The options
are:
1) disable root window button press in the window manager,
if it's possible (some window managers have an option for that)
2) do a passive grab for button presses in the root window
(XGrabButton)
3) use an existing window manager protocol to tell the
window manager to relay button events to your app (take a
look in teh GNOME wm hints)
4) rethink whether you really need button events from the
root window

--
Alfredo

> I was on about this befor and I tried the suggestion that I got back and
> some of it was good but SelectInput() causes errors when it is applied to
> the root window.  The root window seems to think that you are trying to
> change its assributes so your program crashes.  The following was
> something I came up with and for some reason it doesn't work the program
> can process its own events but it gets nothing from the root window.  I
> have not tried the function with any other window and I know that the root
> window is listening to ButtonPress events.
> 
> root_win = RootWindow(display, root_screen); /* Sets a window structure
> equal to root window.  There is nothing wrong with this statement because
> I have used it in a QueryTre() function successfully */
> 
> /* there is a continuous loop here */
> /* after the program has processed its own events it does the following */
> 
>  if(!XCheckWindowEvent(display, root_win, ButtonPressMask|PointerMotionMask, &report2))
> 
>       {/* nothing to do because there are no events */}
> /* XCheckWindowEvent() is used because it checks the event que and
> if it doesn't find anything it returns False and doesn't balck allowing
> the program to do what it has to do with out waiting for events. */ 
> 
>       else
> 
>       {
> 
>         printf("\n Something happended ont the root window \n");
> 
>         switch (report2.type)      
> 
>         { 
>            case ButtonPress:
> 
>               printf("\nButton Press on root window \n");
> 
>            break;
> 
> 
>            case MotionNotify:
> 
>                XQueryPointer (display, win, &rep_root, &rep_child,
> 
>  			&rep_rootx, &rep_rooty, &dx, &dy, &rep_mask);
> 
>                 printf("\nThe pointer was queried %d, %d\n",dx, dy);
> 
>             break;
> 
>             default:
> 
>             break;
> 
>        } /* End of case for report2  */
> 
>     } /* Enf of if */     
> 
>   } /* End of While loop that processes all the events */ 
> 
> If anyone can help I would be very grateful.
> 
> _____________________________________________________________________
> Kieran O' Sullivan
> http://snet.wit.ie/BlindPenguin
> 
> 
> -- 
>          To unsubscribe: mail blinux-develop-request@xxxxxxxxxx with 
>                        "unsubscribe" as the Subject.
> 
> 



[Index of Archives]     [Linux for the Blind]     [Fedora]     [Kernel List]     [Red Hat Install]     [Red Hat Watch List]     [Red Hat Development]     [Gimp]     [Yosemite News]     [Big List of Linux Books]