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

Issue with transparency on Linux #1339

Closed
DevSrSouza opened this issue Oct 31, 2021 · 8 comments · Fixed by #1601
Closed

Issue with transparency on Linux #1339

DevSrSouza opened this issue Oct 31, 2021 · 8 comments · Fixed by #1601
Assignees
Milestone

Comments

@DevSrSouza
Copy link
Contributor

I'm having couple issues with transparency support on Linux

  • At my second monitor (4k one) it fails to setup SkiaLayer with a exception (in thread).
  • When It get open at my primary monitor (2k) it have a poor performance, when I switch my second monitor to 2k the performance get a lot better. (the application is still being displayed at the first monitor)
  • When I try to move the window to the second monitor (SUPER + SHIFT + LEFT) it gives my the exception in the first case and stop working.
  • When moving from extend to mirror screens, the issue does not appear.
  • When moving from single monitor to extend screen with the application is open, the issue do not appear.
  • Using WindowDraggableArea also breaks the application if it was running previously.

System information:

  • Pop!_OS 21.04 x86_64
  • JDK 16
  • Gnome version 3.38.5
  • X11

Exception:

Cannot create Linux GL context
Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: SkiaLayer is disposed
	at org.jetbrains.skiko.SkiaLayer.update$skiko(SkiaLayer.jvm.kt:408)
	at org.jetbrains.skiko.redrawer.AbstractDirectSoftwareRedrawer.redrawImmediately(AbstractDirectSoftwareRedrawer.kt:36)
	at org.jetbrains.skiko.redrawer.LinuxSoftwareRedrawer.redrawImmediately(LinuxSoftwareRedrawer.kt:24)
	at org.jetbrains.skiko.SkiaLayer.paint(SkiaLayer.jvm.kt:317)
	at androidx.compose.ui.awt.ComposeLayer$ComponentImpl.paint(ComposeLayer.desktop.kt:100)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1083)
	at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:586)
	at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:907)
	at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5271)
	at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:246)
	at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1323)
	at java.desktop/javax.swing.JComponent.paint(JComponent.java:1060)
	at java.desktop/java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:39)
	at java.desktop/sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:75)
	at java.desktop/sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:112)
	at java.desktop/java.awt.Container.paint(Container.java:2003)
	at java.desktop/java.awt.Window.paint(Window.java:3949)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:876)
	at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:848)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:848)
	at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:823)
	at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:772)
	at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1884)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Code

Window(
            onCloseRequest = ::exitApplication,
            undecorated = true,
            transparent = true,
            alwaysOnTop = true,
            resizable = false,
            state = windowState,
        ) {
            WindowDraggableArea {
                Surface(
                    modifier = Modifier.fillMaxSize().padding(8.dp).shadow(3.dp, RoundedCornerShape(20.dp)),
                    color = Color(55, 55, 55),
                    shape = RoundedCornerShape(20.dp) //window has round corners now
                ) {
                    Text("anything")
                }
            }
        }
@igordmn igordmn added this to the 1.0 milestone Nov 1, 2021
@igordmn igordmn added the p:high High priority label Nov 2, 2021
@olonho
Copy link
Contributor

olonho commented Nov 2, 2021

We need to document problem and workarounds.

@akurasov akurasov self-assigned this Nov 2, 2021
@akurasov
Copy link
Contributor

akurasov commented Nov 2, 2021

idea is to document some workaround for application developers to mitigate this issue

@mareklangiewicz
Copy link
Contributor

mareklangiewicz commented Nov 9, 2021

I have the same exception when changing window state to WindowPlacement.Fullscreen
Happens iff Window(transparent = true, ...).
Even on single display (I checked both external and internal - no difference)
Ubuntu 21.10; Gnome 40.4.0; Wayland

Update: forgot to add: error causes my IDE to go fullscreen instead of the app - which is funny :-)

@akurasov
Copy link
Contributor

Fix merged. Only documentation remains.

@DevSrSouza
Copy link
Contributor Author

Tested, is not crashing anymore, but transparency is not working at all now.

@DevSrSouza
Copy link
Contributor Author

DevSrSouza commented Nov 15, 2021

Okay, is working but when happen the issue that would crash, the transparency is just disable. Nice!

akurasov added a commit that referenced this issue Dec 15, 2021
akurasov added a commit that referenced this issue Dec 16, 2021
)

* Adding transparent windows information

Also closes #1339

* Update README.md
mareklangiewicz pushed a commit to mareklangiewicz/compose-jb that referenced this issue Feb 14, 2022
…tBrains#1601)

* Adding transparent windows information

Also closes JetBrains#1339

* Update README.md
@toasterofbread
Copy link

toasterofbread commented Feb 16, 2024

I believe this is the relevant bug in the JDK (is a transparency-specific duplicate of this), which is marked as fixed in JDK 22.

I ran my project using the latest build of JDK 22 and it did indeed fix the issue.

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants