sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

dwm-5.8.2-focusonclick.diff (1163B)


      1 diff -r 72e52c5333ef config.def.h
      2 --- a/config.def.h	Wed Nov 25 13:56:17 2009 +0000
      3 +++ b/config.def.h	Sun Mar 21 00:38:45 2010 +0100
      4 @@ -12,6 +12,7 @@
      5  static const unsigned int snap      = 32;       /* snap pixel */
      6  static const Bool showbar           = True;     /* False means no bar */
      7  static const Bool topbar            = True;     /* False means bottom bar */
      8 +static const Bool focusonclick      = True;     /* Change focus only on click */
      9  
     10  /* tagging */
     11  static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     12 diff -r 72e52c5333ef dwm.c
     13 --- a/dwm.c	Wed Nov 25 13:56:17 2009 +0000
     14 +++ b/dwm.c	Sun Mar 21 00:38:45 2010 +0100
     15 @@ -791,14 +791,16 @@
     16  
     17  	if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
     18  		return;
     19 -	if((m = wintomon(ev->window)) && m != selmon) {
     20 -		unfocus(selmon->sel);
     21 -		selmon = m;
     22 +	if (!focusonclick) {
     23 +		if((m = wintomon(ev->window)) && m != selmon) {
     24 +			unfocus(selmon->sel, False);
     25 +			selmon = m;
     26 +		}
     27 +		if((c = wintoclient(ev->window)))
     28 +			focus(c);
     29 +		else
     30 +			focus(NULL);
     31  	}
     32 -	if((c = wintoclient(ev->window)))
     33 -		focus(c);
     34 -	else
     35 -		focus(NULL);
     36  }
     37  
     38  void