<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>I don't think any of the existing bug tracker issues apply to
      this problem though. The reason I also posted it in here is that
      this issue is exclusive to the JavaFX platform thread. If this
      method is invoked in any other thread, it works fine. I
      investigated a bit further on this issue, I got the stack trace of
      where it gets stuck:<br>
    </p>
    <p><font face="monospace">        native_get_gtk_setting:-1,
        GTKEngine (com.sun.java.swing.plaf.gtk)<br>
                getSetting:633, GTKEngine (com.sun.java.swing.plaf.gtk)<br>
                getGTKStyleFactory:1562, GTKLookAndFeel
        (com.sun.java.swing.plaf.gtk)<br>
                loadStyles:1548, GTKLookAndFeel
        (com.sun.java.swing.plaf.gtk)<br>
                initialize:1441, GTKLookAndFeel
        (com.sun.java.swing.plaf.gtk)<br>
                setLookAndFeel:590, UIManager (javax.swing)<br>
                setLookAndFeel:637, UIManager (javax.swing)<br>
                attemptSetSystemLookAndFeel:690, FXTrayIcon
        (com.dustinredmond.fxtrayicon)<br>
                        <init>:242, FXTrayIcon
        (com.dustinredmond.fxtrayicon)<br>
                        <init>:640, FXTrayIcon
        (com.dustinredmond.fxtrayicon)<br>
                build:630, FXTrayIcon$Builder
        (com.dustinredmond.fxtrayicon)<br>
                        <init>:59, AppTray (io.xpipe.app.core)<br>
                init:69, AppTray (io.xpipe.app.core)<br>
                lambda$onSwitchTo$0:26, TrayMode
        (io.xpipe.app.core.mode)<br>
                run:-1, TrayMode$$Lambda/0x0000000080724178
        (io.xpipe.app.core.mode)<br>
                        lambda$runLaterIfNeededBlocking$1:319,
        PlatformThread (io.xpipe.app.fxcomps.util)<br>
                run:-1, PlatformThread$$Lambda/0x0000000080470d70
        (io.xpipe.app.fxcomps.util)<br>
                        lambda$runLaterIfNeededBlocking$2:328,
        PlatformThread (io.xpipe.app.fxcomps.util)<br>
                run:-1, PlatformThread$$Lambda/0x0000000080470f90
        (io.xpipe.app.fxcomps.util)<br>
                        lambda$runLater$10:456, PlatformImpl
        (com.sun.javafx.application)<br>
                run:-1, PlatformImpl$$Lambda/0x0000000080417c38
        (com.sun.javafx.application)<br>
                        executePrivileged:778, AccessController
        (java.security)<br>
                doPrivileged:400, AccessController (java.security)<br>
                lambda$runLater$11:455, PlatformImpl
        (com.sun.javafx.application)<br>
                run:-1, PlatformImpl$$Lambda/0x00000000804177e8
        (com.sun.javafx.application)<br>
                        run:95, InvokeLaterDispatcher$Future
        (com.sun.glass.ui)<br>
                _runLoop:-1, GtkApplication (com.sun.glass.ui.gtk)<br>
                lambda$runLoop$10:263, GtkApplication
        (com.sun.glass.ui.gtk)<br>
                run:-1, GtkApplication$$Lambda/0x00000000802b8c38
        (com.sun.glass.ui.gtk)<br>
                        runWith:1596, Thread (java.lang)<br>
                run:1583, Thread (java.lang)</font><br>
    </p>
    <p>You can call this method in the first line in the
      Application.start method and it will also get stuck, so it doesn't
      really matter from where it gets called as long as it is the
      JavaFX platform thread.<br>
    </p>
    <div class="moz-cite-prefix">On 10/23/2023 6:18 PM, Philip Race
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:4c669a02-f762-4f7e-8bc4-43dc9f35ccb5@oracle.com">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      There are several open bug reports of problems in AWT on ubuntu
      23.10 (and some on 23.04)<br>
      <br>
      <a class="moz-txt-link-freetext"
href="https://bugs.openjdk.org/issues/?jql=project%20%3D%20JDK%20AND%20component%20%3D%20client-libs%20AND%20labels%20in%20(ubuntu23.04%2C%20ubuntu23.10)"
        moz-do-not-send="true">https://bugs.openjdk.org/issues/?jql=project%20%3D%20JDK%20AND%20component%20%3D%20client-libs%20AND%20labels%20in%20(ubuntu23.04%2C%20ubuntu23.10)</a><br>
      <br>
      Note that GTK is not used to the same extent as it is by FX.<br>
      In fact it is used for only 2 things and only one of those can
      matter in your app,<br>
      and that is that the Swing GTK L&F uses it to get the
      rendering of GTK themes.<br>
      So if you weren't using the GTK L&F then a Swing app would
      likely not even load GTK.<br>
      But for a mixed FX + Swing app then of course it will still be
      loaded by FX.<br>
      <br>
      -phil.<br>
      <br>
      <br>
      <br>
      <div class="moz-cite-prefix">On 10/23/23 7:48 AM, Christopher
        Schnick wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:32447e7f-18c2-432f-b3f3-d2a195fc232a@xpipe.io">
        <p>That is good to know that this issue is already being worked
          on. From the description of <a class="moz-txt-link-freetext"
            href="https://bugs.openjdk.org/browse/JDK-8316423"
            moz-do-not-send="true">https://bugs.openjdk.org/browse/JDK-8316423</a>,
          this issue is only tracked as affecting secondary stages? At
          least in our case it affects the primary stage as well, i.e.
          the one that is supplied via Application.start. Also, in this
          case it's not really about the scene dimensions, the stage
          doesn't even apply its own dimensions that were explicitly set
          before.<br>
        </p>
        <div class="moz-cite-prefix">On 10/23/2023 4:39 PM, Thiago
          Milczarek Sayão wrote:<br>
        </div>
        <blockquote type="cite"
