From 32b48f1eb022ee59a4748ada4a07c780e578a1ed Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Thu, 20 Jun 2019 23:35:51 -0400 Subject: [PATCH] implemented additional moust actions --- src/anvil.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/anvil.c b/src/anvil.c index 5d75b3a..e5fbe89 100644 --- a/src/anvil.c +++ b/src/anvil.c @@ -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); -- 2.55.0