X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/4d6c4d36ceaa1ca8fae6199aee6df50f6187c755..040d0f48a0b41d67004b4a0698fe21a86ebaa490:/event.c?ds=inline

diff --git a/event.c b/event.c
index afd13c8..42a6fc0 100644
--- a/event.c
+++ b/event.c
@@ -1,5 +1,4 @@
-/*
- * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
+/* (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
  * See LICENSE file for license details.
  */
 #include "dwm.h"
@@ -19,6 +18,7 @@ typedef struct {
 KEYS
 
 #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
+#define MOUSEMASK		(BUTTONMASK | PointerMotionMask)
 
 static void
 movemouse(Client *c) {
@@ -64,7 +64,7 @@ resizemouse(Client *c) {
 	ocx = c->x;
 	ocy = c->y;
 	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
-				None, cursor[CurResize], CurrentTime) != GrabSuccess)
+			None, cursor[CurResize], CurrentTime) != GrabSuccess)
 		return;
 	c->ismax = False;
 	XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w, c->h);
@@ -123,10 +123,8 @@ buttonpress(XEvent *e) {
 				return;
 			}
 		}
-		if(ev->x < x + bmw) {
-			if(ev->button == Button1)
-				togglemode(NULL);
-		}
+		if((ev->x < x + bmw) && (ev->button == Button1))
+			togglemode(NULL);
 	}
 	else if((c = getclient(ev->window))) {
 		focus(c);
@@ -150,7 +148,6 @@ configurerequest(XEvent *e) {
 	unsigned long newmask;
 	Client *c;
 	XConfigureRequestEvent *ev = &e->xconfigurerequest;
-	XEvent synev;
 	XWindowChanges wc;
 
 	if((c = getclient(ev->window))) {
@@ -177,10 +174,13 @@ configurerequest(XEvent *e) {
 		else
 			configure(c);
 		XSync(dpy, False);
-		if(c->isfloat)
+		if(c->isfloat) {
 			resize(c, False, TopLeft);
+			if(!isvisible(c))
+				ban(c);
+		}
 		else
-			arrange(NULL);
+			arrange();
 	}
 	else {
 		wc.x = ev->x;
@@ -211,7 +211,6 @@ enternotify(XEvent *e) {
 
 	if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
 		return;
-
 	if(((c = getclient(ev->window)) || (c = getctitle(ev->window))) && isvisible(c))
 		focus(c);
 	else if(ev->window == root) {
@@ -279,13 +278,11 @@ maprequest(XEvent *e) {
 
 	if(!XGetWindowAttributes(dpy, ev->window, &wa))
 		return;
-
 	if(wa.override_redirect) {
 		XSelectInput(dpy, ev->window,
 				(StructureNotifyMask | PropertyChangeMask));
 		return;
 	}
-
 	if(!getclient(ev->window))
 		manage(ev->window, &wa);
 }
@@ -298,7 +295,6 @@ propertynotify(XEvent *e) {
 
 	if(ev->state == PropertyDelete)
 		return; /* ignore */
-
 	if((c = getclient(ev->window))) {
 		if(ev->atom == wmatom[WMProtocols]) {
 			c->proto = getproto(c->win);
@@ -309,7 +305,7 @@ propertynotify(XEvent *e) {
 			case XA_WM_TRANSIENT_FOR:
 				XGetTransientForHint(dpy, c->win, &trans);
 				if(!c->isfloat && (c->isfloat = (trans != 0)))
-					arrange(NULL);
+					arrange();
 				break;
 			case XA_WM_NORMAL_HINTS:
 				updatesize(c);
@@ -317,6 +313,7 @@ propertynotify(XEvent *e) {
 		}
 		if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
 			updatetitle(c);
+			resizetitle(c);
 			drawtitle(c);
 		}
 	}