diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 3e4ef381..2ba41232 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -167,6 +167,23 @@ void CurrentWindowCmd::real_execute() { (fbwindow().*m_action)(); } +void ActivateTabCmd::real_execute() { + Window root, last = 0, + tab = Fluxbox::instance()->lastEvent().xany.window; + int junk; unsigned int ujunk; + WinClient *winclient = fbwindow().winClientOfLabelButtonWindow(tab); + 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); + } +} + namespace { FbTk::Command *parseIntCmd(const string &command, const string &args, @@ -222,30 +239,6 @@ REGISTER_COMMAND_PARSER(activate, parseFocusCmd, void); REGISTER_COMMAND_PARSER(focus, parseFocusCmd, void); -class ActivateTabCmd: public WindowHelperCmd { -public: - explicit ActivateTabCmd() { } -protected: - void real_execute() { - 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); - } - - } -}; - - REGISTER_COMMAND(activatetab, ActivateTabCmd, void); class SetXPropCmd: public WindowHelperCmd { diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 95175f2a..36f76ec9 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh @@ -282,4 +282,11 @@ private: ClientPattern m_pat; }; +class ActivateTabCmd: public WindowHelperCmd { +public: + explicit ActivateTabCmd() { } +protected: + void real_execute(); +}; + #endif // CURRENTWINDOWCMD_HH