Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6501838

Some X11 events are dispatched to the wrong windows, XAWT

XMLWordPrintable

    • b07
    • generic
    • linux
    • Verified

        Here is how X11 events are dispatched in XToolkit (roughly):

        1. Event is received in XToolkit.run() with XlibWrapper.XNextEvent()
        2. Event's data is stored in XAnyEvent class, which contains the following fields: type, serial, send_event, display, window
        3. Depending of the event's type a new event is constructed with XToolkit.createEvent(). This method gets pData from the event passed as an argument and creates an instance of subclass of IXAnyEvent, for example, XMapEvent, XConfigureEvent or XReparentEvent
        4. Given the new event, we get its's window with event.get_window() method, found a corresponding peer and dispatch event to it

        The problem here is that some of the events (XReparentEvent, XGravityEvent and others) have another order of fields than XAnyEvent. Here is the fields of XReparentEvent: type, serial, send_event, display, event, window, ... Thus, the methods get_window() of XAnyEvent and get_event() of XReparentEvent really return the same value. Also, get_window() of XAnyEvent and get_window() of XReparentEvent may return different windows. XReparentEvent should be dispatched to its 'event' member, but now it is dispatched to its 'window' member which may differ from 'event'.

        One particular usage of XReparentEvent that is broken is XEmbed server-side support. In XEmbedCanvasPeer we wait for XReparentEvent and get its 'window' method to find an XEmbed client (child window). However, this XReparentEvent is never dispatched to XEmbedCanvasPeer, and so XEmbed server-side support is completely broken.

              son Oleg Sukhodolsky (Inactive)
              art Artem Ananiev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: