Communicating with window managers through a JNI wrapper

Lubos Lunak l.lunak at
Thu Nov 8 06:09:30 PST 2007

On Thursday 08 of November 2007, Matthias Käppler wrote:
> Hi,
> we're developing a Java project that requires communication with the
> operating system's window management in order to perform basic operations
> on windows such as maximizing, minimizing, hiding and so forth. This
> interface has already been implemented for the Win32 API, and we are now
> targeting UNIX/Linux platforms running X11.
> The problem is that there is very few documentation on the web regarding
> X11 programming  (google search)

> and even less documentation on how to interact with window 
> managers in a way that is independent of the actual window manager
> implementation. As far as I understand, the NetWM standard is an effort to
> allow just that, is that correct?

 The basic window manager specification is part of the ICCCM  (gg:icccm). 
NETWM, these days more known as EWMH (gg:ewmh), builds on top of it and adds 
new features.
> I have already started work on that wrapper and played around with sending
> client messages, some of which are successfully interpreted by the window
> manager I am running (GNOME's Metacity), and some are not.

 Please don't limit yourself to just one window manager.

> For example, while I am able to send minimize hints to X11 (e.g. via
> XIconifyWindow), there doesn't seem to be a way to reverse that state to
> normal. I tried sending a WM_CHANGE_STATE client message with the
> NormalState flag set but that didn't work. I have since started to read
> source codes of various window managers but I can't seem to figure out how
> you do that.

 I think XMapWindow() in this case is the inverese of XIconifyWindow(). There 
should be a section in ICCCM describing this.

> Meanwhile, I doubt that this whole NetWM standard thing is really what we
> need. I feel like I am starting to rewrite functionality the window manager
> is supposed to implement. I only want to trigger that behaviour via a
> standard API, not rewrite it from scratch. For example, when I am sending
> _NET_WM_STATE messages, are these messages interpreted by the window
> manager at all or are they directly interpreted by the X11 server?

 They are for the window manager, X11 provides only some support for window 
manager features, but it's up to the window manager (making it also possible 
to use different window managers with different features and policies). And 
the X messages are the standard API, although it's common to have wrappers 
for that in your toolkit (doesn't Java have any? GNOME has the mentioned 
libwnck library, KDE has its classes 
[ - the netwm* 
files, they're even BSD-style licensed, if you'd feel like taking parts]).

 BTW, you didn't say what exactly you're trying to do, but you really don't 
want to reimplement the functionality of the window manager - they can 
usually handle it quite well on their own and trying to be way too smart 
about it is just asking for problems.

> So, maybe I'm just completey targeting this issue the wrong way? Can you
> give me (being new to X11 programming) some advice on how to tackle this
> problem?

Lubos Lunak
KDE developer
SUSE LINUX, s.r.o.   e-mail: l.lunak at , l.lunak at
Lihovarska 1060/12   tel: +420 284 028 972
190 00 Prague 9      fax: +420 284 028 951
Czech Republic       http//

More information about the xorg mailing list