I would like to write an application that would collect mouse events
(Button Press/Release) among all windows/screens in the same desktop,
and display the event info on a dedicated window. I used the following
two methods but none worked.  Your help is appreciated.

Method 1:
   d = XOpenDisplay(display_name);
   s = XDefaultScreen(d);  
   root = RootWindow(d,s);
   XSelectInput(d, root, ButtonPressMask);
   while(1)
     {
        XNextEvent(d, &ev);
        switch(ev.type)
          {
           case ButtonPress:
               ...

In this method, program is hanging on waiting for XNextEvent. Since
SelectInput is on root window,  and no ButtonPress is detected on that
window. How can I get the events from the window a mouse is presenting?

Method 2:         
Use the function Select_Window( display) to select the current mouse
pointed window and leads grab all events on the entire screen, however,
the normal mouse function won't work till the program is done.

Thanks,
_______________________________________________
Devel mailing list
Devel@XFree86.Org
http://XFree86.Org/mailman/listinfo/devel

Reply via email to