[comp.windows.x] Finding which windows are under cursor

dan@vedge.UUCP (Dan Foody) (12/02/88)

Is there any way to find what windows are under the cursor (or under any
specific point). I want to find the second visible window from the top.

This window is NOT always the parent of the window that is on the top.
Both windows may have the same parent, with one window raised above the other.

Using XTranslateCoordinates a few times (using the 'child' return) it is
possible to find the window that is on the top and find its parent, but
it is not possible to find the window directly below the top window.

Is there any easy way to find this?

					Thanks, dan.

\\        // ////// ////// //  // ////// //      ////// /////// ////// //////
 \\      //   //   //     //  // //  // //      //      //  // //     //
  \\    //   //	  ////// //  // ////// //      ////    //  // // /// ////
   \\  //   //       // //  // //  // //      //      //  // //  // //
    \\// //////	////// ////// //  // //////  ////// /////// ////// //////
     // Dan Foody                // The views expressed are solely    //
    // Visual Edge Software     // those of the writer and are not   //
   // St. Laurent, Quebec,     // those of Visual Edge Software,    //
  // H4R 1V4  CANADA          // or of Usenet.                     //
 // decvax!musocs!vedge!dan  // vedge!dan@larry.mcrcim.mcgill.edu //

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/03/88)

    Is there any way to find what windows are under the cursor (or under any
    specific point).

Yes, you can use XQueryTree to determine the hierarchy and XGetGeometry
to determine positioning.

dan@vedge.UUCP (Dan Foody) (12/07/88)

In article <8812021922.AA13237@EXPO.LCS.MIT.EDU>, rws@EXPO.LCS.MIT.EDU
(Bob Scheifler) writes:
> 
>     Is there any way to find what windows are under the cursor (or under any
>     specific point).
> 
> Yes, you can use XQueryTree to determine the hierarchy and XGetGeometry
> to determine positioning.

The problem is that I need to find the stacking order of the windows
directly under the cursor; neither XQueryTree or XGetGeometry help.

These calls will only help you find which windows are under the cursor, they
do not help you if you want to find the order the windows are stacked in at
the point under the cursor.

Is there any way to find the stacking order?

\\        // ////// ////// //  // ////// //      ////// /////// ////// //////
 \\      //   //   //     //  // //  // //      //      //  // //     //
  \\    //   //	  ////// //  // ////// //      ////    //  // // /// ////
   \\  //   //       // //  // //  // //      //      //  // //  // //
    \\// //////	////// ////// //  // //////  ////// /////// ////// //////
     // Dan Foody                // The views expressed are solely    //
    // Visual Edge Software     // those of the writer and are not   //
   // St. Laurent, Quebec,     // those of Visual Edge Software,    //
  // H4R 1V4  CANADA          // or of Usenet.                     //
 // decvax!musocs!vedge!dan  // vedge!dan@larry.mcrcim.mcgill.edu //

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/07/88)

    The problem is that I need to find the stacking order of the windows
    directly under the cursor; neither XQueryTree or XGetGeometry help.

Wrong.  QueryTree does provide sufficient stacking order information.
Go read your Xlib and Protocol manuals again.

davep@ginsu.apple.COM (12/16/88)

>    Is there any way to find what windows are under the cursor (or under any
>    specific point).
>
> Yes, you can use XQueryTree to determine the hierarchy and XGetGeometry
> to determine positioning.

Just scanning old mail here...  In the general case, you probably also 
want to call XGetWindowAttributes and check that the map_state value is
IsViewable to make sure the window is mapped before assuming the 
cursor was positioned in it.