Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orchard as dependency will cause problems with swing UI applications #162

Open
cgrabenstein opened this issue Aug 21, 2022 · 3 comments
Open
Labels
good first issue Good for newcomers

Comments

@cgrabenstein
Copy link

This is basically a repost of clojure-emacs/cider-nrepl#610, but the origin of the cider-nrepl issue can be found here, in this repository.

Expected behavior

Using orchard (or any other library that depends on it) on mac does not affect the way how java swing frames are being displayed.

Actual behavior

Using orchard (or, for example cider/cider-nrepl) causes swing frames to "hover" on mac. I can't use cmd+tab to switch to the frame which makes developing very cumbersome.

Steps to reproduce the problem

  1. Clone this repository
  2. run lein repl
  3. run the following commands
user=> (require 'orchard.java.parser)
nil
user=> (import 'javax.swing.JFrame)
javax.swing.JFrame
user=> (doto (JFrame.) (.setSize 200 200) (.setVisible true))
#object[javax.swing.JFrame 0x6b3a36ef "javax.swing.JFrame[frame0,0,25,200x200,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,28,200x172,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]"]
  1. compare with
user=> (System/setProperty "apple.awt.UIElement" "false")
nil
user=> (require 'orchard.java.parser)
nil
user=> (import 'javax.swing.JFrame)
javax.swing.JFrame
user=> (doto (JFrame.) (.setSize 200 200) (.setVisible true))
#object[javax.swing.JFrame 0x6b3a36ef "javax.swing.JFrame[frame0,0,25,200x200,layout=java.awt.BorderLayout,title=,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,28,200x172,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]"]

The reason for this behaviour can be found here: https://github.com/clojure-emacs/orchard/blob/master/src-newer-jdks/orchard/java/parser.clj#L134

Environment & Version information

Clojure version

$ clj --version
Clojure CLI version 1.11.1.1155

Java version

$ java --version
openjdk 18.0.2 2022-07-19
OpenJDK Runtime Environment Homebrew (build 18.0.2+0)
OpenJDK 64-Bit Server VM Homebrew (build 18.0.2+0, mixed mode, sharing)

Operating system

macOS Monterey 12.3.1

@bbatsov
Copy link
Member

bbatsov commented Aug 21, 2022

The reason for this behaviour can be found here: https://github.com/clojure-emacs/orchard/blob/master/src-newer-jdks/orchard/java/parser.clj#L134

But that's supposedly the solution for the problem, right?

@vemv
Copy link
Member

vemv commented Aug 21, 2022

It's not - that line of code is meant to prevent a GUI nuisance from popping up in non GUI projects.

The issue is with GUI projects.

However that same line of code suggests a fix: set apple.awt.UIElement in advance for whatever value is best for your GUI app.

Non-GUI apps need to do nothing.

I'd suggest to close this issue by documenting the behavior in cider.

@bbatsov
Copy link
Member

bbatsov commented Aug 21, 2022

Ah, yeah - I didn't read the ticket carefully enough. I agree we should document it as the simplest solution.

@bbatsov bbatsov added the good first issue Good for newcomers label Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants