aboutsummaryrefslogtreecommitdiff
path: root/dwl.c
diff options
context:
space:
mode:
authorDevin J. Pohly <djpohly@gmail.com>2020-04-23 23:55:29 -0500
committerDevin J. Pohly <djpohly@gmail.com>2020-04-23 23:55:29 -0500
commit60f2c0b7de50c7b680730a1a75922acb329ccf25 (patch)
treeaab36a3b86bd1e91186bb4aef1ae710d390f97e6 /dwl.c
parent6254bcd033d330268077ec5683c5bee4f29a720f (diff)
draw window borders
Works with scaled/rotated displays too!
Diffstat (limited to 'dwl.c')
-rw-r--r--dwl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dwl.c b/dwl.c
index 80a3d49..5f24226 100644
--- a/dwl.c
+++ b/dwl.c
@@ -847,6 +847,24 @@ renderclients(Monitor *m, struct timespec *now)
if (!VISIBLEON(c, m))
continue;
+ double ox = c->x, oy = c->y;
+ wlr_output_layout_output_coords(output_layout, m->wlr_output,
+ &ox, &oy);
+ int w = c->xdg_surface->surface->current.width;
+ int h = c->xdg_surface->surface->current.height;
+ struct wlr_box borders[] = {
+ {ox, oy, w + 2 * c->bw, c->bw}, /* top */
+ {ox, oy + c->bw, c->bw, h}, /* left */
+ {ox + c->bw + w, oy + c->bw, c->bw, h}, /* right */
+ {ox, oy + c->bw + h, w + 2 * c->bw, c->bw}, /* bottom */
+ };
+ int i;
+ for (i = 0; i < sizeof(borders) / sizeof(borders[0]); i++) {
+ scalebox(&borders[i], m->wlr_output->scale);
+ wlr_render_rect(drw, &borders[i], bordercolor,
+ m->wlr_output->transform_matrix);
+ }
+
struct render_data rdata = {
.output = m->wlr_output,
.when = now,