1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

wmaker: make the '--replace' de-activable at compile time

As it is really unlikely that in normal use case someone would need this
feature, it is now conditional code, which is not enabled by default; the
configure scripts now propose a '--enable-wmreplace' option to enable the
corresponding code, as people making package for distributions may want to
enable the feature to provide users the ability to give a try of all the
window managers.

Suggested-by: Carlos R. Mafra <crmafra@gmail.com>
Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2015-05-14 18:55:33 +02:00
committed by Carlos R. Mafra
parent 28b0169147
commit ea2b5f0641
7 changed files with 42 additions and 0 deletions

View File

@@ -526,6 +526,20 @@ AS_IF([test "x$enable_xdnd" = "xyes"],
AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_dock_xdnd" != "xno"]) AM_CONDITIONAL([USE_DOCK_XDND], [test "x$enable_dock_xdnd" != "xno"])
dnl Support for ICCCM 2.0 Window Manager replacement
dnl ================================================
AC_ARG_ENABLE([wmreplace],
[AS_HELP_STRING([--enable-wmreplace], [support for ICCCM window manager replacement])],
[AS_CASE([$enableval],
[yes|no], [],
[AC_MSG_ERROR([bad value '$enableval' for --enable-wmreplace])])],
[enable_wmreplace=no])
AS_IF([test "x$enable_wmreplace" = "xyes"],
[AC_DEFINE([USE_ICCCM_WMREPLACE], [1],
[define to support ICCCM protocol for window manager replacement])
supported_xext="$supported_xext WMReplace"])
dnl XShape support dnl XShape support
dnl ============== dnl ==============
AC_ARG_ENABLE([shape], AC_ARG_ENABLE([shape],

View File

@@ -575,6 +575,12 @@ Disable support for Motif's MWM Window Manager hints.
These attributes were introduced by the Motif toolkit to ask for special window appearance requests. These attributes were introduced by the Motif toolkit to ask for special window appearance requests.
Nowadays this is covered by the NetWM/EWMH specification, but there are still applications that rely on MWM Hints. Nowadays this is covered by the NetWM/EWMH specification, but there are still applications that rely on MWM Hints.
@item --enable-wmreplace
Add support for the @emph{ICCCM} protocol for cooperative window manager replacement.
This feature is disabled by default because you probably don't need to switch seamlessly the window manager;
if you are making a package for a distribution you'd probably want to enable this because it allows users to give
a try to different window managers without restarting everything for an extra cost that is not really big.
@item --disable-xdnd @item --disable-xdnd
Disable support for dragging and dropping files on the dock, which launches a user-specified command Disable support for dragging and dropping files on the dock, which launches a user-specified command
with that file. with that file.

View File

@@ -463,7 +463,9 @@ extern struct WPreferences {
char show_clip_title; char show_clip_title;
struct { struct {
#ifdef USE_ICCCM_WMREPLACE
unsigned int replace:1; /* replace existing window manager */ unsigned int replace:1; /* replace existing window manager */
#endif
unsigned int nodock:1; /* don't display the dock */ unsigned int nodock:1; /* don't display the dock */
unsigned int noclip:1; /* don't display the clip */ unsigned int noclip:1; /* don't display the clip */
unsigned int clip_merged_in_dock:1; /* disable clip, switch workspaces with dock */ unsigned int clip_merged_in_dock:1; /* disable clip, switch workspaces with dock */

View File

@@ -1894,6 +1894,7 @@ static void handleVisibilityNotify(XEvent * event)
static void handle_selection_clear(XSelectionClearEvent *event) static void handle_selection_clear(XSelectionClearEvent *event)
{ {
#ifdef USE_ICCCM_WMREPLACE
WScreen *scr = wScreenForWindow(event->window); WScreen *scr = wScreenForWindow(event->window);
if (!scr) if (!scr)
@@ -1904,4 +1905,11 @@ static void handle_selection_clear(XSelectionClearEvent *event)
wmessage(_("another window manager is replacing us!")); wmessage(_("another window manager is replacing us!"));
Shutdown(WSExitMode); Shutdown(WSExitMode);
#else
/*
* If the support for ICCCM window manager replacement was not enabled, we should not receive
* this kind of event, so we simply do nothing.
*/
(void) event;
#endif
} }

View File

@@ -435,7 +435,9 @@ static void print_help(void)
puts(_("The Window Maker window manager for the X window system")); puts(_("The Window Maker window manager for the X window system"));
puts(""); puts("");
puts(_(" -display host:dpy display to use")); puts(_(" -display host:dpy display to use"));
#ifdef USE_ICCCM_WMREPLACE
puts(_(" --replace replace running window manager")); puts(_(" --replace replace running window manager"));
#endif
puts(_(" --no-dock do not open the application Dock")); puts(_(" --no-dock do not open the application Dock"));
puts(_(" --no-clip do not open the workspace Clip")); puts(_(" --no-clip do not open the workspace Clip"));
puts(_(" --no-autolaunch do not autolaunch applications")); puts(_(" --no-autolaunch do not autolaunch applications"));
@@ -652,8 +654,10 @@ static int real_main(int argc, char **argv)
wPreferences.flags.noclip = 1; wPreferences.flags.noclip = 1;
} else if (strcmp(argv[i], "-nodrawer") == 0 || strcmp(argv[i], "--no-drawer") == 0) { } else if (strcmp(argv[i], "-nodrawer") == 0 || strcmp(argv[i], "--no-drawer") == 0) {
wPreferences.flags.nodrawer = 1; wPreferences.flags.nodrawer = 1;
#ifdef USE_ICCCM_WMREPLACE
} else if (strcmp(argv[i], "-replace") == 0 || strcmp(argv[i], "--replace") == 0) { } else if (strcmp(argv[i], "-replace") == 0 || strcmp(argv[i], "--replace") == 0) {
wPreferences.flags.replace = 1; wPreferences.flags.replace = 1;
#endif
} else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) { } else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
printf("Window Maker %s\n", VERSION); printf("Window Maker %s\n", VERSION);
exit(0); exit(0);

View File

@@ -66,7 +66,9 @@
|SubstructureRedirectMask|ButtonPressMask|ButtonReleaseMask\ |SubstructureRedirectMask|ButtonPressMask|ButtonReleaseMask\
|KeyPressMask|KeyReleaseMask) |KeyPressMask|KeyReleaseMask)
#ifdef USE_ICCCM_WMREPLACE
#define REPLACE_WM_TIMEOUT 15 #define REPLACE_WM_TIMEOUT 15
#endif
#define STIPPLE_WIDTH 2 #define STIPPLE_WIDTH 2
#define STIPPLE_HEIGHT 2 #define STIPPLE_HEIGHT 2
@@ -108,6 +110,7 @@ static void make_keys(void)
*/ */
static Bool replace_existing_wm(WScreen *scr) static Bool replace_existing_wm(WScreen *scr)
{ {
#ifdef USE_ICCCM_WMREPLACE
char atomName[16]; char atomName[16];
Window wm; Window wm;
XSetWindowAttributes attribs; XSetWindowAttributes attribs;
@@ -139,10 +142,12 @@ static Bool replace_existing_wm(WScreen *scr)
if (!XChangeWindowAttributes(dpy, wm, CWEventMask, &attribs)) if (!XChangeWindowAttributes(dpy, wm, CWEventMask, &attribs))
wm = None; wm = None;
} }
#endif
/* for our window manager info notice board and the selection owner */ /* for our window manager info notice board and the selection owner */
scr->info_window = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, 0, 0); scr->info_window = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, 10, 10, 0, 0, 0);
#ifdef USE_ICCCM_WMREPLACE
/* Try to acquire the selection */ /* Try to acquire the selection */
current_time = CurrentTime; current_time = CurrentTime;
ret = XSetSelectionOwner(dpy, scr->sn_atom, scr->info_window, current_time); ret = XSetSelectionOwner(dpy, scr->sn_atom, scr->info_window, current_time);
@@ -188,6 +193,7 @@ static Bool replace_existing_wm(WScreen *scr)
event.data.l[4] = (long) 0L; event.data.l[4] = (long) 0L;
event.window = scr->root_win; event.window = scr->root_win;
XSendEvent(dpy, scr->root_win, False, StructureNotifyMask, (XEvent *) &event); XSendEvent(dpy, scr->root_win, False, StructureNotifyMask, (XEvent *) &event);
#endif
return True; return True;
} }

View File

@@ -69,7 +69,9 @@ typedef struct WDrawerChain {
typedef struct _WScreen { typedef struct _WScreen {
int screen; /* screen number */ int screen; /* screen number */
Window info_window; /* for our window manager info stuff */ Window info_window; /* for our window manager info stuff */
#ifdef USE_ICCCM_WMREPLACE
Atom sn_atom; /* window manager selection */ Atom sn_atom; /* window manager selection */
#endif
int scr_width; /* size of the screen */ int scr_width; /* size of the screen */
int scr_height; int scr_height;