some more additions/fixes
This commit is contained in:
parent
896f08d7d5
commit
2a0fc84c4a
13
client.c
13
client.c
@ -93,6 +93,7 @@ focus(Client *c)
|
|||||||
}
|
}
|
||||||
XUnmapWindow(dpy, c->title);
|
XUnmapWindow(dpy, c->title);
|
||||||
draw_bar();
|
draw_bar();
|
||||||
|
discard_events(EnterWindowMask);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||||||
XGetTransientForHint(dpy, c->win, &c->trans);
|
XGetTransientForHint(dpy, c->win, &c->trans);
|
||||||
twa.override_redirect = 1;
|
twa.override_redirect = 1;
|
||||||
twa.background_pixmap = ParentRelative;
|
twa.background_pixmap = ParentRelative;
|
||||||
twa.event_mask = SubstructureNotifyMask | ExposureMask;
|
twa.event_mask = ExposureMask;
|
||||||
|
|
||||||
c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
|
c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
|
||||||
0, DefaultDepth(dpy, screen), CopyFromParent,
|
0, DefaultDepth(dpy, screen), CopyFromParent,
|
||||||
@ -191,11 +192,19 @@ unmanage(Client *c)
|
|||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
XSetErrorHandler(error_handler);
|
XSetErrorHandler(error_handler);
|
||||||
XUngrabServer(dpy);
|
XUngrabServer(dpy);
|
||||||
discard_events(EnterWindowMask);
|
|
||||||
if(stack)
|
if(stack)
|
||||||
focus(stack);
|
focus(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client *
|
||||||
|
gettitle(Window w)
|
||||||
|
{
|
||||||
|
Client *c;
|
||||||
|
for(c = clients; c; c = c->next)
|
||||||
|
if(c->title == w)
|
||||||
|
return c;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
getclient(Window w)
|
getclient(Window w)
|
||||||
|
16
cmd.c
16
cmd.c
@ -19,6 +19,22 @@ quit(void *aux)
|
|||||||
running = False;
|
running = False;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sel(void *aux)
|
||||||
|
{
|
||||||
|
const char *arg = aux;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if(!arg || !stack)
|
||||||
|
return;
|
||||||
|
if(!strncmp(arg, "next", 5))
|
||||||
|
focus(stack->snext ? stack->snext : stack);
|
||||||
|
else if(!strncmp(arg, "prev", 5)) {
|
||||||
|
for(c = stack; c && c->snext; c = c->snext);
|
||||||
|
focus(c ? c : stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kill(void *aux)
|
kill(void *aux)
|
||||||
{
|
{
|
||||||
|
2
event.c
2
event.c
@ -146,7 +146,7 @@ expose(XEvent *e)
|
|||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if(ev->count == 0) {
|
if(ev->count == 0) {
|
||||||
if((c = getclient(ev->window)))
|
if((c = gettitle(ev->window)))
|
||||||
draw_client(c);
|
draw_client(c);
|
||||||
else if(ev->window == barwin)
|
else if(ev->window == barwin)
|
||||||
draw_bar();
|
draw_bar();
|
||||||
|
2
kb.c
2
kb.c
@ -19,6 +19,8 @@ static const char *proglist[] = {
|
|||||||
static Key key[] = {
|
static Key key[] = {
|
||||||
{ Mod1Mask, XK_Return, run, term },
|
{ Mod1Mask, XK_Return, run, term },
|
||||||
{ Mod1Mask, XK_p, run, proglist },
|
{ Mod1Mask, XK_p, run, proglist },
|
||||||
|
{ Mod1Mask, XK_k, sel, "prev"},
|
||||||
|
{ Mod1Mask, XK_j, sel, "next"},
|
||||||
{ Mod1Mask | ShiftMask, XK_c, kill, NULL},
|
{ Mod1Mask | ShiftMask, XK_c, kill, NULL},
|
||||||
{ Mod1Mask | ShiftMask, XK_q, quit, NULL},
|
{ Mod1Mask | ShiftMask, XK_q, quit, NULL},
|
||||||
};
|
};
|
||||||
|
2
wm.h
2
wm.h
@ -63,6 +63,7 @@ extern void draw_bar();
|
|||||||
extern void run(void *aux);
|
extern void run(void *aux);
|
||||||
extern void quit(void *aux);
|
extern void quit(void *aux);
|
||||||
extern void kill(void *aux);
|
extern void kill(void *aux);
|
||||||
|
extern void sel(void *aux);
|
||||||
|
|
||||||
/* client.c */
|
/* client.c */
|
||||||
extern void manage(Window w, XWindowAttributes *wa);
|
extern void manage(Window w, XWindowAttributes *wa);
|
||||||
@ -73,6 +74,7 @@ extern void update_name(Client *c);
|
|||||||
extern void draw_client(Client *c);
|
extern void draw_client(Client *c);
|
||||||
extern void resize(Client *c);
|
extern void resize(Client *c);
|
||||||
extern void update_size(Client *c);
|
extern void update_size(Client *c);
|
||||||
|
extern Client *gettitle(Window w);
|
||||||
|
|
||||||
/* event.c */
|
/* event.c */
|
||||||
extern unsigned int discard_events(long even_mask);
|
extern unsigned int discard_events(long even_mask);
|
||||||
|
Loading…
Reference in New Issue
Block a user