]> git.mdlowis.com Git - projs/tide.git/commitdiff
implemented additional moust actions
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 21 Jun 2019 03:35:51 +0000 (23:35 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 21 Jun 2019 03:35:51 +0000 (23:35 -0400)
src/anvil.c

index 5d75b3a212b3151dfbe9c3b38d9f5fdc51cde97e..e5fbe8917953ee6c320a2d58447c94617ae5a1ae 100644 (file)
@@ -182,6 +182,31 @@ void client_resize(XConf* x, Client* c, int dir) {
     client_reconfig(x, c);
 }
 
+void client_grow(XConf* x, Client* c) {
+    Client* curr;
+    int nclients = 0, nexty = 0;
+    int sh = HeightOfScreen(DefaultScreenOfDisplay(x->display));
+    for (curr = Clients; curr; curr = curr->next, nclients++);
+    for (curr = Clients; curr; curr = curr->next) {
+        nclients--;
+        curr->y = nexty;
+        if (curr == c)
+            curr->h = sh - nexty - (nclients * BARHEIGHT(x));
+        else
+            curr->h = BARHEIGHT(x);
+        client_reconfig(x, curr);
+        nexty += curr->h;
+    }
+}
+
+void client_maximize(XConf* xs, Client* c) {
+    int y = c->y, h = c->h;
+    c->y = 0, c->h = HeightOfScreen(DefaultScreenOfDisplay(xs->display));
+    client_reconfig(xs, c);
+    client_raise(xs, c);
+    c->y = y, c->h = h;
+}
+
 /* X11 Event Handling
  *****************************************************************************/
 
@@ -191,11 +216,11 @@ void client_resize(XConf* x, Client* c, int dir) {
 /*
     ** B1 Grow window a little
     ** B1 Drag: Resize vertically or  move to column
-    * B2: Stack windows with titlebars visible but only one window expanded
-    * B3: Maximize in column
+    ** B2: Stack windows with titlebars visible but only one window expanded
+    ** B3: Maximize in column
     * B1+B2: Kill window
     * Shift+B1: Move one column to the left
-    * Shift+B1: Move one column to the right
+    * Shift+B2: Move one column to the right
 */
 
 static void xbtnpress(XConf* x, XEvent* e) {
@@ -208,14 +233,12 @@ static void xbtnpress(XConf* x, XEvent* e) {
         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");
-//            client_grow(x, c);
-        }
+        if (e->xbutton.state & (1 << (Button1 + 7)))
+            XDestroyWindow(x->display, e->xbutton.window);
+        else
+            client_grow(x, c);
     } else if (Button3 == e->xbutton.button) {
-        puts("maximize");
+        client_maximize(x, c);
     }
 
     XSync(X.display, False);