Axel Howind created PDFBOX-5734:
-----------------------------------

             Summary: PDFBox debugger: UI unusable when started from 
PDFBox-app.jar
                 Key: PDFBOX-5734
                 URL: https://issues.apache.org/jira/browse/PDFBOX-5734
             Project: PDFBox
          Issue Type: Improvement
    Affects Versions: 4.0.0
            Reporter: Axel Howind


On MacOS the PDFBox Dubber app works correctly when starting the app from the 
debugger-app.jar using `java -jar debugger-app.jar`, but when it is started 
using `java -jar pdfbox-app.jar debug`, the menu bar does not show and the UI 
is unresponsive.

This is caused by the following line in PDFBox.java:

    System.setProperty("apple.awt.UIElement", "true");

I found the following information regarding that property:
{quote}Setting System.setProperty("apple.awt.UIElement", "true") makes the AWT 
widgets in your Java application behave as 'UI Elements', suppressing the dock 
icon and menu bar. However, once set, this cannot be reversed within the same 
running instance of JVM.
{quote}
This issue is more or less a dupliate of PDFBOX-3507, just that that one is 
about the PDFDebugger app. I propose to take the same approach and simply 
delete above line from the code. This would have the effect, that the dock icon 
might show on macOS when the application is run (even when the debugger is not 
started).

If this is not desired, we could use something like this as a workaround:
 
{code:java}
    // suppress the Dock icon on OS X unless "debug" is present on commandline
    boolean isDebug = Arrays.stream(args).map(s -> 
s.toLowerCase(Locale.ROOT)).anyMatch(s -> s.equals("debug"));
    System.setProperty("apple.awt.UIElement", String.valueOf(!isDebug));
{code}
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to