sites

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

dwm-pwkl-6.1.diff (1514B)


      1 diff --git a/dwm.c b/dwm.c
      2 index 0362114..8807f54 100644
      3 --- a/dwm.c
      4 +++ b/dwm.c
      5 @@ -36,6 +36,7 @@
      6  #include <X11/Xlib.h>
      7  #include <X11/Xproto.h>
      8  #include <X11/Xutil.h>
      9 +#include <X11/XKBlib.h>
     10  #ifdef XINERAMA
     11  #include <X11/extensions/Xinerama.h>
     12  #endif /* XINERAMA */
     13 @@ -97,6 +98,7 @@ struct Client {
     14  	Client *snext;
     15  	Monitor *mon;
     16  	Window win;
     17 +	unsigned char kbdgrp;
     18  };
     19  
     20  typedef struct {
     21 @@ -804,6 +806,7 @@ focus(Client *c)
     22  			selmon = c->mon;
     23  		if (c->isurgent)
     24  			clearurgent(c);
     25 +		XkbLockGroup(dpy, XkbUseCoreKbd, c->kbdgrp);
     26  		detachstack(c);
     27  		attachstack(c);
     28  		grabbuttons(c, 1);
     29 @@ -1035,6 +1038,7 @@ manage(Window w, XWindowAttributes *wa)
     30  	Client *c, *t = NULL;
     31  	Window trans = None;
     32  	XWindowChanges wc;
     33 +	XkbStateRec kbd_state;
     34  
     35  	c = ecalloc(1, sizeof(Client));
     36  	c->win = w;
     37 @@ -1085,6 +1089,8 @@ manage(Window w, XWindowAttributes *wa)
     38  	if (c->mon == selmon)
     39  		unfocus(selmon->sel, 0);
     40  	c->mon->sel = c;
     41 +	XkbGetState(dpy, XkbUseCoreKbd, &kbd_state);
     42 +	c->kbdgrp = kbd_state.group;
     43  	arrange(c->mon);
     44  	XMapWindow(dpy, c->win);
     45  	focus(NULL);
     46 @@ -1742,6 +1748,7 @@ toggleview(const Arg *arg)
     47  void
     48  unfocus(Client *c, int setfocus)
     49  {
     50 +	XkbStateRec kbd_state;
     51  	if (!c)
     52  		return;
     53  	grabbuttons(c, 0);
     54 @@ -1750,6 +1757,8 @@ unfocus(Client *c, int setfocus)
     55  		XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
     56  		XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
     57  	}
     58 +	XkbGetState(dpy, XkbUseCoreKbd, &kbd_state);
     59 +	c->kbdgrp = kbd_state.group;
     60  }
     61  
     62  void