commit b8d44b7175356a356869600da2ea356984621f85
parent 995dfc5a3a3364275358d73bccb2010abf27d9ba
Author: hhvn <dev@hhvn.uk>
Date: Sun, 6 Feb 2022 11:36:59 +0000
tabbed.c: check if any clients have focus
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tabbed.c b/tabbed.c
@@ -333,7 +333,8 @@ void
drawbar(void)
{
XftColor *col;
- Window focused;
+ Window focuswin;
+ int hasfocus = 0;
int null;
int c, cc, fc, width;
char *name = NULL;
@@ -371,10 +372,13 @@ drawbar(void)
}
cc = MIN(cc, nclients);
- XGetInputFocus(dpy, &focused, &null);
+ XGetInputFocus(dpy, &focuswin, &null);
+ for (c = 0; c < nclients; c++)
+ if (clients[c]->win == focuswin)
+ hasfocus = 1;
for (c = fc; c < fc + cc; c++) {
dc.w = width / cc;
- if (c == sel && (!mainselectcol || clients[c]->win == focused)) {
+ if (c == sel && (!mainselectcol || hasfocus)) {
col = dc.sel;
dc.w += width % cc;
} else {