mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-24 15:12:32 +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:
committed by
Carlos R. Mafra
parent
28b0169147
commit
ea2b5f0641
@@ -463,7 +463,9 @@ extern struct WPreferences {
|
||||
char show_clip_title;
|
||||
|
||||
struct {
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
unsigned int replace:1; /* replace existing window manager */
|
||||
#endif
|
||||
unsigned int nodock:1; /* don't display the dock */
|
||||
unsigned int noclip:1; /* don't display the clip */
|
||||
unsigned int clip_merged_in_dock:1; /* disable clip, switch workspaces with dock */
|
||||
|
||||
@@ -1894,6 +1894,7 @@ static void handleVisibilityNotify(XEvent * event)
|
||||
|
||||
static void handle_selection_clear(XSelectionClearEvent *event)
|
||||
{
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
WScreen *scr = wScreenForWindow(event->window);
|
||||
|
||||
if (!scr)
|
||||
@@ -1904,4 +1905,11 @@ static void handle_selection_clear(XSelectionClearEvent *event)
|
||||
|
||||
wmessage(_("another window manager is replacing us!"));
|
||||
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
|
||||
}
|
||||
|
||||
@@ -435,7 +435,9 @@ static void print_help(void)
|
||||
puts(_("The Window Maker window manager for the X window system"));
|
||||
puts("");
|
||||
puts(_(" -display host:dpy display to use"));
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
puts(_(" --replace replace running window manager"));
|
||||
#endif
|
||||
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"));
|
||||
@@ -652,8 +654,10 @@ 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;
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
} else if (strcmp(argv[i], "-replace") == 0 || strcmp(argv[i], "--replace") == 0) {
|
||||
wPreferences.flags.replace = 1;
|
||||
#endif
|
||||
} else if (strcmp(argv[i], "-version") == 0 || strcmp(argv[i], "--version") == 0) {
|
||||
printf("Window Maker %s\n", VERSION);
|
||||
exit(0);
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
|SubstructureRedirectMask|ButtonPressMask|ButtonReleaseMask\
|
||||
|KeyPressMask|KeyReleaseMask)
|
||||
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
#define REPLACE_WM_TIMEOUT 15
|
||||
#endif
|
||||
|
||||
#define STIPPLE_WIDTH 2
|
||||
#define STIPPLE_HEIGHT 2
|
||||
@@ -108,6 +110,7 @@ static void make_keys(void)
|
||||
*/
|
||||
static Bool replace_existing_wm(WScreen *scr)
|
||||
{
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
char atomName[16];
|
||||
Window wm;
|
||||
XSetWindowAttributes attribs;
|
||||
@@ -139,10 +142,12 @@ static Bool replace_existing_wm(WScreen *scr)
|
||||
if (!XChangeWindowAttributes(dpy, wm, CWEventMask, &attribs))
|
||||
wm = None;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
/* Try to acquire the selection */
|
||||
current_time = CurrentTime;
|
||||
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.window = scr->root_win;
|
||||
XSendEvent(dpy, scr->root_win, False, StructureNotifyMask, (XEvent *) &event);
|
||||
#endif
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,9 @@ typedef struct WDrawerChain {
|
||||
typedef struct _WScreen {
|
||||
int screen; /* screen number */
|
||||
Window info_window; /* for our window manager info stuff */
|
||||
#ifdef USE_ICCCM_WMREPLACE
|
||||
Atom sn_atom; /* window manager selection */
|
||||
#endif
|
||||
|
||||
int scr_width; /* size of the screen */
|
||||
int scr_height;
|
||||
|
||||
Reference in New Issue
Block a user