summaryrefslogtreecommitdiff
path: root/app/cwm
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2009-12-07 21:20:53 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2009-12-07 21:20:53 +0000
commitc3a6b5ca57ef0c6ffc359ab01963fe922eaf4c4c (patch)
tree57f97d7daf02483d577f4ebdcaa76006697e9784 /app/cwm
parent2f78ddcbbb1cf2d36e699516717b1eea7b9c1b44 (diff)
introduce the beginnings of netwm support, minimally and correctly;
allows java to be happy, but additionally stops others from whinning about a non-netwm complaint wm. more to come. written a few times; this one includes a clever hack from oga@ to populate _NET_SUPPORTED. ok oga@
Diffstat (limited to 'app/cwm')
-rw-r--r--app/cwm/calmwm.c4
-rw-r--r--app/cwm/calmwm.h16
-rw-r--r--app/cwm/xutil.c31
3 files changed, 47 insertions, 4 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c
index 3a3a81305..7431a8979 100644
--- a/app/cwm/calmwm.c
+++ b/app/cwm/calmwm.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.c,v 1.43 2009/08/24 21:22:48 oga Exp $
+ * $Id: calmwm.c,v 1.44 2009/12/07 21:20:52 okan Exp $
*/
#include "headers.h"
@@ -166,6 +166,8 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
/* Initialize menu window. */
menu_init(sc);
+ xu_setwmname(sc);
+
/* Deal with existing clients. */
XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index cd47ad2e4..4f3fcf9a8 100644
--- a/app/cwm/calmwm.h
+++ b/app/cwm/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.h,v 1.98 2009/08/27 01:38:08 okan Exp $
+ * $Id: calmwm.h,v 1.99 2009/12/07 21:20:52 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -29,6 +29,7 @@
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define CONFFILE ".cwmrc"
+#define WMNAME "CWM"
#define ChildMask (SubstructureRedirectMask|SubstructureNotifyMask)
#define ButtonMask (ButtonPressMask|ButtonReleaseMask)
@@ -384,6 +385,7 @@ void xu_setstate(struct client_ctx *, int);
int xu_getstate(struct client_ctx *, int *);
unsigned long xu_getcolor(struct screen_ctx *, char *);
void xu_freecolor(struct screen_ctx *, unsigned long);
+void xu_setwmname(struct screen_ctx *);
int u_spawn(char *);
void u_exec(char *);
@@ -515,7 +517,17 @@ extern struct conf Conf;
#define WM_PROTOCOLS cwm_atoms[3]
#define _MOTIF_WM_HINTS cwm_atoms[4]
#define _CWM_GRP cwm_atoms[5]
-#define CWM_NO_ATOMS 6
+#define UTF8_STRING cwm_atoms[6]
+/*
+ * please make all hints below this point netwm hints, starting with
+ * _NET_SUPPORTED. If you change other hints make sure you update
+ * CWM_NETWM_START
+ */
+#define _NET_SUPPORTED cwm_atoms[7]
+#define _NET_SUPPORTING_WM_CHECK cwm_atoms[8]
+#define _NET_WM_NAME cwm_atoms[9]
+#define CWM_NO_ATOMS 10
+#define CWM_NETWM_START 7
extern Atom cwm_atoms[CWM_NO_ATOMS];
diff --git a/app/cwm/xutil.c b/app/cwm/xutil.c
index 551075e24..5bea7c3e3 100644
--- a/app/cwm/xutil.c
+++ b/app/cwm/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: xutil.c,v 1.17 2009/06/26 12:21:58 okan Exp $
+ * $Id: xutil.c,v 1.18 2009/12/07 21:20:52 okan Exp $
*/
#include "headers.h"
@@ -177,6 +177,10 @@ char *atoms[CWM_NO_ATOMS] = {
"WM_PROTOCOLS",
"_MOTIF_WM_HINTS",
"_CWM_GRP",
+ "UTF8_STRING",
+ "_NET_SUPPORTED",
+ "_NET_SUPPORTING_WM_CHECK",
+ "_NET_WM_NAME",
};
void
@@ -185,6 +189,31 @@ xu_getatoms(void)
XInternAtoms(X_Dpy, atoms, CWM_NO_ATOMS, False, cwm_atoms);
}
+void
+xu_setwmname(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.
+ */
+ 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,
+ 8, PropModeReplace, WMNAME, strlen(WMNAME));
+}
+
unsigned long
xu_getcolor(struct screen_ctx *sc, char *name)
{