summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--calmwm.c5
-rw-r--r--calmwm.h4
-rw-r--r--xutil.c36
3 files changed, 26 insertions, 19 deletions
diff --git a/calmwm.c b/calmwm.c
index 9d91084..2a52f6a 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -163,6 +163,9 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	sc->which = which;
 	sc->rootwin = RootWindow(X_Dpy, sc->which);
 
+	xu_ewmh_net_supported(sc);
+	xu_ewmh_net_supported_wm_check(sc);
+
 	conf_gap(&Conf, sc);
 	screen_update_geometry(sc, DisplayWidth(X_Dpy, sc->which),
 	    DisplayHeight(X_Dpy, sc->which));
@@ -177,8 +180,6 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	/* Initialize menu window. */
 	menu_init(sc);
 
-	xu_setwmname(sc);
-
 	rootattr.cursor = Cursor_normal;
 	rootattr.event_mask = CHILDMASK|PropertyChangeMask|EnterWindowMask|
 	    LeaveWindowMask|ColormapChangeMask|BUTTONMASK;
diff --git a/calmwm.h b/calmwm.h
index 95dceda..29d1019 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -463,7 +463,9 @@ void			 xu_ptr_setpos(Window, int, int);
 void			 xu_ptr_ungrab(void);
 void			 xu_sendmsg(Window, Atom, long);
 void			 xu_setstate(struct client_ctx *, int);
-void			 xu_setwmname(struct screen_ctx *);
+
+void			 xu_ewmh_net_supported(struct screen_ctx *);
+void			 xu_ewmh_net_supported_wm_check(struct screen_ctx *);
 
 void			 u_exec(char *);
 void			 u_spawn(char *);
diff --git a/xutil.c b/xutil.c
index ae07d4e..030584b 100644
--- a/xutil.c
+++ b/xutil.c
@@ -260,27 +260,31 @@ xu_getatoms(void)
 }
 
 void
-xu_setwmname(struct screen_ctx *sc)
+xu_ewmh_net_supported(struct screen_ctx *sc)
 {
-	/*
-	 * set up the _NET_SUPPORTED hint with all netwm atoms that we
-	 * know about.
-	 */
 	XChangeProperty(X_Dpy, sc->rootwin, _NET_SUPPORTED, XA_ATOM, 32,
 	    PropModeReplace,  (unsigned char *)&_NET_SUPPORTED,
 	    CWM_NO_ATOMS - CWM_NETWM_START);
-	/*
-	 * netwm spec says that to prove that the hint is not stale you must
-	 * provide _NET_SUPPORTING_WM_CHECK containing a window (we use the
-	 * menu window). The property must be set on the root window and the
-	 * window itself, the window also must have _NET_WM_NAME set with the
-	 * window manager name.
-	 */
+}
+
+/*
+ * The netwm spec says that to prove that the hint is not stale, one
+ * must provide _NET_SUPPORTING_WM_CHECK containing a window created by
+ * the root window.  The property must be set on the root window and the
+ * window itself.  This child window also must have _NET_WM_NAME set with
+ * the window manager name.
+ */
+void
+xu_ewmh_net_supported_wm_check(struct screen_ctx *sc)
+{
+	Window	 w;
+
+	w = XCreateSimpleWindow(X_Dpy, sc->rootwin, -1, -1, 1, 1, 0, 0, 0);
 	XChangeProperty(X_Dpy, sc->rootwin, _NET_SUPPORTING_WM_CHECK,
-	    XA_WINDOW, 32, PropModeReplace, (unsigned char *)&sc->menuwin, 1);
-	XChangeProperty(X_Dpy, sc->menuwin, _NET_SUPPORTING_WM_CHECK,
-	    XA_WINDOW, 32, PropModeReplace, (unsigned char *)&sc->menuwin, 1);
-	XChangeProperty(X_Dpy, sc->menuwin, _NET_WM_NAME, UTF8_STRING,
+	    XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
+	XChangeProperty(X_Dpy, w, _NET_SUPPORTING_WM_CHECK,
+	    XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
+	XChangeProperty(X_Dpy, w, _NET_WM_NAME, UTF8_STRING,
 	    8, PropModeReplace, WMNAME, strlen(WMNAME));
 }