instead of using the menu window for _NET_SUPPORTING_WM_CHECK, create a

dummy one to use instead; allows us to not have to wait for menu_init(),
so re-shuffle _NET_SUPPORTED slightly.

ok sthen@
This commit is contained in:
okan 2012-05-16 01:17:14 +00:00
parent 61a281d1f3
commit 838f6a5713
3 changed files with 29 additions and 22 deletions

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $OpenBSD: calmwm.c,v 1.60 2012/05/13 15:15:54 okan Exp $ * $OpenBSD: calmwm.c,v 1.61 2012/05/16 01:17:14 okan Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -163,6 +163,9 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
sc->which = which; sc->which = which;
sc->rootwin = RootWindow(X_Dpy, sc->which); sc->rootwin = RootWindow(X_Dpy, sc->which);
xu_ewmh_net_supported(sc);
xu_ewmh_net_supported_wm_check(sc);
conf_gap(&Conf, sc); conf_gap(&Conf, sc);
screen_update_geometry(sc, DisplayWidth(X_Dpy, sc->which), screen_update_geometry(sc, DisplayWidth(X_Dpy, sc->which),
DisplayHeight(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. */ /* Initialize menu window. */
menu_init(sc); menu_init(sc);
xu_setwmname(sc);
rootattr.cursor = Cursor_normal; rootattr.cursor = Cursor_normal;
rootattr.event_mask = CHILDMASK|PropertyChangeMask|EnterWindowMask| rootattr.event_mask = CHILDMASK|PropertyChangeMask|EnterWindowMask|
LeaveWindowMask|ColormapChangeMask|BUTTONMASK; LeaveWindowMask|ColormapChangeMask|BUTTONMASK;

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $OpenBSD: calmwm.h,v 1.145 2012/05/16 01:09:17 okan Exp $ * $OpenBSD: calmwm.h,v 1.146 2012/05/16 01:17:14 okan Exp $
*/ */
#ifndef _CALMWM_H_ #ifndef _CALMWM_H_
@ -463,7 +463,9 @@ void xu_ptr_setpos(Window, int, int);
void xu_ptr_ungrab(void); void xu_ptr_ungrab(void);
void xu_sendmsg(Window, Atom, long); void xu_sendmsg(Window, Atom, long);
void xu_setstate(struct client_ctx *, int); 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_exec(char *);
void u_spawn(char *); void u_spawn(char *);

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* $OpenBSD: xutil.c,v 1.39 2012/05/16 01:04:36 okan Exp $ * $OpenBSD: xutil.c,v 1.40 2012/05/16 01:17:14 okan Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -260,27 +260,31 @@ xu_getatoms(void)
} }
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, XChangeProperty(X_Dpy, sc->rootwin, _NET_SUPPORTED, XA_ATOM, 32,
PropModeReplace, (unsigned char *)&_NET_SUPPORTED, PropModeReplace, (unsigned char *)&_NET_SUPPORTED,
CWM_NO_ATOMS - CWM_NETWM_START); 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 * The netwm spec says that to prove that the hint is not stale, one
* window itself, the window also must have _NET_WM_NAME set with the * must provide _NET_SUPPORTING_WM_CHECK containing a window created by
* window manager name. * 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, XChangeProperty(X_Dpy, sc->rootwin, _NET_SUPPORTING_WM_CHECK,
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&sc->menuwin, 1); XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
XChangeProperty(X_Dpy, sc->menuwin, _NET_SUPPORTING_WM_CHECK, XChangeProperty(X_Dpy, w, _NET_SUPPORTING_WM_CHECK,
XA_WINDOW, 32, PropModeReplace, (unsigned char *)&sc->menuwin, 1); XA_WINDOW, 32, PropModeReplace, (unsigned char *)&w, 1);
XChangeProperty(X_Dpy, sc->menuwin, _NET_WM_NAME, UTF8_STRING, XChangeProperty(X_Dpy, w, _NET_WM_NAME, UTF8_STRING,
8, PropModeReplace, WMNAME, strlen(WMNAME)); 8, PropModeReplace, WMNAME, strlen(WMNAME));
} }