<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 01.06.2013 11:39, Jaime Pe&ntilde;alba
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAF3VdfAg5XCL6B0oHd2-x8J=cuEqevav8aKnKfaOkoXgEG4Rqg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>Looks like someone already fixed the bug in e16<br>
              <a moz-do-not-send="true"
href="http://git.enlightenment.org/e16/e16.git/commit/?id=ba29ecf04ea3d6a8b4eb20f128b9daa4761e8988">http://git.enlightenment.org/e16/e16.git/commit/?id=ba29ecf04ea3d6a8b4eb20f128b9daa4761e8988</a><br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    Wow, very good! Thank you for the info! =)<br>
    <br>
    <blockquote
cite="mid:CAF3VdfAg5XCL6B0oHd2-x8J=cuEqevav8aKnKfaOkoXgEG4Rqg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <br>
            </div>
            Sorry for all the trouble and thanks for the support :)<br>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    You're welcome!<br>
    <br>
    Anyway, the fix is in the jdk8 workspace (because the problem
    affected some other WMs as well).<br>
    <br>
    Thanks,<br>
    Anton.<br>
    <br>
    <blockquote
cite="mid:CAF3VdfAg5XCL6B0oHd2-x8J=cuEqevav8aKnKfaOkoXgEG4Rqg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div><br>
            <br>
          </div>
          Regards,<br>
        </div>
        Jaime.<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">2013/3/15 Anton V. Tarasov <span
            dir="ltr">&lt;<a moz-do-not-send="true"
              href="mailto:anton.tarasov@oracle.com" target="_blank">anton.tarasov@oracle.com</a>&gt;</span><br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>Jaime,<br>
                <br>
                May I ask you to try the following fix (which is a
                one-line change) in your environment with e16-1.0.11?<br>
                <br>
                <a moz-do-not-send="true"
                  href="http://cr.openjdk.java.net/%7Eant/8009224/webrev.0"
                  target="_blank">http://cr.openjdk.java.net/~ant/8009224/webrev.0</a><br>
                <br>
                Thanks,<br>
                Anton.
                <div class="im"><br>
                  <br>
                  On 12.03.2013 0:03, Jaime Pe&ntilde;alba wrote:<br>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">Thank you,<br>
                    <br>
                    Hope someone will take a look into it.<br>
                    <br>
                    <br>
                    Regards,<br>
                    Jaime.<br>
                    <br>
                    <br>
                    <div class="gmail_quote">2013/3/6 Alexander
                      Zvegintsev <span dir="ltr">&lt;<a
                          moz-do-not-send="true"
                          href="mailto:alexander.zvegintsev@oracle.com"
                          target="_blank">alexander.zvegintsev@oracle.com</a>&gt;</span><br>
                      <blockquote class="gmail_quote" style="margin:0 0
                        0 .8ex;border-left:1px #ccc
                        solid;padding-left:1ex">
                        <div text="#000000" bgcolor="#FFFFFF">
                          <div>Hi Jaime,<br>
                            <br>
                            I have filed this bug as<br>
                            <a moz-do-not-send="true"
                              href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8009224"
                              target="_blank">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8009224</a><br>
                            <br>
                            <pre cols="72">Thanks,

Alexander.</pre>
                            <div>
                              <div> On 02/27/2013 07:45 PM, Jaime
                                Pe&ntilde;alba wrote:<br>
                              </div>
                            </div>
                          </div>
                          <div>
                            <div>
                              <blockquote type="cite">Last week I
                                reported the following bug: <a
                                  moz-do-not-send="true"
                                  href="https://bugs.openjdk.java.net/show_bug.cgi?id=100300"
                                  target="_blank">https://bugs.openjdk.java.net/show_bug.cgi?id=100300</a>
                                but Anthony Petrov suggested me to bring
                                the topic here.<br>
                                <br>
------------------------------------------------------------------------------------------------------------------------------<br>
                                <br>
                                First of all this bug has been
                                introduced on JDK7 as JDK6 works
                                perfectly under<br>
                                enlightenmenet e16 window manager.<br>
                                <br>
                                To reproduce this bug just run any java
                                application under the window manager<br>
                                e16 using JDK7. All my tests have been
                                done using version "e16-1.0.11" and<br>
                                openjdk-7u6-fcs-src-b24-28_aug_2012.zip.
                                Here are the e16 binaries which I<br>
                                compiled and which I'm using:<br>
                                <a moz-do-not-send="true"
href="http://www.painsec.com/writeups/resources/misc/e16-1.0.11-bin.tar.bz2"
                                  target="_blank">http://www.painsec.com/writeups/resources/misc/e16-1.0.11-bin.tar.bz2</a><br>
                                <br>
                                Steps to reproduce the bug:<br>
                                &nbsp;- Run any java swing/awt application
                                under e16-1.0.11 window manager.<br>
                                &nbsp;- Change focus to another
                                window/application.<br>
                                &nbsp;- Return focus to the java application.<br>
                                &nbsp;- It will no longer allow you to write
                                on any text field.<br>
                                <br>
                                The problem is that once the java window
                                loose the focus it never regains it<br>
                                again loosing the ability to input text
                                although mouse clicks still work fine.<br>
                                <br>
                                I'm not used to X11 programming neither
                                to hacking the OpenJDK, anyway trying<br>
                                to hunt the bug I found that a proper
                                focus event is handled in the following<br>
                                manner:<br>
                                <br>
                                <blockquote style="margin:0px 0px 0px
                                  0.8ex;border-left:1px solid
                                  rgb(204,204,204);padding-left:1ex"
                                  class="gmail_quote">&nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XWindowPeer.handleFocusEvent(XWindowPeer.java:806)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XDecoratedPeer.handleFocusEvent(XDecoratedPeer.java:225)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
