From bc236b7fbc4a2603dacb682926df64e2a70c48f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 10 Jun 2021 00:57:23 +0200 Subject: Focus window when hovered in taskbar This may call FocusClient a thousand times per second, I don't know. But it works. --- src/taskbar.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/taskbar.c b/src/taskbar.c index 1e2cb1b..f0a72fe 100644 --- a/src/taskbar.c +++ b/src/taskbar.c @@ -446,15 +446,17 @@ void SignalTaskbar(const TimeType *now, int x, int y) { for(bp = bars; bp; bp = bp->next) { if(abs(bp->mousex - x) < POPUP_DELTA && abs(bp->mousey - y) < POPUP_DELTA) { - if(GetTimeDifference(now, &bp->mouseTime) >= popupDelay) { - if(bp->layout == LAYOUT_HORIZONTAL) { - np = GetNode(bp, x - bp->cp->screenx); - } else { - np = GetNode(bp, y - bp->cp->screeny); - } + if(bp->layout == LAYOUT_HORIZONTAL) { + np = GetNode(bp, x - bp->cp->screenx); + } else { + np = GetNode(bp, y - bp->cp->screeny); + } + if(GetTimeDifference(now, &bp->mouseTime)>=popupDelay) { if(np) { ShowPopup(x, y, np->client->name); } + } else { + FocusClient(np->client); } } } -- cgit v1.2.3