cite="mid:CAAP_wu=wtowFyiANzR9MOR+EX3c7xhAnF+s6mL8z=wNPU0NWFw@mail.gmail.com">
          <div dir="auto">Forgot to mention: except for the system tray,
            I'm not looking into that.</div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">Em seg., 23 de out. de
              2023 11:36, Thiago Milczarek Sayão <<a
                href="mailto:thiago.sayao@gmail.com"
                moz-do-not-send="true" class="moz-txt-link-freetext">thiago.sayao@gmail.com</a>>
              escreveu:<br>
            </div>
            <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="auto">Hi Cristopher,
                <div dir="auto"><br>
                </div>
                <div dir="auto"><a
                    href="https://github.com/openjdk/jfx/pull/1249"
                    target="_blank" rel="noreferrer"
                    moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jfx/pull/1249</a><br>
                </div>
                <div dir="auto"><br>
                </div>
                <div dir="auto">We noticed it and I'm working on a fix.</div>
                <div dir="auto"><br>
                </div>
                <div dir="auto">There's one issue that is probably a
                  mutter bug:</div>
                <div dir="auto"><br>
                </div>
                <div dir="auto"><a
href="https://gitlab.gnome.org/GNOME/mutter/-/issues/3092"
                    target="_blank" rel="noreferrer"
                    moz-do-not-send="true" class="moz-txt-link-freetext">https://gitlab.gnome.org/GNOME/mutter/-/issues/3092</a></div>
                <div dir="auto"><br>
                </div>
                <div dir="auto">-- Thiago </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">Em seg., 23 de out. de
                  2023 10:05, Christopher Schnick <<a
                    href="mailto:crschnick@xpipe.io" target="_blank"
                    rel="noreferrer" moz-do-not-send="true"
                    class="moz-txt-link-freetext">crschnick@xpipe.io</a>>
                  escreveu:<br>
                </div>
                <blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  <div>
                    <p>Hello,</p>
                    <p>a user of our application <a
                        href="https://github.com/xpipe-io/xpipe"
                        rel="noreferrer noreferrer" target="_blank"
                        moz-do-not-send="true">xpipe</a> reported
                      several issues after upgrading their Ubuntu
                      version and I investigated them myself. I want to
                      note here that these issues are exclusive to new
                      Ubuntu versions. I did not observe any of them on
                      slightly older Ubuntu versions or other
                      Gnome-based desktop environments. I don't know
                      exactly which versions are affected, but 22.04
                      works fine and Ubuntu 23.10 does not.<br>
                    </p>
                    <p>I'm sorry that I'm not able to create fully
                      reproducible examples or dig deeper into the
                      causes here, but I'm very constrained on time
                      right now. For reproduction, I just installed a
                      new default Ubuntu 23.10 VM and launched the
                      JavaFX 21 application straight out of the box.<br>
                    </p>
                    <p>The first issue is that windows do not retain
                      their information when being hidden and then shown
                      again. I.e. after being shown for the second time,
                      they will have tiny dimensions and an GTK error is
                      printed to stderr about <font face="monospace">height
                        < 0</font>. For now I temporarily resolve
                      this by doing the following, which somehow fixes
                      the issue:</p>
                    <p><font face="monospace">        stage.show();<br>
                        <br>
                                // Due to some weird GTK bug, we have to
                        set these sizes every time we show a window
                        again even though they have been previously set<br>
                                stage.setX(stage.getX());<br>
                                stage.setY(stage.getY());<br>
                                stage.setWidth(stage.getWidth());<br>
                                stage.setHeight(stage.getHeight());</font><br>
                    </p>
                    <p>Furthermore, while this is technically not purely
                      JavaFX related, there is also a total freeze of
                      the platform thread when it calls <font
                        face="monospace">javax.swing.UIManager.setLookAndFeel
                      </font>as it gets stuck in some GTK implementation
                      method. This is called by the fxtrayicon library,
                      which calls this method <a
href="https://github.com/dustinkredmond/FXTrayIcon/blob/81c99a7357d8f48d9547c0bdb54b848041ce67c6/src/main/java/com/dustinredmond/fxtrayicon/FXTrayIcon.java#L923"
                        rel="noreferrer noreferrer" target="_blank"
                        moz-do-not-send="true">here</a>. Since there is
                      no native JavaFX tray integration, calling these
                      awt/swing related methods is quite important for
                      applications trying to use the system tray. This
                      was a very unfortunate issue for us as it caused
                      applications to not start up at all on affected
                      systems.<br>
                      I wasn't able to compare the behavior to Ubuntu
                      22.04 as SystemTray.isSupported() returns false on
                      Ubuntu 22.04 but returns true on Ubuntu 23.10.
                      Should this even return true on Ubuntu now or is
                      this a bug?<br>
                    </p>
                    <p>Again, these issues only occur on the very latest
                      Ubuntu release. I have tested on a lot of other
                      different distros, old and new, and they all
                      worked flawlessly.</p>
                    <p>Best regards, Christopher<br>
                    </p>
                  </div>
                </blockquote>
              </div>
            </blockquote>
          </div>
        </blockquote>
      </blockquote>
      <br>
    </blockquote>
  </body>
</html>