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 =)
This commit is contained in:
Thomas Lübking 2016-07-15 16:19:27 +02:00
parent 8d88d9be17
commit a1d3065994

View file

@ -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);