sites

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

dwm-focusonclick-6.0.diff (1965B)


      1 diff -up dwm-6.0/config.def.h dwm-6.0-focusonclick/config.def.h
      2 --- dwm-6.0/config.def.h	2011-12-19 09:02:46.000000000 -0600
      3 +++ dwm-6.0-focusonclick/config.def.h	2012-11-24 17:48:19.867072611 -0600
      4 @@ -13,6 +13,9 @@ static const unsigned int snap      = 32
      5  static const Bool showbar           = True;     /* False means no bar */
      6  static const Bool topbar            = True;     /* False means bottom bar */
      7  
      8 +/* False means using the scroll wheel on a window will not change focus */
      9 +static const Bool focusonwheelscroll = False;
     10 +
     11  /* tagging */
     12  static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     13  
     14 diff -up dwm-6.0/dwm.c dwm-6.0-focusonclick/dwm.c
     15 --- dwm-6.0/dwm.c	2011-12-19 09:02:46.000000000 -0600
     16 +++ dwm-6.0-focusonclick/dwm.c	2012-11-24 18:00:08.902254102 -0600
     17 @@ -266,7 +266,6 @@ static void (*handler[LASTEvent]) (XEven
     18  	[ConfigureRequest] = configurerequest,
     19  	[ConfigureNotify] = configurenotify,
     20  	[DestroyNotify] = destroynotify,
     21 -	[EnterNotify] = enternotify,
     22  	[Expose] = expose,
     23  	[FocusIn] = focusin,
     24  	[KeyPress] = keypress,
     25 @@ -455,7 +454,9 @@ buttonpress(XEvent *e) {
     26  			click = ClkWinTitle;
     27  	}
     28  	else if((c = wintoclient(ev->window))) {
     29 -		focus(c);
     30 +		if (focusonwheelscroll || (ev->button != Button4 && ev->button != Button5))
     31 +			focus(c);
     32 +		XAllowEvents(dpy, ReplayPointer, CurrentTime);
     33  		click = ClkClientWin;
     34  	}
     35  	for(i = 0; i < LENGTH(buttons); i++)
     36 @@ -1001,11 +1002,11 @@ grabbuttons(Client *c, Bool focused) {
     37  						XGrabButton(dpy, buttons[i].button,
     38  						            buttons[i].mask | modifiers[j],
     39  						            c->win, False, BUTTONMASK,
     40 -						            GrabModeAsync, GrabModeSync, None, None);
     41 +						            GrabModeSync, GrabModeSync, None, None);
     42  		}
     43  		else
     44  			XGrabButton(dpy, AnyButton, AnyModifier, c->win, False,
     45 -			            BUTTONMASK, GrabModeAsync, GrabModeSync, None, None);
     46 +			            BUTTONMASK, GrabModeSync, GrabModeSync, None, None);
     47  	}
     48  }
     49