Welcome to awesome bug tracking system.

FS#790 - Handling windows from Java applications

Attached to Project: awesome
Opened by Roman Kosenko (kite) - Thursday, 29 July 2010, 20:55 GMT
Last edited by Uli Schlachter (psychon) - Tuesday, 03 August 2010, 09:01 GMT
Task Type Bug Report
Category Core
Status Closed
Assigned To No-one
Operating System Linux
Severity Low
Priority Normal
Reported Version git/3.4
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No


Since a bug report should only be about one topic, this one is about:

1. Awesome doesn't alway correctly detect window class. I don't know why, but sometime it add garbage charters to the end.

This is what was previously entered as the description:

There are a several issues related to Java-application:
1. Awesome doesn't alway correctly detect window class. I don't know why, but sometime it add garbage charters to the end.
2. Minimized (c.minimized=true) java application cannot be restored. You can click taskbar forever but you will never focus/raise it.
3. Java window doesn't receive "focus" signal in lua after closing another window. Steps to reproduce: run any java application, run terminal in the same tag (Win+Enter), close it - java-window should be focused, but it have inactive border and taskbar item isn't highlighted, despite java-window have focus.
A rather like situation is happened when you switching between tag - window receive focus signal through time.
4. It's impossible to close (hide) dialog windows (closed but not fixed ticket #430).
All these issues related to last stable git branch (3.4) of awesome and last stable sun/oracle jdk (1.6.0_21). And not one appears in xmonad.
This task depends upon

Closed by  Uli Schlachter (psychon)
Tuesday, 03 August 2010, 09:01 GMT
Reason for closing:  Deferred
Additional comments about closing:  Forwarded the bug to freedesktop's bug tracker: i?id=29373
Comment by Uli Schlachter (psychon) - Thursday, 29 July 2010, 21:08 GMT
What you describe sounds like 4 different bug reports to me, not just a single one. This will mean stuff gets mixed up and this report gets closed when only some of this is handled.

Also, could you give some hints on how to reproduce this?
1. I just start $RANDOM_JAVA_APP three times, notices that the class looks fine and then close this as WORKSFORME? Also, awesome uses xcb-util's xcb_get_wm_class_*() functions here, so if there is a bug, it's either in java or xcb-util, not in awesme.
2. Could you paste the xprop output for some random java window? I'm interested in the WM_PROTOCOLS property. Besides that, I kinda doubt that there is such a generic bug on our side that only bites java apps....
3. Hm, this sounds like a good bug report. It's clearly described how to reproduce. I'll give it a try once I get access to some java runtime environment again.
4. Works everywhere else. No idea what java is smoking here. Any hints on how to reproduce?

In case you didn't notice: I don't have java on any of my boxes and I usually try to reproduce these bugs via X11 forwarding with ssh to the university. For some reason (wrong phase of moon?) java doesn't accept any keyboard input here, so it might be a little difficult for me to look into this.
Comment by Uli Schlachter (psychon) - Saturday, 31 July 2010, 08:51 GMT
3. might be a duplicate of  FS#778 , can anyone verify? (FYI:  FS#778  has status "requires testing")
Comment by Anton Bobrov (baverman) - Saturday, 31 July 2010, 09:48 GMT
> 3. might be a duplicate of  FS#778 , can anyone verify?

Yes, this is the same issue. Because java window is not in focus history.
Comment by Roman Kosenko (kite) - Saturday, 31 July 2010, 17:38 GMT
Java programs have so many problems in awesome, so huge number of bugs may confuse. Even more so, many bugs can be related to each other.
1. In most cases it works, but sometime I got error message in log, that pango cannot render the text (in order to display it through naughty), and this text have several garbage characters at the end of the class name. And at the same moment xprop displays proper WM_CLASS. For example, log message:
W: awesome: draw_text_context_init:108: cannot parse pango markup: Error on line 1 char 86: Invalid UTF-8 encoded text in name - not valid 'oracle-ide-boot-LauncherĂ™'
$ xprop | grep -F WM_CLASS
WM_CLASS(STRING) = "sun-awt-X11-XWindowPeer", "oracle-ide-boot-Launcher"
So, I have use rules c.class:match("escaped_something.*") instead of c.class == "something".
I'm noticed that this often starts occur after restarting awesome (by awesome.restart()).
2. WM_DELETE_WINDOW & WM_TAKE_FOCUS. For full output see attach. Minimized java application have changed only WM_STATE and _NET_WM_STATE like any other application.
3. Good, patch from  FS#778  helps to resolve problem.
4. There is test application in  FS#430 .
Comment by Uli Schlachter (psychon) - Saturday, 31 July 2010, 20:45 GMT
So 3. and 4. can be ignored in this bug report. That leaves us with problem 1. and 2.

1. Is there any way to reproduce this? I don't feel like trying a day only to notice that I can't reproduce. If you know how to reproduce this, you could start your java app via 'xtrace java <whatever args your app needs> | grep WM_CLASS' and see if that trailing garbage also shows up in what java sets up. I'd guess so....

