wmaker: replace and be replaced (ICCCM protocol)
commit28b016914706b2c8eb062992f788c1b7cca35efe
authorIain Patterson <wm@iain.cx>
Thu, 14 May 2015 16:55:32 +0000 (14 18:55 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Fri, 15 May 2015 16:44:50 +0000 (15 17:44 +0100)
tree33da3c0b7cbda934a31d4b344d9aef8a1e49e476
parentfa5f8d99375649df869e079d084af6dcc5bf25c2
wmaker: replace and be replaced (ICCCM protocol)

Use the same logic used by xfwm4, metacity et al to replace an existing
window manager on the screen and allow other window managers to replace
us, as defined by the ICCCM 2.0:

http://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html
  Communication with the Window Manager by Means of Selections

By convention those window managers try to become the selection owner of
the WM_Sn atom where n is the screen number.  If the atom is owned by
another window manager and the --replace argument was not given to wmaker
we fail to start.  If the argument was given we try to become the new
owner and wait for the existing window manger to exit.

After a successful startup we watch for SelectionClear events on the
atom and initiate a shutdown if one arrives, as that implies that
another window manager was started with --replace.
src/WindowMaker.h
src/event.c
src/main.c
src/screen.c
src/screen.h