LG event pipeline with 3D proxy windows

Deron Johnson Deron.Johnson at Sun.COM
Thu Jan 5 16:51:29 PST 2006


Hi Keith,

I have made an attempt to work the 3D window proxy idea into my
design for the LG event pipeline. Here is a brief description.
Please let me know what you think.

HIGHLIGHTS:

1. Since we are leveraging the existing, unmodified CheckDeviceGrabs
   for 3D grabs, the X server needs to use focus and sprite trace
information
   provided by my Display Server. The X server cannot calculate this
   information itself because it doesn't know the containment relationships
   in the 3D scene graph.

   To this end, this approach uses a new concept called the "external grab
   traces". CheckDeviceGrabs will either use the focus and sprite traces
   calculated by the X server or, optionally, it will use "external" focus
   and sprite traces. These traces are set by the DS via a new request. The
   "external grab trace enable" defaults to off and is controlled via
   a new request.

2. I still need to add code to the X server to notify the LG Display
   Server of when 3D grabs trigger. To this end I propose a new
   GrabStateChange extension event.

3. I need to to be able to disable the default button grab test
   for certain windows. To this end I propose adding a new
   extension request.

DETAILS:

Display Server (DS) Initialization:
    A. Pseudo-root window (PRW) created and made a topmost window.
       PRW is an override redirect window the size of the screen.
    B. "Miss window" is created as an InputOnly full-screen child of PRW.
    C. Set "last grab trace type" to 2D.
    D. Disable default button grabs for the PRW and Miss windows (using
       a new request).
    E. EventDeliverer registers interest in all events on both the
       PRW and the Miss window, including GrabStateChange events.

1. X server (XS) sends raw device events to Display Server (DS).
   Eventually merge with Keith's magnifier changes.

2. DS Picker synchronizes 3D proxy window and their registered grabs

    A. If a 3D object with registered grabs is added to the scene graph,
       create a corresponding 3D proxy window (parented off the PRW),
       disable default button grabs, and transfer the registered grabs
       to it. The EventDeliverer then registers interest in all events
       on the 3D proxy window, including GrabStateChange events.

    B. If a grab is registered on an existing scene graph node,
       create a corresponding 3D proxy, disable default button
       grabs for it, and register the grab on this window.
       The EventDeliverer then registers interest in all events on the
       3D proxy window, including GrabStateChange events.

    C. If a 3D object with registered grabs is removed from the scene
       graph, it's corresponding 3D proxy window is deleted.

    Note: if the 3D grab information registered on a 3D object has
    a non-null cursor, and this cursor doesn't already have an
    X cursor, a null-image X cursor is created and is associated with
    the 3D cursor. The X cursor is assigned a unique name (atom) via
    XFixesSetCursorName. This atom will be sent in any GrabStateChange
    events (described below).

3. DS Picker receives events and performs pick on scene graph.

   A. If pick hits an X11 window, event window is set to XID of this window.
      If last grab trace type != 2D, send a request to disable the
      external grab traces. Then send the event to the XS. Set the last
      grab trace type to 2D.

   B. If pick hits a 3D object, event window is set to XID of PRW.
      Also, 3D event information is stored. If last grab trace
      type != 3D, send a request to enable the external grab traces.
      Lazily recalculate the grab traces and, if they have changed,
      send a request to update the grab traces with this information.
      Then send the event to the XS. Set the last grab trace type to 3D.

   C. If pick misses, event window is set to the XID of the miss window.
      If last grab trace type != Miss, send a request to enable the
      external grab traces. Set the grab traces to be just one window
      (the miss window). (Since there are no grabs registered on this
      window, CheckDeviceGrabs will be a no-op). Then send the event to
      the XS. Set the last grab trace type to Miss.

4. XS receives the picked event back and eventually calls
   CoreProcessKeyboardEvent or CoreProcessPointerEvent.
   Eventually merge with Keith's magnifier changes.
   Key and button events are processed normally. Motion events use
   XYToSubwindow instead of XYToWindow.

5. At the end of CoreProcessKeyboardEvent and CoreProcessPointerEvent,
   but before the event is delivered, check to see if there has been a
   change in the grab state. If the grab window has client interest in
   GrabStateChange, and the grab has been triggered or terminated
   send a GrabStateChange event with the appropriate information
   (including the GrabID if a passive grab has been triggered).
   Also send a GrabStateChange event if an active grab has been
   triggered or terminated since the last time CoreProcessKeyboardEvent
   or CoreProcessPointerEvent was called. And, if the grab is being
   triggered and the grab cursor is non-null, include the name of the
   cursor in the event.

6. Deliver the event normally, with a few exceptions:

   A. DeliverDeviceEvents: Deliver button events to the window
      chosen by the Picker instead of the current sprite window.
      (For the reason for this, see section 14.1.2 of my input doc).

   B. DeliverEventsToWindow: skip the default button grab testing
      for this window if it has been disabled. If the default
      button grab triggers and there is client interest in
      GrabStateChange, send a GrabStateChange event with a null GrabID.

   C. FixupEventFromWindow: perform as described in section 14.2.2
      of my input doc. Eventually, merge with Keith's magnifier changes.
        ==> No change

6. 3D events (pick hit 3D object or pick missed) return to DS.
   3D object hit events will have a corresponding EventInfo3D
   object which must be looked up. Pick miss events will not have
   one. Update the cursor visual representation appropriately.

7. DS also handles GrabStateChange events, using them to update
   it's own state as necessary. In particular, if the event
   contains a non-null cursor name, the cursor is changed to be
   the 3D cursor which corresponds to the named X cursor.


Summary of XS Changes
---------------------

1. External grab traces
    + A new request to globally enable/disable external grab traces
    + A new request to update all (or part) of the extenral sprite or
focus trace.
    + When enabled, the external sprite and focus traces are used by
CheckDeviceGrabs
      instead of the internally calculated ones.
    + Default: external traces are disabled.

2. Disable default button grabs
    + A new request to enable/disable the default button grab for a
particular window.
    + When disabled, DeliverEventsToWindow will skip the default button
grab test.
    + Default: enabled.

3. New extension event: GrabStateChange
    + Sent when the grab state changes for a window who has interest in
these
      events configured for it.
    + Contains information about whether the grab triggered or terminated,
      is due to a passive or active grab and, if known, the Grab ID of
the grab.

4. Motion events call XYToSubwindow instead of XYToWindow.

5. Active grab request set a flag to indicate that an active grab has
triggered.

6. In CoreProcessKeyboardEvent and CoreProcessPointerEvent, send
GrabStateChange
   events as appropriate.

7. Changes to event delivery routines:
   + DeliverDeviceEvents: Deliver button events to the window
     chosen by the Picker instead of the current sprite window.
     (For the reason for this, see section 14.1.2 of my input doc).
   + DeliverEventsToWindow: skip the default button grab testing
      for this window if it has been disabled. If the default
      button grab triggers and there is client interest in
      GrabStateChange, send a GrabStateChange event with a null GrabID.
   + FixupEventFromWindow: perform as described in section 14.2.2
      of my input doc. Eventually, merge with Keith's magnifier changes.





More information about the xorg-arch mailing list