Hi Danesh,
On 10/25/2011 10:00 PM, Danesh Dadachanji wrote:
On 24/10/11 08:49 AM, Anthony Petrov wrote:
While you're at it, there's just been filed a bug report:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7103610
WM_CLASS is already set to something relative to what is being run. E.g.
when using xprop on a Frame
$ xprop
WM_CLASS(STRING) = "sun-awt-X11-XFramePeer", "test-TestFrame"
Reading the specs of WM_CLASS[1], I think the above is incorrect. I
believe "test-TestFrame" makes more sense as the first st ring, the
instance name.
As for the second one, from my understanding of the spec, you would want
it to be set to something more generic that. Do you think "Java" is a
better option?
I agree that the strings might be in the inverse order currently, and it
would be nice to have them in the correct order. There's some sense in
using the "sun-awt-X11-XFramePeer" however, since it may be used to
distinguish between apps run using the XToolkit, and legacy MToolkit
(removed in JDK7, but still available for apps run with JDK6 and
earlier). If in the future we introduce some alternative AWT toolkit,
then having the toolkit name in the string might be useful.
Having said that, I don't think we should change the value of the
property. There's two reasons:
1. The WM_CLASS property is used to look up X resources for the app.
Java apps (and AWT itself) have never used X resources, and as such it
actually doesn't matter at all what is specified in these property.
2. Some developers may rely on the current order of the strings if they
want to look up Java windows from their native apps, for example. If we
change the order now, we may break these use cases. While the order has
never been specified, I don't see a good reason for this change at this
time.
which suggests that the mentioned window properties need to be set on
all application's windows, not just the tray icon window. What do you
think about extending this logic to all windows? We could add a method
in the XWindowPeer class for this, and install the properties on all
windows (including the tray icon - since it's an embedded frame that
uses the XEmbeddedFramePeer as its peer).
If all app windows need to be set, wouldn't this mean all X components
as well? In which case, how does adding the code to XBaseWidnow (looking
specifically at init) sound?
I don't think so. The window properties are used by the window manager
(mostly). The window manager will never see our child windows, and as
such setting the property for them seems useless.
There's no any guarantees regarding the format of the string returned.
Which means that if the XToolkit code is going to be run with a VM other
than, say, Hotspot, the method may return a differently formatted
string, and hence this code may fail.
Is there a more robust way to obtain the PID and the client FQDN?
For the PID, I think using JNI to access getpid() would be the next best
option. I'll look for another way to find the FQDN.
Yes, using getpid() via JNI seems reasonable. I guess gethostname() from
unistd.h might be used to obtain the FQDN.
--
best regards,
Anthony