2. I'll just assume this is a duplicate of  FS#778 , too. I like bug reports to be about only one topic. ;) I'll edit the summary for this.
Comment by Roman Kosenko (kite) - Sunday, 01 August 2010, 13:39 GMT
1. Do you mean use x11trace? I don't think this will helps, because xprop returns proper values. I can't specify exact way to reproduce, because this happens throw the time and garbage characters always different. So, try to restart by awesome.restart() and then start, for example, Oracle SQL Developer and try to access to the client.class. After several launches of java I get incorrect window class name.
2. No, it doesn't duplicate  FS#778 , patch from  FS#778  resolve problem #3, but not resolve problem #2. These are different problems.
Comment by Uli Schlachter (psychon) - Sunday, 01 August 2010, 14:11 GMT
1. Yes, x11trace. No idea where you got that name from since its dev calls it xtrace...

So, just to be clear:
xprop gives correct values and at the very same time, the client's c.class has garbage appeneded?
Could you get us the output of 'x11trace xprop | grep -1 WM_CLASS' for such a broken java client?

2. No idea about this one, but I'll still ignore it until  FS#778  is gone. As long as there are problems focusing java apps, they might as well influence un-minimizing them which is done through focusing.
Comment by Roman Kosenko (kite) - Tuesday, 03 August 2010, 00:09 GMT
2.  FS#778  is gone if you use patch provided by Anton Bobrov. It works fro me fine and without any negative effect.
1. Problem not in java client... Following are output of "$x11trace sqldeveloper", in this launch first window has class "oracle-ide-boot-Launcher`" in lua (and take into account, that this problem always starts appear after restarting awesome):
000:<:021b: 76: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200008 property=0x43("WM_CLASS") type=0x1f("STRING") data='oracle-ide-boot-Launcher\000oracle-ide-boot-Launcher'
000:<:021d: 72: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200007 property=0x43("WM_CLASS") type=0x1f("STRING") data='sun-awt-X11-XFramePeer\000oracle-ide-boot-Launcher'
000:>:021d: Event PropertyNotify(28) window=0x01200008 atom=0x43("WM_CLASS") time=0x0154ebd9 state=NewValue(0x00)
000:>:021d: Event PropertyNotify(28) window=0x01200007 atom=0x43("WM_CLASS") time=0x0154ebd9 state=NewValue(0x00)
000:<:0236: 76: Request(18): ChangeProperty mode=Replace(0x00) window=0x0120000e property=0x43("WM_CLASS") type=0x1f("STRING") data='sun-awt-X11-XContentWindow\000oracle-ide-boot-Launcher'
000:>:0239: Event PropertyNotify(28) window=0x0120000e atom=0x43("WM_CLASS") time=0x0154ebe4 state=NewValue(0x00)
000:<:023e: 56: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200010 property=0x43("WM_CLASS") type=0x1f("STRING") data='Focus-Proxy-Window\000FocusProxy'
000:>:023f: Event PropertyNotify(28) window=0x01200010 atom=0x43("WM_CLASS") time=0x0154ebe5 state=NewValue(0x00)
000:<:024a: 72: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200011 property=0x43("WM_CLASS") type=0x1f("STRING") data='sun-awt-X11-XWindowPeer\000oracle-ide-boot-Launcher'
000:>:024d: Event PropertyNotify(28) window=0x01200011 atom=0x43("WM_CLASS") time=0x0154ebe7 state=NewValue(0x00)
000:<:09b6: 72: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200043 property=0x43("WM_CLASS") type=0x1f("STRING") data='sun-awt-X11-XFramePeer\000oracle-ide-boot-Launcher'
000:>:09b6: Event PropertyNotify(28) window=0x01200043 atom=0x43("WM_CLASS") time=0x0154fcd5 state=NewValue(0x00)
000:<:09c2: 76: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200045 property=0x43("WM_CLASS") type=0x1f("STRING") data='sun-awt-X11-XContentWindow\000oracle-ide-boot-Launcher'
000:>:09c9: Event PropertyNotify(28) window=0x01200045 atom=0x43("WM_CLASS") time=0x0154fcda state=NewValue(0x00)
000:<:09ca: 56: Request(18): ChangeProperty mode=Replace(0x00) window=0x01200047 property=0x43("WM_CLASS") type=0x1f("STRING") data='Focus-Proxy-Window\000FocusProxy'
000:>:09cd: Event PropertyNotify(28) window=0x01200047 atom=0x43("WM_CLASS") time=0x0154fcda state=NewValue(0x00)
000:>:0ac5: Event PropertyNotify(28) window=0x01200011 atom=0x43("WM_CLASS") time=0x0154fd6d state=Deleted(0x01)
Comment by Uli Schlachter (psychon) - Tuesday, 03 August 2010, 06:24 GMT
Thanks, that partly describes this bug / describes why this only affects java. All of those values are invalid. A proper value would e.g. look like this:

000:>:0027:60: Reply to GetProperty: type=0x1f("STRING") bytes-after=0x00000000 data='x-terminal-emulator\000URxvt\000'

Java doesn't add the last NULL byte ('\000') which is required by ICCCM ( "The WM_CLASS property (of type STRING without control characters) contains two consecutive null-terminated strings."). So the bug is hiding somewhere in xcb-utils / libxcbicccm. I'll take a look
Comment by Uli Schlachter (psychon) - Tuesday, 03 August 2010, 14:56 GMT
xcb-utils bug was fixed[1], java bug is at [2].
The xcb-utils fix only works around the possible crash in the library, if you are lucky this fixes the bug for your app, if you are unlucky the last character of the instance will be stripped off.

[1] i?id=29373