1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-07-13 01:06:30 +02:00

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.
This commit is contained in:
Iain Patterson
2015-05-14 18:55:32 +02:00
committed by Carlos R. Mafra
parent fa5f8d9937
commit 28b0169147
5 changed files with 133 additions and 5 deletions
+3
View File
@@ -435,6 +435,7 @@ static void print_help(void)
puts(_("The Window Maker window manager for the X window system"));
puts("");
puts(_(" -display host:dpy display to use"));
puts(_(" --replace replace running window manager"));
puts(_(" --no-dock do not open the application Dock"));
puts(_(" --no-clip do not open the workspace Clip"));
puts(_(" --no-autolaunch do not autolaunch applications"));
@@ -651,6 +652,8 @@ static int real_main(int argc, char **argv)
wPreferences.flags.noclip = 1;
} else if (strcmp(argv[i], "-nodrawer") == 0 || strcmp(argv[i], "--no-drawer") == 0) {
wPreferences.flags.nodrawer = 1;
} else if (strcmp(argv[i], "-replace") == 0 || strcmp(argv[i], "--replace") == 0) {
wPreferences.flags.replace = 1;
} else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
printf("Window Maker %s\n", VERSION);
exit(0);