tAdd the ability to draw squares on the background - spkp - Stacking wayland compositor
(HTM) git clone git://git.z3bra.org/spkp.git
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) commit 281b3e0dd100d20ef731764cf0db1a87227d8fc1
(DIR) parent 1813f99552e6c439f35ea791a67b413734820345
(HTM) 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:
M compositor.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/compositor.c b/compositor.c
t@@ -36,6 +36,7 @@ enum {
NORMAL,
MOVE,
RESIZE,
+ DRAW,
};
enum {
t@@ -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;
t@@ -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;
}