From a1d3065994daba4bb0d1b437981afff358377bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Fri, 15 Jul 2016 16:19:27 +0200 Subject: Search actual tab under mouse The feature suggests to behave like this bug actually only supported mouse clicks (because the latest event window needed to be the tab) This condition will break with two future patches (OnTitlebar context selection and Sync Pointer grabbing) so the code to determine the tab client needs to be a bit more sophisticated and, as a bonus, keyboard shortcuts to activate the tab under the pointer will work as well =) --- src/CurrentWindowCmd.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 44556f5..3e4ef38 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -227,8 +227,16 @@ public: explicit ActivateTabCmd() { } protected: void real_execute() { - WinClient* winclient = fbwindow().winClientOfLabelButtonWindow( - Fluxbox::instance()->lastEvent().xany.window); + Window root, last = 0, + tab = Fluxbox::instance()->lastEvent().xany.window; + int junk; unsigned int ujunk; + WinClient *winclient = 0; + Display *dpy = Fluxbox::instance()->display(); + while (!winclient && tab && tab != last) { + last = tab; + XQueryPointer(dpy, tab, &root, &tab, &junk, &junk, &junk, &junk, &ujunk); + winclient = fbwindow().winClientOfLabelButtonWindow(tab); + } if (winclient && winclient != &fbwindow().winClient()) { fbwindow().setCurrentClient(*winclient, true); -- cgit v0.11.2