From: Michael D. Lowis Date: Tue, 18 Jun 2019 20:24:38 +0000 (-0400) Subject: sketched out mouse handling more X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=0758680af97835c9bb78e2bb13b77867cc759e9f;p=projs%2Ftide.git sketched out mouse handling more --- diff --git a/src/anvil.c b/src/anvil.c index 884b3f0..5d10014 100644 --- a/src/anvil.c +++ b/src/anvil.c @@ -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); }