diff --git a/tinywm.c b/tinywm.c index 0ee2b3b..2e7a924 100644 --- a/tinywm.c +++ b/tinywm.c @@ -7,8 +7,7 @@ #define MAX(a, b) ((a) > (b) ? (a) : (b)) -int main(void) -{ +int main(void) { Display * dpy; XWindowAttributes attr; XButtonEvent start; @@ -24,18 +23,14 @@ int main(void) ButtonPressMask|ButtonReleaseMask|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None); start.subwindow = None; - for(;;) - { + for(;;) { XNextEvent(dpy, &ev); - if(ev.type == KeyPress && ev.xkey.subwindow != None) - XRaiseWindow(dpy, ev.xkey.subwindow); - else if(ev.type == ButtonPress && ev.xbutton.subwindow != None) - { + if(ev.type == KeyPress && ev.xkey.subwindow != None) XRaiseWindow(dpy, ev.xkey.subwindow); + else if(ev.type == ButtonPress && ev.xbutton.subwindow != None) { XGetWindowAttributes(dpy, ev.xbutton.subwindow, &attr); start = ev.xbutton; } - else if(ev.type == MotionNotify && start.subwindow != None) - { + else if(ev.type == MotionNotify && start.subwindow != None) { int xdiff = ev.xbutton.x_root - start.x_root; int ydiff = ev.xbutton.y_root - start.y_root; XMoveResizeWindow(dpy, start.subwindow, @@ -44,8 +39,6 @@ int main(void) MAX(1, attr.width + (start.button==3 ? xdiff : 0)), MAX(1, attr.height + (start.button==3 ? ydiff : 0))); } - else if(ev.type == ButtonRelease) - start.subwindow = None; + else if(ev.type == ButtonRelease) start.subwindow = None; } } -