[comp.windows.x] Is a window manager running?

praty@inteloa.intel.com (Pratyush Jaiswal) (11/15/88)

This should be an easy one. How can a client find out if there is a window
manager running on a particular display, or not?

For those who are wondering why a client should need this, the client in
question is a window manager. Essentially, my window manager would like to 
know if there is one already running; if so, then quit gracefully.

The only relevant thing I could find was to check if the XA_WM_ICON_SIZE
property is set on the root window. However, a survey of my sample of window
managers (2), showed that neither of them set it. Are these "ill-behaved", or
is there something else?

I am still on V11R2. Thanks.

Pratyush.
--------------------------------------------------------------------------
praty@inteloa.intel.com
{verdix, ogccse, tektronix, omepd, siemens}!inteloa!praty

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (11/16/88)

Window managers typically select for SubstructureRedirect
on the root window, and only one client can select for this.
So you can use success/failure of selecting for this as a
pretty reliable indicator.  The fact that not all window
managers check for failure here is a bug.

jim@athsys.uucp (Jim Becker) (11/17/88)

From article <3921@omepd>, by praty@inteloa.intel.com (Pratyush Jaiswal):
> This should be an easy one. How can a client find out if there is a window
> manager running on a particular display, or not?
> 

	The sample window manager "wm" in R2 does this in the file test.c
(under directory ..X.V11R2/core.src/demos/wm) by attempting to change the
window attributes of the root window. It indirectly determines this through
setting an errorStatus return in the resulting XError if there is already a 
window manager running. This is done in the file errHndlr.c in the same 
directory.

	I don't know how legit this is, but I guess it's one method!

> 
> Pratyush.
> --------------------------------------------------------------------------
> praty@inteloa.intel.com
> {verdix, ogccse, tektronix, omepd, siemens}!inteloa!praty

diamant@hpfclp.SDE.HP.COM (John Diamant) (11/18/88)

> Window managers typically select for SubstructureRedirect
> on the root window, and only one client can select for this.
> So you can use success/failure of selecting for this as a
> pretty reliable indicator.  The fact that not all window
> managers check for failure here is a bug.

Not all window managers do this though.  I haven't looked at R3 yet, so this
may no longer be true, but R2 uwm didn't.  It would be nice for at least some
window managers not to select for SubstructureRedirect that (I think that
is only required on a reparenting window manager) because this can be a
real performance bottleneck under some cirucumstances (a request has to go
from client to server, to window manager, back to server, and back
to client, at least for toolkit requests and such that need to know if their
request was granted).  This is much worse than a round trip -- it's two
cascaded round trips.


John Diamant
Software Engineering Systems Division
Hewlett-Packard Co.		ARPA Internet: diamant@hpfclp.sde.hp.com
Fort Collins, CO		UUCP:  {hplabs,hpfcla}!hpfclp!diamant