diff options
author | John Ankarström <john@ankarstrom.se> | 2021-06-10 00:57:23 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-06-10 00:57:23 +0200 |
commit | bc236b7fbc4a2603dacb682926df64e2a70c48f1 (patch) | |
tree | 74d8e4e2087e947a9290ca2c2a12afeacf8dd271 | |
parent | 2a0edf6b012c6bc553118767cd6c7354caf79003 (diff) | |
download | jwm-bc236b7fbc4a2603dacb682926df64e2a70c48f1.tar.gz |
Focus window when hovered in taskbar
This may call FocusClient a thousand times per second, I don't
know. But it works.
-rw-r--r-- | src/taskbar.c | 14 |
1 files 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); } } } |