]> git.mdlowis.com Git - projs/tide.git/commitdiff
sketched out mouse handling more
authorMichael D. Lowis <mike.lowis@gentex.com>
Tue, 18 Jun 2019 20:24:38 +0000 (16:24 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Tue, 18 Jun 2019 20:24:38 +0000 (16:24 -0400)
src/anvil.c

index 884b3f0c625e28f60580bf6dd0b9252f76b06b91..5d10014f88c595ba6a526a74013ea44692c35cd7 100644 (file)
@@ -191,7 +191,7 @@ void client_resize(XConf* x, Client* c, int dir) {
 
 /*
     * B1 Grow window a little
-    * B1 Drag: Resize vertically or  move to column
+    ** B1 Drag: Resize vertically or  move to column
     * B2: Stack windows with titlebars visible but only one window expanded
     * B3: Maximize in column
     * B1+B2: Kill window
@@ -202,21 +202,36 @@ void client_resize(XConf* x, Client* c, int dir) {
 static void xbtnpress(XConf* x, XEvent* e) {
     printf("btn\n");
     Client* c = client_find(e->xbutton.window);
-    if (c && c->frame == e->xbutton.window) {
+    if (!c || c->frame != e->xbutton.window)
+        return;
+
+    if (Button1 == e->xbutton.button) {
         XDefineCursor(X.display, e->xbutton.window, Move_Cursor);
         StartY = e->xbutton.y;
+    } else if (Button2 == e->xbutton.button) {
+        if (e->xbutton.state & (1 << (Button1 + 7)))
+            puts("kill");
+        else
+            puts("grow");
+    } else if (Button3 == e->xbutton.button) {
+        puts("maximize");
     }
+
     XSync(X.display, False);
 }
 
 static void xbtnrelease(XConf* x, XEvent* e) {
     printf("btn\n");
     Client* c = client_find(e->xbutton.window);
-    if (c && c->frame == e->xbutton.window) {
+    if (!c || c->frame != e->xbutton.window)
+        return;
+
+    if (Button1 == e->xbutton.button) {
         XUndefineCursor(X.display, e->xbutton.window);
         printf("moved: %d\n", e->xbutton.y - StartY);
         client_resize(x, c, e->xbutton.y - StartY);
     }
+
     XSync(X.display, False);
 }