]> git.armaanb.net Git - slock.git/blobdiff - slock.c
there can only be one window in the event
[slock.git] / slock.c
diff --git a/slock.c b/slock.c
index 4d7f06fe9a8fc4dc3b6904fc8231c065614a17d8..700acfb4f5c969adc503fbabfb2b9ffd58932f0b 100644 (file)
--- a/slock.c
+++ b/slock.c
@@ -31,8 +31,6 @@ enum {
        NUMCOLS
 };
 
-#include "config.h"
-
 struct lock {
        int screen;
        Window root, win;
@@ -46,6 +44,8 @@ struct xrandr {
        int errbase;
 };
 
+#include "config.h"
+
 static void
 die(const char *errstr, ...)
 {
@@ -166,7 +166,7 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
                                        running = !!strcmp(inputhash, hash);
                                if (running) {
                                        XBell(dpy, 100);
-                                       failure = True;
+                                       failure = 1;
                                }
                                explicit_bzero(&passwd, sizeof(passwd));
                                len = 0;
@@ -201,9 +201,15 @@ readpw(Display *dpy, struct xrandr *rr, struct lock **locks, int nscreens,
                        rre = (XRRScreenChangeNotifyEvent*)&ev;
                        for (screen = 0; screen < nscreens; screen++) {
                                if (locks[screen]->win == rre->window) {
-                                       XResizeWindow(dpy, locks[screen]->win,
-                                                     rre->width, rre->height);
+                                       if (rre->rotation == RR_Rotate_90 ||
+                                           rre->rotation == RR_Rotate_270)
+                                               XResizeWindow(dpy, locks[screen]->win,
+                                                             rre->height, rre->width);
+                                       else
+                                               XResizeWindow(dpy, locks[screen]->win,
+                                                             rre->width, rre->height);
                                        XClearWindow(dpy, locks[screen]->win);
+                                       break;
                                }
                        }
                } else for (screen = 0; screen < nscreens; screen++)