JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
keep 6.1 intact
[dwm.git] / dwm.c
diff --git a/dwm.c b/dwm.c
index 9702063..45191e9 100644 (file)
--- a/dwm.c
+++ b/dwm.c
@@ -36,6 +36,7 @@
 #include <X11/Xlib.h>
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
+#include <X11/XKBlib.h>
 #ifdef XINERAMA
 #include <X11/extensions/Xinerama.h>
 #endif /* XINERAMA */
@@ -575,8 +576,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 +886,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 +1091,7 @@ keypress(XEvent *e) {
        XKeyEvent *ev;
 
        ev = &e->xkey;
-       keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
+       keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
        for(i = 0; i < LENGTH(keys); i++)
                if(keysym == keys[i].keysym
                && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
@@ -1234,6 +1237,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 +1272,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 +1383,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 +1410,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);
@@ -1758,12 +1759,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);
 }