From 18ae02875fbe67b375bbc5a8d3ac84771d0767c1 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Mon, 18 Aug 2008 15:20:16 -0700 Subject: fix :Focus when all windows are minimized --- src/CurrentWindowCmd.cc | 25 +++++++++++++------------ src/CurrentWindowCmd.hh | 10 ---------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index 28d7ecd..bfccbdc 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc @@ -189,6 +189,19 @@ REGISTER_COMMAND_PARSER(taketoprevworkspace, parseIntCmd, void); REGISTER_COMMAND_PARSER(sendtoworkspace, parseIntCmd, void); REGISTER_COMMAND_PARSER(taketoworkspace, parseIntCmd, void); +FbTk::Command *parseFocusCmd(const string &command, const string &args, + bool trusted) { + ClientPattern pat(args.c_str()); + if (!pat.error()) + return FbTk::CommandParser::instance().parse("GoToWindow 1 " + + args); + return new CurrentWindowCmd((CurrentWindowCmd::Action) + &FluxboxWindow::focus); +} + +REGISTER_COMMAND_PARSER(activate, parseFocusCmd, void); +REGISTER_COMMAND_PARSER(focus, parseFocusCmd, void); + }; // end anonymous namespace void SetHeadCmd::real_execute() { @@ -250,18 +263,6 @@ void GoToTabCmd::real_execute() { (*it)->focus(); } -REGISTER_COMMAND_WITH_ARGS(activate, FocusCmd, void); -REGISTER_COMMAND_WITH_ARGS(focus, FocusCmd, void); - -void FocusCmd::real_execute() { - Focusable *win = 0; - if (!m_pat.error()) - win = fbwindow().screen().focusControl().focusedOrderWinList().find(m_pat); - if (!win) - win = &fbwindow(); - win->focus(); -} - REGISTER_COMMAND(startmoving, StartMovingCmd, void); void StartMovingCmd::real_execute() { diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 2d33847..8371204 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh @@ -137,16 +137,6 @@ private: const int m_tab_num; }; -// focus the window -class FocusCmd: public WindowHelperCmd { -public: - explicit FocusCmd(const std::string &pat): m_pat(pat.c_str()) { } -protected: - void real_execute(); -private: - const ClientPattern m_pat; -}; - // begin moving with mouse class StartMovingCmd: public WindowHelperCmd { public: -- cgit v0.11.2