Hello,

Sorry, I didn't know that such patch already exists - 'pwkl'. 
My fault...

On Sun, 27 Mar 2011 22:18:43 +0400
Andrey 'Case' Merkulov <me...@udm.ru> wrote:

> Hello,
> 
> this is a little patch for dwm 5.8.2.
> Patch adds to dwm functionality of keyboard layout manager: for every
> open window now stored current layout. If you change the focused window,
> the current keyboard layout also switched.
> 
> And sorry for my english :)
> 
> =-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> 
> --- dwm.c.orig        2011-01-09 20:06:56.000000000 +0300
> +++ dwm.c     2011-03-26 23:25:58.626602821 +0300
> @@ -39,6 +39,7 @@
>  #ifdef XINERAMA
>  #include <X11/extensions/Xinerama.h>
>  #endif /* XINERAMA */
> +#include <X11/XKBlib.h>
>  
>  /* macros */
>  #define BUTTONMASK              (ButtonPressMask|ButtonReleaseMask)
> @@ -93,6 +94,7 @@
>       Client *snext;
>       Monitor *mon;
>       Window win;
> +     int XkbGroup;
>  };
>  
>  typedef struct {
> @@ -800,6 +802,7 @@
>               unfocus(selmon->sel, True);
>               selmon = m;
>       }
> +     unfocus(selmon->sel, True);
>       if((c = wintoclient(ev->window)))
>               focus(c);
>       else
> @@ -832,6 +835,7 @@
>               grabbuttons(c, True);
>               XSetWindowBorder(dpy, c->win, dc.sel[ColBorder]);
>               XSetInputFocus(dpy, c->win, RevertToPointerRoot,
> CurrentTime);
> +             XkbLockGroup(dpy, XkbUseCoreKbd, c->XkbGroup);
>       }
>       else
>               XSetInputFocus(dpy, root, RevertToPointerRoot,
> CurrentTime); @@ -1103,6 +1107,7 @@
>               die("fatal: could not malloc() %u bytes\n", sizeof
> (Client)); *c = cz;
>       c->win = w;
> +     c->XkbGroup = 0;
>       updatetitle(c);
>       if(XGetTransientForHint(dpy, w, &trans))
>               t = wintoclient(trans);
> @@ -1708,12 +1713,17 @@
>  
>  void
>  unfocus(Client *c, Bool setfocus) {
> +     XkbStateRec state;
> +
>       if(!c)
>               return;
>       grabbuttons(c, False);
>       XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
>       if(setfocus)
>               XSetInputFocus(dpy, root, RevertToPointerRoot,
> CurrentTime);
> +     
> +     XkbGetState(dpy, XkbUseCoreKbd, &state);
> +     c -> XkbGroup = state.group;
>  }
>  
>  void
> 
> 
> =-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> 
> -- 
> Andrey 'Case' Merkulov <me...@udm.ru>
> 


-- 
Andrey 'Case' Merkulov <me...@udm.ru>

Reply via email to