spkp

Stacking wayland compositor
git clone git://git.z3bra.org/sp:kp.git
Log | Files | Refs

commit 281b3e0dd100d20ef731764cf0db1a87227d8fc1
parent 1813f99552e6c439f35ea791a67b413734820345
Author: Willy Goiffon <dev@z3bra.org>
Date:   Fri, 13 Nov 2020 15:50:11 +0100

Add the ability to draw squares on the background

Diffstat:
Mcompositor.c | 12+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/compositor.c b/compositor.c @@ -36,6 +36,7 @@ enum { NORMAL, MOVE, RESIZE, + DRAW, }; enum { @@ -598,7 +599,8 @@ cb_motion(struct state *server, uint32_t time) server->grabbox.y = server->cursor->y - server->gy; return; /* NOTREACHED */; break; - case RESIZE: + case RESIZE: /* FALLTHROUGH */ + case DRAW: server->grabbox.width = MAX(server->cursor->x - server->grabbox.x, 100); server->grabbox.height = MAX(server->cursor->y - server->grabbox.y, 100); return; @@ -705,6 +707,14 @@ cb_click(struct wl_listener *listener, void *data) /* don't enter grab mode when there is no window under the pointer */ if (!w) { + if (ev->state == WLR_BUTTON_PRESSED) { + server->grabmode = DRAW; + server->grabbed = NULL; + server->grabbox.x = server->cursor->x; + server->grabbox.y = server->cursor->y; + server->grabbox.width = 1; + server->grabbox.height = 1; + } return; }