diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 8631232fb..1ce4d9694 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. * - * $OpenBSD: calmwm.h,v 1.359 2018/02/13 15:06:22 okan Exp $ + * $OpenBSD: calmwm.h,v 1.360 2018/02/13 15:43:15 okan Exp $ */ #ifndef _CALMWM_H_ @@ -223,6 +223,8 @@ struct screen_ctx { struct region_q regionq; struct group_q groupq; struct group_ctx *group_active; + Colormap colormap; + Visual *visual; struct { Window win; XftDraw *xftdraw; diff --git a/app/cwm/conf.c b/app/cwm/conf.c index 138f0962d..a2e4694c7 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.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. * - * $OpenBSD: conf.c,v 1.240 2018/02/09 19:54:54 okan Exp $ + * $OpenBSD: conf.c,v 1.241 2018/02/13 15:43:15 okan Exp $ */ #include @@ -451,8 +451,6 @@ conf_screen(struct screen_ctx *sc) { unsigned int i; XftColor xc; - Colormap colormap = DefaultColormap(X_Dpy, sc->which); - Visual *visual = DefaultVisual(X_Dpy, sc->which); sc->gap = Conf.gap; sc->snapdist = Conf.snapdist; @@ -469,18 +467,18 @@ conf_screen(struct screen_ctx *sc) xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG], sc->xftcolor[CWM_COLOR_MENU_FG], &xc); xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT], xc, &xc); - if (!XftColorAllocValue(X_Dpy, visual, colormap, + if (!XftColorAllocValue(X_Dpy, sc->visual, sc->colormap, &xc.color, &sc->xftcolor[CWM_COLOR_MENU_FONT_SEL])) warnx("XftColorAllocValue: %s", Conf.color[i]); break; } - if (XftColorAllocName(X_Dpy, visual, colormap, + if (XftColorAllocName(X_Dpy, sc->visual, sc->colormap, Conf.color[i], &xc)) { sc->xftcolor[i] = xc; - XftColorFree(X_Dpy, visual, colormap, &xc); + XftColorFree(X_Dpy, sc->visual, sc->colormap, &xc); } else { warnx("XftColorAllocName: %s", Conf.color[i]); - XftColorAllocName(X_Dpy, visual, colormap, + XftColorAllocName(X_Dpy, sc->visual, sc->colormap, color_binds[i], &sc->xftcolor[i]); } } @@ -490,7 +488,8 @@ conf_screen(struct screen_ctx *sc) sc->xftcolor[CWM_COLOR_MENU_FG].pixel, sc->xftcolor[CWM_COLOR_MENU_BG].pixel); - sc->menu.xftdraw = XftDrawCreate(X_Dpy, sc->menu.win, visual, colormap); + sc->menu.xftdraw = XftDrawCreate(X_Dpy, sc->menu.win, + sc->visual, sc->colormap); if (sc->menu.xftdraw == NULL) errx(1, "%s: XftDrawCreate", __func__); diff --git a/app/cwm/screen.c b/app/cwm/screen.c index 4cde1dfd5..59249e6a9 100644 --- a/app/cwm/screen.c +++ b/app/cwm/screen.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. * - * $OpenBSD: screen.c,v 1.87 2018/02/13 15:06:22 okan Exp $ + * $OpenBSD: screen.c,v 1.88 2018/02/13 15:43:16 okan Exp $ */ #include @@ -50,6 +50,8 @@ screen_init(int which) sc->which = which; sc->rootwin = RootWindow(X_Dpy, sc->which); + sc->colormap = DefaultColormap(X_Dpy, sc->which); + sc->visual = DefaultVisual(X_Dpy, sc->which); sc->cycling = 0; sc->hideall = 0;