Created
July 30, 2022 21:33
-
-
Save ortango/cd17abbae27dd6d32afeaa65a0a6b717 to your computer and use it in GitHub Desktop.
quick edit for the effect. using 2bwm's border code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ruN a/tree.c b/tree.c | |
--- a/tree.c 2022-07-30 17:23:37.210497524 -0400 | |
+++ b/tree.c 2022-07-30 17:20:21.036916013 -0400 | |
@@ -132,12 +132,14 @@ | |
if (!rect_eq(r, cr)) { | |
window_move_resize(n->id, r.x, r.y, r.width, r.height); | |
+ | |
if (!grabbing) { | |
put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", m->id, d->id, n->id, r.width, r.height, r.x, r.y); | |
} | |
} | |
window_border_width(n->id, bw); | |
+ window_draw_border(n->id, get_border_color((n == d->focus), (m == mon))); | |
} else { | |
xcb_rectangle_t first_rect; | |
diff -ruN a/window.c b/window.c | |
--- a/window.c 2022-07-30 17:23:37.210497524 -0400 | |
+++ b/window.c 2022-07-30 17:20:21.037916057 -0400 | |
@@ -418,7 +418,77 @@ | |
void window_draw_border(xcb_window_t win, uint32_t border_color_pxl) | |
{ | |
- xcb_change_window_attributes(dpy, win, XCB_CW_BORDER_PIXEL, &border_color_pxl); | |
+ uint32_t values[1]; | |
+ uint16_t half = 0; | |
+ xcb_get_geometry_reply_t *geo = xcb_get_geometry_reply(dpy, xcb_get_geometry(dpy, win), NULL); | |
+ if (geo == NULL) return; | |
+ | |
+ //hardcoded | |
+ half = 6; | |
+ | |
+ uint16_t w = geo->width; | |
+ uint16_t h = geo->height; | |
+ uint16_t bw = geo->border_width; | |
+ uint16_t depth = geo->depth; | |
+ | |
+ xcb_rectangle_t rect_inner[] = { | |
+ { | |
+ w,0,bw - half,h + bw - half | |
+ }, | |
+ { | |
+ w + bw + half,0,bw - half,h + bw - half | |
+ }, | |
+ { | |
+ 0,h,w + bw - half,bw - half | |
+ }, | |
+ { | |
+ 0,h + bw + half,w + bw - half,bw - half | |
+ }, | |
+ { | |
+ w + bw + half,bw + h + half,bw, bw | |
+ } | |
+ }; | |
+ | |
+ xcb_rectangle_t rect_outer[] = { | |
+ { | |
+ w + bw - half,0,half, h + bw * 2 | |
+ }, | |
+ { | |
+ w + bw,0,half,h + bw * 2 | |
+ }, | |
+ { | |
+ 0,h + bw - half,w + bw * 2,half | |
+ }, | |
+ { | |
+ 0,h + bw,w + bw * 2,half | |
+ }, | |
+ { | |
+ 1,1,1,1 | |
+ } | |
+ }; | |
+ | |
+ xcb_pixmap_t pmap = xcb_generate_id(dpy); | |
+ xcb_create_pixmap(dpy, depth, pmap, win,w + (bw * 2),h + (bw * 2)); | |
+ | |
+ xcb_gcontext_t gc = xcb_generate_id(dpy); | |
+ xcb_create_gc(dpy, gc, pmap, 0, NULL); | |
+ | |
+ //hardcoded | |
+ values[0] = 0xff0000; | |
+ | |
+ xcb_change_gc(dpy, gc, XCB_GC_FOREGROUND, &values[0]); | |
+ xcb_poly_fill_rectangle(dpy, pmap, gc, 5, rect_outer); | |
+ | |
+ values[0] = border_color_pxl; | |
+ | |
+ xcb_change_gc(dpy, gc, XCB_GC_FOREGROUND, &values[0]); | |
+ xcb_poly_fill_rectangle(dpy, pmap, gc, 5, rect_inner); | |
+ values[0] = pmap; | |
+ xcb_change_window_attributes(dpy,win, XCB_CW_BORDER_PIXMAP,&values[0]); | |
+ | |
+ xcb_free_pixmap(dpy,pmap); | |
+ xcb_free_gc(dpy,gc); | |
+ xcb_flush(dpy); | |
} | |
void adopt_orphans(void) | |
@@ -618,6 +688,7 @@ | |
n->client->floating_rectangle = (xcb_rectangle_t) {x, y, width, height}; | |
if (n->client->state == STATE_FLOATING) { | |
window_move_resize(n->id, x, y, width, height); | |
+ window_draw_border(n->id, get_border_color(loc->monitor = mon, loc->node = mon->desk->focus)); | |
if (!grabbing) { | |
put_status(SBSC_MASK_NODE_GEOMETRY, "node_geometry 0x%08X 0x%08X 0x%08X %ux%u+%i+%i\n", loc->monitor->id, loc->desktop->id, loc->node->id, width, height, x, y); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment