mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
This commit is contained in:
commit
b923524a8e
3
calmwm.c
3
calmwm.c
@ -162,7 +162,8 @@ x_teardown(void)
|
|||||||
|
|
||||||
TAILQ_FOREACH(sc, &Screenq, entry) {
|
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||||
for (i = 0; i < CWM_COLOR_NITEMS; i++)
|
for (i = 0; i < CWM_COLOR_NITEMS; i++)
|
||||||
XftColorFree(X_Dpy, sc->visual, sc->colormap,
|
XftColorFree(X_Dpy, DefaultVisual(X_Dpy, sc->which),
|
||||||
|
DefaultColormap(X_Dpy, sc->which),
|
||||||
&sc->xftcolor[i]);
|
&sc->xftcolor[i]);
|
||||||
XftDrawDestroy(sc->xftdraw);
|
XftDrawDestroy(sc->xftdraw);
|
||||||
XftFontClose(X_Dpy, sc->xftfont);
|
XftFontClose(X_Dpy, sc->xftfont);
|
||||||
|
9
calmwm.h
9
calmwm.h
@ -233,8 +233,6 @@ TAILQ_HEAD(autogroupwin_q, autogroupwin);
|
|||||||
struct screen_ctx {
|
struct screen_ctx {
|
||||||
TAILQ_ENTRY(screen_ctx) entry;
|
TAILQ_ENTRY(screen_ctx) entry;
|
||||||
int which;
|
int which;
|
||||||
Visual *visual;
|
|
||||||
Colormap colormap;
|
|
||||||
Window rootwin;
|
Window rootwin;
|
||||||
Window menuwin;
|
Window menuwin;
|
||||||
int cycling;
|
int cycling;
|
||||||
@ -271,10 +269,9 @@ TAILQ_HEAD(keybinding_q, binding);
|
|||||||
TAILQ_HEAD(mousebinding_q, binding);
|
TAILQ_HEAD(mousebinding_q, binding);
|
||||||
|
|
||||||
struct cmd {
|
struct cmd {
|
||||||
TAILQ_ENTRY(cmd) entry;
|
TAILQ_ENTRY(cmd) entry;
|
||||||
#define CMD_MAXNAMELEN 256
|
char *name;
|
||||||
char name[CMD_MAXNAMELEN];
|
char path[MAXPATHLEN];
|
||||||
char path[MAXPATHLEN];
|
|
||||||
};
|
};
|
||||||
TAILQ_HEAD(cmd_q, cmd);
|
TAILQ_HEAD(cmd_q, cmd);
|
||||||
|
|
||||||
|
5
client.c
5
client.c
@ -63,6 +63,10 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
if (!XGetWindowAttributes(X_Dpy, win, &wattr))
|
||||||
|
return (NULL);
|
||||||
|
if (sc == NULL)
|
||||||
|
sc = screen_fromroot(wattr.root);
|
||||||
|
|
||||||
cc = xcalloc(1, sizeof(*cc));
|
cc = xcalloc(1, sizeof(*cc));
|
||||||
|
|
||||||
@ -86,7 +90,6 @@ client_init(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
cc->ptr.x = -1;
|
cc->ptr.x = -1;
|
||||||
cc->ptr.y = -1;
|
cc->ptr.y = -1;
|
||||||
|
|
||||||
XGetWindowAttributes(X_Dpy, cc->win, &wattr);
|
|
||||||
cc->geom.x = wattr.x;
|
cc->geom.x = wattr.x;
|
||||||
cc->geom.y = wattr.y;
|
cc->geom.y = wattr.y;
|
||||||
cc->geom.w = wattr.width;
|
cc->geom.w = wattr.width;
|
||||||
|
23
conf.c
23
conf.c
@ -51,13 +51,11 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
|
|||||||
sizeof(c->lockpath))
|
sizeof(c->lockpath))
|
||||||
return (0);
|
return (0);
|
||||||
} else {
|
} else {
|
||||||
cmd = xmalloc(sizeof(*cmd));
|
|
||||||
|
|
||||||
conf_cmd_remove(c, name);
|
conf_cmd_remove(c, name);
|
||||||
|
|
||||||
if (strlcpy(cmd->name, name, sizeof(cmd->name)) >=
|
cmd = xmalloc(sizeof(*cmd));
|
||||||
sizeof(cmd->name))
|
|
||||||
return (0);
|
cmd->name = xstrdup(name);
|
||||||
if (strlcpy(cmd->path, path, sizeof(cmd->path)) >=
|
if (strlcpy(cmd->path, path, sizeof(cmd->path)) >=
|
||||||
sizeof(cmd->path))
|
sizeof(cmd->path))
|
||||||
return (0);
|
return (0);
|
||||||
@ -74,6 +72,7 @@ conf_cmd_remove(struct conf *c, const char *name)
|
|||||||
TAILQ_FOREACH_SAFE(cmd, &c->cmdq, entry, cmdnxt) {
|
TAILQ_FOREACH_SAFE(cmd, &c->cmdq, entry, cmdnxt) {
|
||||||
if (strcmp(cmd->name, name) == 0) {
|
if (strcmp(cmd->name, name) == 0) {
|
||||||
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||||
|
free(cmd->name);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,6 +125,8 @@ conf_screen(struct screen_ctx *sc)
|
|||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
XftColor xc;
|
XftColor xc;
|
||||||
|
Colormap colormap = DefaultColormap(X_Dpy, sc->which);
|
||||||
|
Visual *visual = DefaultVisual(X_Dpy, sc->which);
|
||||||
|
|
||||||
sc->gap = Conf.gap;
|
sc->gap = Conf.gap;
|
||||||
sc->snapdist = Conf.snapdist;
|
sc->snapdist = Conf.snapdist;
|
||||||
@ -142,18 +143,18 @@ conf_screen(struct screen_ctx *sc)
|
|||||||
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG],
|
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG],
|
||||||
sc->xftcolor[CWM_COLOR_MENU_FG], &xc);
|
sc->xftcolor[CWM_COLOR_MENU_FG], &xc);
|
||||||
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT], xc, &xc);
|
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT], xc, &xc);
|
||||||
if (!XftColorAllocValue(X_Dpy, sc->visual, sc->colormap,
|
if (!XftColorAllocValue(X_Dpy, visual, colormap,
|
||||||
&xc.color, &sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
|
&xc.color, &sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
|
||||||
warnx("XftColorAllocValue: %s", Conf.color[i]);
|
warnx("XftColorAllocValue: %s", Conf.color[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
|
if (XftColorAllocName(X_Dpy, visual, colormap,
|
||||||
Conf.color[i], &xc)) {
|
Conf.color[i], &xc)) {
|
||||||
sc->xftcolor[i] = xc;
|
sc->xftcolor[i] = xc;
|
||||||
XftColorFree(X_Dpy, sc->visual, sc->colormap, &xc);
|
XftColorFree(X_Dpy, visual, colormap, &xc);
|
||||||
} else {
|
} else {
|
||||||
warnx("XftColorAllocName: %s", Conf.color[i]);
|
warnx("XftColorAllocName: %s", Conf.color[i]);
|
||||||
XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
|
XftColorAllocName(X_Dpy, visual, colormap,
|
||||||
color_binds[i], &sc->xftcolor[i]);
|
color_binds[i], &sc->xftcolor[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,8 +164,7 @@ conf_screen(struct screen_ctx *sc)
|
|||||||
sc->xftcolor[CWM_COLOR_MENU_FG].pixel,
|
sc->xftcolor[CWM_COLOR_MENU_FG].pixel,
|
||||||
sc->xftcolor[CWM_COLOR_MENU_BG].pixel);
|
sc->xftcolor[CWM_COLOR_MENU_BG].pixel);
|
||||||
|
|
||||||
sc->xftdraw = XftDrawCreate(X_Dpy, sc->menuwin,
|
sc->xftdraw = XftDrawCreate(X_Dpy, sc->menuwin, visual, colormap);
|
||||||
sc->visual, sc->colormap);
|
|
||||||
if (sc->xftdraw == NULL)
|
if (sc->xftdraw == NULL)
|
||||||
errx(1, "XftDrawCreate");
|
errx(1, "XftDrawCreate");
|
||||||
|
|
||||||
@ -291,6 +291,7 @@ conf_clear(struct conf *c)
|
|||||||
|
|
||||||
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
|
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
|
||||||
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||||
|
free(cmd->name);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
menu.c
4
menu.c
@ -382,8 +382,8 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
xine = screen_find_xinerama(sc, mc->x, mc->y, CWM_GAP);
|
xine = screen_find_xinerama(sc, mc->x, mc->y, CWM_GAP);
|
||||||
xine.w += xine.x;
|
xine.w += xine.x - Conf.bwidth * 2;
|
||||||
xine.h += xine.y;
|
xine.h += xine.y - Conf.bwidth * 2;
|
||||||
|
|
||||||
xsave = mc->x;
|
xsave = mc->x;
|
||||||
ysave = mc->y;
|
ysave = mc->y;
|
||||||
|
6
screen.c
6
screen.c
@ -44,8 +44,6 @@ screen_init(int which)
|
|||||||
TAILQ_INIT(&sc->mruq);
|
TAILQ_INIT(&sc->mruq);
|
||||||
|
|
||||||
sc->which = which;
|
sc->which = which;
|
||||||
sc->visual = DefaultVisual(X_Dpy, sc->which);
|
|
||||||
sc->colormap = DefaultColormap(X_Dpy, sc->which);
|
|
||||||
sc->rootwin = RootWindow(X_Dpy, sc->which);
|
sc->rootwin = RootWindow(X_Dpy, sc->which);
|
||||||
conf_screen(sc);
|
conf_screen(sc);
|
||||||
|
|
||||||
@ -65,7 +63,6 @@ screen_init(int which)
|
|||||||
|
|
||||||
/* Deal with existing clients. */
|
/* Deal with existing clients. */
|
||||||
XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
|
XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
|
||||||
|
|
||||||
for (i = 0; i < nwins; i++) {
|
for (i = 0; i < nwins; i++) {
|
||||||
XGetWindowAttributes(X_Dpy, wins[i], &winattr);
|
XGetWindowAttributes(X_Dpy, wins[i], &winattr);
|
||||||
if (winattr.override_redirect ||
|
if (winattr.override_redirect ||
|
||||||
@ -73,7 +70,8 @@ screen_init(int which)
|
|||||||
continue;
|
continue;
|
||||||
(void)client_init(wins[i], sc, winattr.map_state != IsUnmapped);
|
(void)client_init(wins[i], sc, winattr.map_state != IsUnmapped);
|
||||||
}
|
}
|
||||||
XFree(wins);
|
if (wins)
|
||||||
|
XFree(wins);
|
||||||
|
|
||||||
screen_updatestackingorder(sc);
|
screen_updatestackingorder(sc);
|
||||||
|
|
||||||
|
@ -75,17 +75,14 @@ xev_handle_maprequest(XEvent *ee)
|
|||||||
{
|
{
|
||||||
XMapRequestEvent *e = &ee->xmaprequest;
|
XMapRequestEvent *e = &ee->xmaprequest;
|
||||||
struct client_ctx *cc = NULL, *old_cc;
|
struct client_ctx *cc = NULL, *old_cc;
|
||||||
XWindowAttributes xattr;
|
|
||||||
|
|
||||||
if ((old_cc = client_current()))
|
if ((old_cc = client_current()))
|
||||||
client_ptrsave(old_cc);
|
client_ptrsave(old_cc);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) == NULL) {
|
if ((cc = client_find(e->window)) == NULL)
|
||||||
XGetWindowAttributes(X_Dpy, e->window, &xattr);
|
cc = client_init(e->window, NULL, 1);
|
||||||
cc = client_init(e->window, screen_fromroot(xattr.root), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((cc->flags & CLIENT_IGNORE) == 0)
|
if ((cc != NULL) && ((cc->flags & CLIENT_IGNORE) == 0))
|
||||||
client_ptrwarp(cc);
|
client_ptrwarp(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user