sun.awt.X11.XFocusProxyWindow.handleFocusEvent(XFocusProxyWindow.java:77)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XFocusProxyWindow.dispatchEvent(XFocusProxyWindow.java:70)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:1066)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:577)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XToolkit.run(XToolkit.java:686)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XToolkit.run(XToolkit.java:607)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  java.lang.Thread.run(Thread.java:722)<br>
                                </blockquote>
                                <br>
                                <br>
                                But under e16 the event gets lost at:<br>
                                <br>
                                <blockquote style="margin:0px 0px 0px
                                  0.8ex;border-left:1px solid
                                  rgb(204,204,204);padding-left:1ex"
                                  class="gmail_quote"> &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XBaseWindow.dispatchToWindow(XBaseWindow.java:1066)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XToolkit.dispatchEvent(XToolkit.java:577)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XToolkit.run(XToolkit.java:686)<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; at
                                  sun.awt.X11.XToolkit.run(XToolkit.java:607<br>
                                </blockquote>
                                <br>
                                <br>
                                The code
                                sun.awt.X11.XBaseWindow.dispatchToWindow
                                is as follows<br>
                                <br>
                                <blockquote style="margin:0px 0px 0px
                                  0.8ex;border-left:1px solid
                                  rgb(204,204,204);padding-left:1ex"
                                  class="gmail_quote">&nbsp; &nbsp; /**<br>
                                  &nbsp; &nbsp; &nbsp;* Dispatches event to the grab
                                  Window or event source window
                                  depending<br>
                                  &nbsp; &nbsp; &nbsp;* on whether the grab is active
                                  and on the event type<br>
                                  &nbsp; &nbsp; &nbsp;*/<br>
                                  &nbsp; &nbsp; static void
                                  dispatchToWindow(XEvent ev) {<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; XBaseWindow target =
                                  XAwtState.getGrabWindow();<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; if (target == null ||
                                  !isGrabbedEvent(ev, target)) {<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; target =
                                  XToolkit.windowToXWindow(ev.get_xany().get_window());<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; }<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; if (target != null &amp;&amp;
                                  target.checkInitialised()) {<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; target.dispatchEvent(ev);<br>
                                  &nbsp; &nbsp; &nbsp; &nbsp; }<br>
                                  &nbsp; &nbsp; }<br>
                                </blockquote>
                                <br>
                                After some tinkering I discovered that
                                the obtained "XBaseWindow target" points<br>
                                to a "XContentWindow" object instead of
                                a "XFocusProxyWindow" object as<br>
                                expected, and the "XContentWindow" class
                                extending "XWindow" doesn't have a<br>
                                "dispatchEvent()" method so the event
                                gets lost forever.<br>
                                <br>
                                I don't know why XContentWindow is
                                catching the event instead of<br>
                                XFocusProxyWindow, looks like the real
                                bug is because of that, but I didn't<br>
                                managed to trace why the event is being
                                associated with XContentWindow.<br>
                                <br>
                                As an ugly workaround I implemented the
                                "dispatchEvent()" and<br>
                                "handleFocusEvent()" under the
                                "XContentWindow" class calling to<br>
                                "parentFrame.handleFocusEvent(xev)"
                                where parentFrame should be the real
                                main<br>
                                window (XDecoratedPeer). This dirty hack
                                works, but I don't think that this is<br>
                                the way to do it, as JDK6 works fine
                                without implementing these methods under<br>
                                the "XContentWindow" class.<br>
                                <br>
                                <br>
                                Below is a patch for the dirty
                                workaround:<br>
                                <br>
                                <blockquote style="margin:0px 0px 0px
                                  0.8ex;border-left:1px solid
                                  rgb(204,204,204);padding-left:1ex"
                                  class="gmail_quote"> ---
                                  openjdk/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java&nbsp;&nbsp;&nbsp;
                                  2012-08-29 01:15:20.000000000 +0200<br>
                                  +++
                                  openjdk7-mod/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java&nbsp;&nbsp;&nbsp;
                                  2013-02-21 00:20:45.174245553 +0100<br>
                                  @@ -184,4 +184,33 @@<br>
                                  &nbsp;&nbsp;&nbsp;&nbsp; public String toString() {<br>
                                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return getClass().getName() +
                                  "[" + getBounds() + "]";<br>
                                  &nbsp;&nbsp;&nbsp;&nbsp; }<br>
                                  +<br>
                                  +&nbsp;&nbsp;&nbsp; public void dispatchEvent(XEvent
                                  ev) {<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int type = ev.get_type();<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (type)<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case XConstants.FocusIn:<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case XConstants.FocusOut:<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                  System.out.println("DISPATCHING FOCUS
                                  ON CONTENT WINDOW");<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; handleFocusEvent(ev);<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super.dispatchEvent(ev);<br>
                                  +&nbsp;&nbsp;&nbsp; }<br>
                                  +<br>
                                  +&nbsp;&nbsp;&nbsp; public void
                                  handleFocusEvent(XEvent xev) {<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int type = xev.get_type();<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; switch (type)<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case XConstants.FocusIn:<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case XConstants.FocusOut:<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                  System.out.println("HANDLING FOCUS
                                  EVENT ON CONTENT WINDOW");<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
                                  +&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                  parentFrame.handleFocusEvent(xev);<br>
                                  +&nbsp;&nbsp;&nbsp; }<br>
                                  +<br>
                                  &nbsp;}<br>
                                </blockquote>
                                <br>
                                <br>
                                This bug is really annoying me as I
                                cannot use JDK7 under e16. Does anyone
                                have idea why the XcontentWindow is
                                raising the event?<br>
                                <br>
                                <br>
                                Regards,<br>
                                Jaime.<br>
                                <br>
                              </blockquote>
                              <br>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                    </div>
                    <br>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>