[comp.windows.x] Sorry, repost "Propagation of Device Event?" with a corrected graph.

jhsieh@grapevine.EBay.Sun.COM (James Hsieh) (07/14/90)

Hi,
	Could you help me to understand the propagation of device events?

	Assuming window tree hierarchy in the server is:
                     root
                    /  | \
                  c1   B  A 
                  /
                c2
	and
            pointer is in c2, 
            button pressed,
            no active/passive grabs,
            no do-not-propagate masks,
            just normal event distribution in the server.
	the screen layout is:
     ---------------------------    ( *** INCORRECT FIGURE *** )
     |                 root    |    ( **  see below        *** )
     |   -----------------     |     
     |   |           A   |     |                       
     |  --------------   |     |
     |  |        B   |   |     |
     |  |            |-----    |     
     |  |      ----  |c1  |    |    
     |  |      |c2|  |    |    |    
     |  |      |x |  |    |    |
     |  |      ----  |    |    |
     |  --------------    |    |
     |   |   --------------    |
     |   |               |     |
     |   -----------------     |
     |                         |
     ---------------------------

*** According to the rule of "window stacking order", the above
*** screen layout is incorrect (window B can not be mapped between
*** c1 and c2).  It should look like:
     ---------------------------    
     |                 root    |    
     |   -----------------     |     
     |   |           A   |     |                       
     |  --------------   |     |
     |  |        B   |   |     |
     |  |    --------------    |     
     |  |    | ----   c1  |    |    
     |  |    | |c2|       |    |    
     |  |    | |x |       |    |
     |  |    | ----       |    |
     |  -----|            |    |
     |   |   --------------    |
     |   |               |     |
     |   -----------------     |
     |                         |
     ---------------------------


case 1: client 1 selects ButtonPressMask on window A
	client 2 selects ButtonPressMask on window B
	client 3 selects ButtonPressMask on window c1, but not c2

	Question:
          1. what is the seach path for this ButtonPress event?
          2. which client will receive this ButtonPress event?
          3. is the search path from source window to event window 
             determined by looking up the window hierarchy in the server,
             not by the current appearance on screen?

       My answer is:
          1. c2-c1-stop.
          2. server sends this event to client 3.
          3. yes.  the event propagation is based on window hierarchy IN 
             the server, NOT based on physical layout of screen.

case 2: client 1 selects ButtonPressMask on window A
	 client 2 selects ButtonPressMask on window B
	 client 3 is not interested in ButtonPress on c1 or c2.

	Question:
          1. what is the seach path for this ButtonPress event?
          2. which client will receive this button press event?
          3. why isn't window B included in the search path 
	     to receive the event?

  	My answer is:
          1. c2-c1-root-stop.
          2. evnet thrown away, none of the clients receives this event.
          3. window B does NOT contain the pointer, so window B
             is not in the search path to receive this evnet?

case 3: none of the clients selects ButtonPressMask on any window.

	Question:
          1. what is the search path for this ButtonPress event?
          2. which client will receive this button press event?

	My answer is:
          1. search path is still c2-c1-root-Stop
          2. event thrown away, none of the clients receives this event.

Am I correct here?
Thank you in advance for your kind help.
jhsieh@sun.com