From 5b30d5ed0018f233c0b613e434521b555d2735c4 Mon Sep 17 00:00:00 2001 From: wochap Date: Fri, 8 Mar 2024 13:37:41 -0500 Subject: [PATCH] add borders patch this patch adds 2 borders to each side (top,bottom,left,right) --- borders/borders.patch | 184 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 borders/borders.patch diff --git a/borders/borders.patch b/borders/borders.patch new file mode 100644 index 0000000..b55abfb --- /dev/null +++ b/borders/borders.patch @@ -0,0 +1,184 @@ +From 18abc170273690fd3fbbdcbe88b348a0b802ba91 Mon Sep 17 00:00:00 2001 +From: wochap +Date: Wed, 6 Mar 2024 11:45:30 -0500 +Subject: [PATCH] add 2 more borders for each side + +--- + client.h | 16 +++++++++++++--- + config.def.h | 7 +++++++ + dwl.c | 41 +++++++++++++++++++++++++++++++++++++---- + 3 files changed, 57 insertions(+), 7 deletions(-) + +diff --git a/client.h b/client.h +index 71c7d76..c65f3ec 100644 +--- a/client.h ++++ b/client.h +@@ -309,11 +309,21 @@ client_send_close(Client *c) + } + + static inline void +-client_set_border_color(Client *c, const float color[static 4]) ++client_set_border_color(Client *c, const float color[static 4], const float colors[static 4], const float colore[static 4]) + { + int i; +- for (i = 0; i < 4; i++) +- wlr_scene_rect_set_color(c->border[i], color); ++ for (i = 0; i < 4; i++) { ++ if (border_color_type == BrdOriginal) { ++ wlr_scene_rect_set_color(c->border[i], color); ++ } else if (border_color_type == BrdStart) { ++ wlr_scene_rect_set_color(c->borders[i], colors); ++ } else if (border_color_type == BrdEnd) { ++ wlr_scene_rect_set_color(c->bordere[i], colore); ++ } else if (border_color_type == BrdStartEnd) { ++ wlr_scene_rect_set_color(c->borders[i], colors); ++ wlr_scene_rect_set_color(c->bordere[i], colore); ++ } ++ } + } + + static inline void +diff --git a/config.def.h b/config.def.h +index db0babc..bc03d24 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -7,7 +7,14 @@ + static const int sloppyfocus = 1; /* focus follows mouse */ + static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ + static const unsigned int borderpx = 1; /* border pixel of windows */ ++static const unsigned int borderspx = 0; /* width of the border that start from outside the windows */ ++static const unsigned int borderepx = 0; /* width of the border that start from inside the windows */ ++static const unsigned int borderspx_offset = 0; /* offset of the border that start from outside the windows */ ++static const unsigned int borderepx_negative_offset = 0; /* offset of the border that start from inside the windows */ + static const float bordercolor[] = COLOR(0x444444ff); ++static const float borderscolor[] = COLOR(0x444444ff); /* color of the border that start from outside the windows */ ++static const float borderecolor[] = COLOR(0x444444ff); /* color of the border that start from inside the windows */ ++static const int border_color_type = BrdOriginal; /* borders to be colored (focuscolor, urgentcolor) */ + static const float focuscolor[] = COLOR(0x005577ff); + static const float urgentcolor[] = COLOR(0xff0000ff); + /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ +diff --git a/dwl.c b/dwl.c +index ef27a1d..e11b185 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -80,6 +80,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrFS, LyrTop, LyrOverlay, LyrBlock, + enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar, + NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */ + #endif ++enum { BrdOriginal, BrdStart, BrdEnd, BrdStartEnd }; + + typedef union { + int i; +@@ -103,6 +104,8 @@ typedef struct { + Monitor *mon; + struct wlr_scene_tree *scene; + struct wlr_scene_rect *border[4]; /* top, bottom, left, right */ ++ struct wlr_scene_rect *borders[4]; /* top, bottom, left, right */ ++ struct wlr_scene_rect *bordere[4]; /* top, bottom, left, right */ + struct wlr_scene_tree *scene_surface; + struct wl_list link; + struct wl_list flink; +@@ -127,6 +130,8 @@ typedef struct { + struct wl_listener set_hints; + #endif + unsigned int bw; ++ unsigned int bws; ++ unsigned int bwe; + uint32_t tags; + int isfloating, isurgent, isfullscreen; + uint32_t resize; /* configure serial of a pending resize */ +@@ -971,6 +976,8 @@ createnotify(struct wl_listener *listener, void *data) + c = xdg_surface->data = ecalloc(1, sizeof(*c)); + c->surface.xdg = xdg_surface; + c->bw = borderpx; ++ c->bws = borderspx; ++ c->bwe = borderepx; + + wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel, + WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); +@@ -1205,7 +1212,7 @@ focusclient(Client *c, int lift) + /* Don't change border color if there is an exclusive focus or we are + * handling a drag operation */ + if (!exclusive_focus && !seat->drag) +- client_set_border_color(c, focuscolor); ++ client_set_border_color(c, focuscolor, focuscolor, focuscolor); + } + + /* Deactivate old client if focus is changing */ +@@ -1222,7 +1229,7 @@ focusclient(Client *c, int lift) + /* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg + * and probably other clients */ + } else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) { +- client_set_border_color(old_c, bordercolor); ++ client_set_border_color(old_c, bordercolor, borderscolor, borderecolor); + + client_activate_surface(old, 0); + } +@@ -1535,6 +1542,12 @@ mapnotify(struct wl_listener *listener, void *data) + for (i = 0; i < 4; i++) { + c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, bordercolor); + c->border[i]->node.data = c; ++ ++ c->borders[i] = wlr_scene_rect_create(c->scene, 0, 0, borderscolor); ++ c->borders[i]->node.data = c; ++ ++ c->bordere[i] = wlr_scene_rect_create(c->scene, 0, 0, borderecolor); ++ c->bordere[i]->node.data = c; + } + + /* Initialize client geometry with room for border */ +@@ -1951,6 +1964,24 @@ resize(Client *c, struct wlr_box geo, int interact) + wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); + wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw); + ++ wlr_scene_rect_set_size(c->borders[0], c->geom.width - 2 * borderspx_offset, c->bws); ++ wlr_scene_rect_set_size(c->borders[1], c->geom.width - 2 * borderspx_offset, c->bws); ++ wlr_scene_rect_set_size(c->borders[2], c->bws, c->geom.height - 2 * c->bws - 2 * borderspx_offset); ++ wlr_scene_rect_set_size(c->borders[3], c->bws, c->geom.height - 2 * c->bws - 2 * borderspx_offset); ++ wlr_scene_node_set_position(&c->borders[0]->node, borderspx_offset, borderspx_offset); ++ wlr_scene_node_set_position(&c->borders[1]->node, borderspx_offset, c->geom.height - c->bws - borderspx_offset); ++ wlr_scene_node_set_position(&c->borders[2]->node, borderspx_offset, c->bws + borderspx_offset); ++ wlr_scene_node_set_position(&c->borders[3]->node, c->geom.width - c->bws - borderspx_offset, c->bws + borderspx_offset); ++ ++ wlr_scene_rect_set_size(c->bordere[0], c->geom.width - (c->bw - c->bwe) * 2 + borderepx_negative_offset * 2, c->bwe); ++ wlr_scene_rect_set_size(c->bordere[1], c->geom.width - (c->bw - c->bwe) * 2 + borderepx_negative_offset * 2, c->bwe); ++ wlr_scene_rect_set_size(c->bordere[2], c->bwe, c->geom.height - 2 * c->bw + 2 * borderepx_negative_offset); ++ wlr_scene_rect_set_size(c->bordere[3], c->bwe, c->geom.height - 2 * c->bw + 2 * borderepx_negative_offset); ++ wlr_scene_node_set_position(&c->bordere[0]->node, c->bw - c->bwe - borderepx_negative_offset, c->bw - c->bwe - borderepx_negative_offset); ++ wlr_scene_node_set_position(&c->bordere[1]->node, c->bw - c->bwe - borderepx_negative_offset, c->geom.height - c->bw + borderepx_negative_offset); ++ wlr_scene_node_set_position(&c->bordere[2]->node, c->bw - c->bwe - borderepx_negative_offset, c->bw - borderepx_negative_offset); ++ wlr_scene_node_set_position(&c->bordere[3]->node, c->geom.width - c->bw + borderepx_negative_offset, c->bw - borderepx_negative_offset); ++ + /* this is a no-op if size hasn't changed */ + c->resize = client_set_size(c, c->geom.width - 2 * c->bw, + c->geom.height - 2 * c->bw); +@@ -2063,6 +2094,8 @@ setfullscreen(Client *c, int fullscreen) + if (!c->mon) + return; + c->bw = fullscreen ? 0 : borderpx; ++ c->bws = fullscreen ? 0 : borderspx; ++ c->bwe = fullscreen ? 0 : borderepx; + client_set_fullscreen(c, fullscreen); + wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen + ? LyrFS : c->isfloating ? LyrFloat : LyrTile]); +@@ -2651,7 +2684,7 @@ urgent(struct wl_listener *listener, void *data) + return; + + if (client_surface(c)->mapped) +- client_set_border_color(c, urgentcolor); ++ client_set_border_color(c, urgentcolor, urgentcolor, urgentcolor); + c->isurgent = 1; + printstatus(); + } +@@ -2835,7 +2868,7 @@ sethints(struct wl_listener *listener, void *data) + c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); + + if (c->isurgent && surface && surface->mapped) +- client_set_border_color(c, urgentcolor); ++ client_set_border_color(c, urgentcolor, urgentcolor, urgentcolor); + + printstatus(); + } +-- +2.42.0 +