X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=6695ddfb63e8f8be6dbee574f9cae0f4b4f522e0;hp=9702063616fbdaf0bcf86ab1f076cfe1a8157e8e;hb=61fe833a062b0e027ec48ed7c7adeb2ed63089d3;hpb=3bfc43c3d01d710c4828d75a8a5a9b910ee90dff diff --git a/dwm.c b/dwm.c index 9702063..6695ddf 100644 --- a/dwm.c +++ b/dwm.c @@ -36,10 +36,13 @@ #include #include #include +#include #ifdef XINERAMA #include #endif /* XINERAMA */ +#include "draw.h" + /* macros */ #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) @@ -278,7 +281,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { [UnmapNotify] = unmapnotify }; static Atom wmatom[WMLast], netatom[NetLast]; -static Bool running = True; +static Bool running = True, usexkb; static Cursor cursor[CurLast]; static Display *dpy; static DC dc; @@ -575,8 +578,9 @@ configurenotify(XEvent *e) { XConfigureEvent *ev = &e->xconfigure; Bool dirty; + // TODO: updategeom handling sucks, needs to be simplified if(ev->window == root) { - dirty = (sw != ev->width); + dirty = (sw != ev->width || sh != ev->height); sw = ev->width; sh = ev->height; if(updategeom() || dirty) { @@ -884,7 +888,8 @@ focusmon(const Arg *arg) { return; if((m = dirtomon(arg->i)) == selmon) return; - unfocus(selmon->sel, True); + unfocus(selmon->sel, False); /* s/True/False/ fixes input focus issues + in gedit and anjuta */ selmon = m; focus(NULL); } @@ -1088,7 +1093,10 @@ keypress(XEvent *e) { XKeyEvent *ev; ev = &e->xkey; - keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); + if(usexkb) + keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0); + else + keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); for(i = 0; i < LENGTH(keys); i++) if(keysym == keys[i].keysym && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) @@ -1234,6 +1242,8 @@ movemouse(const Arg *arg) { if(!(c = selmon->sel)) return; + if(c->isfullscreen) /* no support moving fullscreen windows by mouse */ + return; restack(selmon); ocx = c->x; ocy = c->y; @@ -1267,11 +1277,8 @@ movemouse(const Arg *arg) { && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) togglefloating(NULL); } - if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) { - if(c->isfullscreen) - setfullscreen(c, False); + if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) resize(c, nx, ny, c->w, c->h, True); - } break; } } while(ev.type != ButtonRelease); @@ -1381,6 +1388,8 @@ resizemouse(const Arg *arg) { if(!(c = selmon->sel)) return; + if(c->isfullscreen) /* no support resizing fullscreen windows by mouse */ + return; restack(selmon); ocx = c->x; ocy = c->y; @@ -1406,11 +1415,8 @@ resizemouse(const Arg *arg) { && (abs(nw - c->w) > snap || abs(nh - c->h) > snap)) togglefloating(NULL); } - if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) { - if(c->isfullscreen) - setfullscreen(c, False); + if(!selmon->lt[selmon->sellt]->arrange || c->isfloating) resize(c, c->x, c->y, nw, nh, True); - } break; } } while(ev.type != ButtonRelease); @@ -1600,6 +1606,7 @@ setmfact(const Arg *arg) { void setup(void) { XSetWindowAttributes wa; + int dummy = 0, xkbmajor = XkbMajorVersion, xkbminor = XkbMinorVersion; /* clean up any zombies immediately */ sigchld(0); @@ -1654,6 +1661,8 @@ setup(void) { |EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask; XChangeWindowAttributes(dpy, root, CWEventMask|CWCursor, &wa); XSelectInput(dpy, root, wa.event_mask); + /* init xkb */ + usexkb = XkbQueryExtension(dpy, &dummy, &dummy, &dummy, &xkbmajor, &xkbminor); grabkeys(); } @@ -1758,12 +1767,12 @@ void togglefloating(const Arg *arg) { if(!selmon->sel) return; + if(selmon->sel->isfullscreen) /* no support for fullscreen windows */ + return; selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; if(selmon->sel->isfloating) resize(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h, False); - else if(selmon->sel->isfullscreen) - setfullscreen(selmon->sel, False); arrange(selmon); }