wmIsRunning bit in the server
otaylor at redhat.com
Mon Aug 25 13:45:06 PDT 2008
On Mon, 2008-08-25 at 13:20 -0700, Jeremy Huddleston wrote:
> On Aug 25, 2008, at 11:48, Owen Taylor wrote:
> > On Mon, 2008-08-25 at 11:29 -0700, Jeremy Huddleston wrote:
> >> How can I query from within the server if a WM is running on the
> >> server? I have a thread on the server that needs to wait until
> >> xinitrc has "finished" (ie, the window-manager is running) before it
> >> should continue. I know that if you try to run a second WM on a
> >> server with one already, it will fail, so this leads me to believe
> >> that there are bits in the server itself which I can query to figure
> >> this out. I grepped a bit looking for something but couldn't find
> >> it. Could someone point me in the right direction?
> > If you read the ICCCM, you'll see that the window manager being
> > running
> > is defined by the ownership of a (per-screen) X selection, which it
> > would be possible to notice within the server.
> Ok... so now just to figure out how to notice that within the server...
Well, you can clearly hack it into ProcSetSelectionOwner(). Though you'd
probably want some sort of generic hook that any DDX could use.
> > However, making anything in the server depend on "xinitrc is finished"
> > or "window manager is running" is clearly wrong.
> Well, this is for a special situation that's really OS-X specific.
> The server is triggered to start when an X11 client connects to the
> $DISPLAY socket. This triggers startx to run and start the server
> which accepts the initial connection from this socket. We want to
> only accept that connection after the wm is running (yes, it's a
> kludge) because we want xinitrc to process ~/.Xresources... otherwise
> the user's xterm isn't as pretty as they want it.
Hmm, that's almost convincing :-) As a random idea, what if you simply
didn't actually map toplevel windows unless they were either
override-redirect or marked with a special property set by the window
manager? (I assume that you have to use a patched/custom window manager
More information about the xorg