Tracking Events On Another Window

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

 



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



[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]