You are not logged in.

#1 2014-12-11 10:39:25

ssijak
Member
From: Serbia
Registered: 2011-05-03
Posts: 15

Problem with java transparent windows, can`t make them

I can not make transparent windows on my arch linux box. Same code works on osx and windows. When I do

System.out.println(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.PERPIXEL_TRANSPARENT));
System.out.println(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT));
System.out.println(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT));

In gnome it prints :
true
true
true

But then when I try to make window transparent :

WindowUtils.setWindowTransparent(transparentWindow, true);

It fails with :

Exception in thread "main" java.lang.IllegalArgumentException: Window GraphicsConfiguration 'X11GraphicsConfig[dev=X11GraphicsDevice[screen=0],vis=0x20]' does not support transparency
	at com.sun.jna.platform.WindowUtils$X11WindowUtils.setWindowTransparent(WindowUtils.java:1408)
	at com.sun.jna.platform.WindowUtils.setWindowTransparent(WindowUtils.java:1549)

After some googling I found that I have to have some thing called ARGB set in X11 or something like that, but I do not know where and how to set it. Also, minor problem is that on KDE

System.out.println(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT)); 

returns false.

Last edited by ssijak (2014-12-11 12:44:26)

Offline

#2 2014-12-11 12:30:00

ssijak
Member
From: Serbia
Registered: 2011-05-03
Posts: 15

Re: Problem with java transparent windows, can`t make them

Fixed it with custom JWindow :

public class TransparentWindow extends JWindow {

 public TransparentWindow(Window owner) {
    this(owner, WindowUtils.getAlphaCompatibleGraphicsConfiguration());
  }


  private TransparentWindow(Window owner, GraphicsConfiguration graphicsConfiguration) {
    super(owner, graphicsConfiguration);
  }

 ....

}

But, how can I make this work under kde and kwin? Under kwin this System.out.println(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT)) prints false hmm As I understood after some googling java checks this variable _NET_WM_WINDOW_OPACITY and kwin does not report it or something. How to fix it?

Last edited by ssijak (2014-12-11 12:43:25)

Offline

#3 2014-12-11 12:36:34

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,872
Website

Re: Problem with java transparent windows, can`t make them

Please use code tags for code.


https://ugjka.net
"It is easier to fool people, than to convince them that they've been fooled" ~ Dr. Andrea Love

Offline

#4 2014-12-11 12:47:42

ssijak
Member
From: Serbia
Registered: 2011-05-03
Posts: 15

Re: Problem with java transparent windows, can`t make them

It now works on KDE also but it still reports System.out.println(AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT)) prints false. Strange, but whatever.

Offline

Board footer

Powered by FluxBB