dwm-meillo

changeset 23:95ffdfd0a819

some more additions/fixes
author Anselm R. Garbe <garbeam@wmii.de>
date Wed, 12 Jul 2006 00:00:25 +0200
parents bd3a44353916
children 40b651a26a04
files client.c cmd.c event.c kb.c wm.h
diffstat 5 files changed, 32 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/client.c	Tue Jul 11 23:46:39 2006 +0200
     1.2 +++ b/client.c	Wed Jul 12 00:00:25 2006 +0200
     1.3 @@ -93,6 +93,7 @@
     1.4  	}
     1.5  	XUnmapWindow(dpy, c->title);
     1.6  	draw_bar();
     1.7 +	discard_events(EnterWindowMask);
     1.8  	XFlush(dpy);
     1.9  }
    1.10  
    1.11 @@ -116,7 +117,7 @@
    1.12  	XGetTransientForHint(dpy, c->win, &c->trans);
    1.13  	twa.override_redirect = 1;
    1.14  	twa.background_pixmap = ParentRelative;
    1.15 -	twa.event_mask = SubstructureNotifyMask | ExposureMask;
    1.16 +	twa.event_mask = ExposureMask;
    1.17  
    1.18  	c->title = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
    1.19  			0, DefaultDepth(dpy, screen), CopyFromParent,
    1.20 @@ -191,11 +192,19 @@
    1.21  	XFlush(dpy);
    1.22  	XSetErrorHandler(error_handler);
    1.23  	XUngrabServer(dpy);
    1.24 -	discard_events(EnterWindowMask);
    1.25  	if(stack)
    1.26  		focus(stack);
    1.27  }
    1.28  
    1.29 +Client *
    1.30 +gettitle(Window w)
    1.31 +{
    1.32 +	Client *c;
    1.33 +	for(c = clients; c; c = c->next)
    1.34 +		if(c->title == w)
    1.35 +			return c;
    1.36 +	return NULL;
    1.37 +}
    1.38  
    1.39  Client *
    1.40  getclient(Window w)
     2.1 --- a/cmd.c	Tue Jul 11 23:46:39 2006 +0200
     2.2 +++ b/cmd.c	Wed Jul 12 00:00:25 2006 +0200
     2.3 @@ -20,6 +20,22 @@
     2.4  }
     2.5  
     2.6  void
     2.7 +sel(void *aux)
     2.8 +{
     2.9 +	const char *arg = aux;
    2.10 +	Client *c;
    2.11 +
    2.12 +	if(!arg || !stack)
    2.13 +		return;
    2.14 +	if(!strncmp(arg, "next", 5))
    2.15 +		focus(stack->snext ? stack->snext : stack);
    2.16 +	else if(!strncmp(arg, "prev", 5)) {
    2.17 +		for(c = stack; c && c->snext; c = c->snext);
    2.18 +		focus(c ? c : stack);
    2.19 +	}
    2.20 +}
    2.21 +
    2.22 +void
    2.23  kill(void *aux)
    2.24  {
    2.25  	Client *c = stack;
     3.1 --- a/event.c	Tue Jul 11 23:46:39 2006 +0200
     3.2 +++ b/event.c	Wed Jul 12 00:00:25 2006 +0200
     3.3 @@ -146,7 +146,7 @@
     3.4  	Client *c;
     3.5  
     3.6  	if(ev->count == 0) {
     3.7 -		if((c = getclient(ev->window)))
     3.8 +		if((c = gettitle(ev->window)))
     3.9  			draw_client(c);
    3.10  		else if(ev->window == barwin)
    3.11  			draw_bar();
     4.1 --- a/kb.c	Tue Jul 11 23:46:39 2006 +0200
     4.2 +++ b/kb.c	Wed Jul 12 00:00:25 2006 +0200
     4.3 @@ -19,6 +19,8 @@
     4.4  static Key key[] = {
     4.5  	{ Mod1Mask, XK_Return, run, term },
     4.6  	{ Mod1Mask, XK_p, run, proglist }, 
     4.7 +	{ Mod1Mask, XK_k, sel, "prev"}, 
     4.8 +	{ Mod1Mask, XK_j, sel, "next"}, 
     4.9  	{ Mod1Mask | ShiftMask, XK_c, kill, NULL}, 
    4.10  	{ Mod1Mask | ShiftMask, XK_q, quit, NULL},
    4.11  };
     5.1 --- a/wm.h	Tue Jul 11 23:46:39 2006 +0200
     5.2 +++ b/wm.h	Wed Jul 12 00:00:25 2006 +0200
     5.3 @@ -63,6 +63,7 @@
     5.4  extern void run(void *aux);
     5.5  extern void quit(void *aux);
     5.6  extern void kill(void *aux);
     5.7 +extern void sel(void *aux);
     5.8  
     5.9  /* client.c */
    5.10  extern void manage(Window w, XWindowAttributes *wa);
    5.11 @@ -73,6 +74,7 @@
    5.12  extern void draw_client(Client *c);
    5.13  extern void resize(Client *c);
    5.14  extern void update_size(Client *c);
    5.15 +extern Client *gettitle(Window w);
    5.16  
    5.17  /* event.c */
    5.18  extern unsigned int discard_events(long even_mask);