all repos — fluxbox @ bc2b21547b290f599ca83297e3131c6c0c87759f

custom fork of the fluxbox windowmanager

implemented 'ActivateTab' action to (re)allow activation of tabs via mouse
Mathias Gumz akira at fluxbox dot org
commit

bc2b21547b290f599ca83297e3131c6c0c87759f

parent

b4e65724efbfbefdf4f5a12be19225b2d8a8dda6

M data/keysdata/keys

@@ -29,7 +29,8 @@ # double click on the titlebar to shade

OnTitlebar Double Mouse1 :Shade # left click on the titlebar to move the window -OnTitlebar Mouse1 :StartMoving +OnTitlebar Mouse1 :MacroCmd {ActivateTab} {Raise} {Focus} +OnTitlebar Move1 :StartMoving # middle click on the titlebar to lower OnTitlebar Mouse2 :Lower
M doc/asciidoc/fluxbox-keys.txtdoc/asciidoc/fluxbox-keys.txt

@@ -184,6 +184,9 @@

*StartTabbing*:: Start dragging to add this window to another's tabgroup. +*ActivateTab*:: + Activates the tab underneath the mouse. + Window Commands ~~~~~~~~~~~~~~~ These commands ordinarily affect only the currently focused window. The
M src/CurrentWindowCmd.ccsrc/CurrentWindowCmd.cc

@@ -223,6 +223,27 @@

REGISTER_COMMAND_PARSER(activate, parseFocusCmd, void); REGISTER_COMMAND_PARSER(focus, parseFocusCmd, void); + +class ActivateTabCmd: public WindowHelperCmd { +public: + ActivateTabCmd() { } +protected: + void real_execute(); +}; + + +void ActivateTabCmd::real_execute() { + + WinClient* winclient = fbwindow().winClientOfLabelButtonWindow( + Fluxbox::instance()->lastEvent().xany.window); + + if (winclient && winclient != &fbwindow().winClient()) { + fbwindow().setCurrentClient(*winclient, true); + } +} + +REGISTER_COMMAND(activatetab, ActivateTabCmd, void); + } // end anonymous namespace void SetHeadCmd::real_execute() {
M src/Keys.ccsrc/Keys.cc

@@ -354,6 +354,8 @@ addBinding("OnDesktop Mouse1 :HideMenus");

addBinding("OnDesktop Mouse2 :WorkspaceMenu"); addBinding("OnDesktop Mouse3 :RootMenu"); addBinding("OnTitlebar Mouse3 :WindowMenu"); + addBinding("OnWindow Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}"); + addBinding("OnTitlebar Mouse1 :MacroCmd {ActivateTab} {Raise} {Focus}"); addBinding("OnTitlebar Move1 :StartMoving"); addBinding("OnLeftGrip Move1 :StartResizing bottomleft"); addBinding("OnRightGrip Move1 :StartResizing bottomright");
M src/Window.ccsrc/Window.cc

@@ -812,16 +812,10 @@ x, y, &dest_x, &dest_y,

&labelbutton)) return m_clientlist.end(); - Client2ButtonMap::iterator it = - find_if(m_labelbuttons.begin(), - m_labelbuttons.end(), - Compose(bind2nd(equal_to<Window>(), labelbutton), - Compose(mem_fun(&TextButton::window), - Select2nd<Client2ButtonMap::value_type>()))); - + WinClient* c = winClientOfLabelButtonWindow(labelbutton); // label button not found - if (it == m_labelbuttons.end()) + if (!c) return m_clientlist.end(); Window child_return=0;

@@ -834,8 +828,8 @@ return m_clientlist.end();

ClientList::iterator client = find(m_clientlist.begin(), m_clientlist.end(), - it->first); - if (x > static_cast<signed>((*it).second->width()) / 2) + c); + if (x > static_cast<signed>(m_labelbuttons[c]->width()) / 2) client++; return client;

@@ -853,15 +847,9 @@ x, y, &dest_x, &dest_y,

&labelbutton)) return; - Client2ButtonMap::iterator it = - find_if(m_labelbuttons.begin(), - m_labelbuttons.end(), - Compose(bind2nd(equal_to<Window>(), labelbutton), - Compose(mem_fun(&TextButton::window), - Select2nd<Client2ButtonMap::value_type>()))); + WinClient* client = winClientOfLabelButtonWindow(labelbutton); - // label button not found - if (it == m_labelbuttons.end()) + if (!client) return; Window child_return = 0;

@@ -871,10 +859,10 @@ frame().tabcontainer().window(), labelbutton,

dest_x, dest_y, &x, &y, &child_return)) return; - if (x > static_cast<signed>((*it).second->width()) / 2) - moveClientRightOf(win, *it->first); + if (x > static_cast<signed>(m_labelbuttons[client]->width()) / 2) + moveClientRightOf(win, *client); else - moveClientLeftOf(win, *it->first); + moveClientLeftOf(win, *client); }

@@ -2360,40 +2348,15 @@ bool onTitlebar =

frame().insideTitlebar( be.window ) && frame().handle().window() != be.window; -#if 0 // disabled - if (onTitlebar && be.button == 1) - raise(); -#endif + Keys *k = Fluxbox::instance()->keys(); + if ((onTitlebar && k->doAction(be.type, be.state, be.button, Keys::ON_TITLEBAR, &winClient(), be.time)) || + k->doAction(be.type, be.state, be.button, Keys::ON_WINDOW, &winClient(), be.time)) { - // check keys file first - Keys *k = Fluxbox::instance()->keys(); - if ((onTitlebar && k->doAction(be.type, be.state, be.button, - Keys::ON_TITLEBAR, m_client, be.time)) || - k->doAction(be.type, be.state, be.button, Keys::ON_WINDOW, m_client, - be.time)) { return; } - frame().tabcontainer().tryButtonPressEvent(be); - if (be.button == 1) { - if (frame().window().window() == be.window || - frame().tabcontainer().window() == be.window) { - if (screen().clickRaises()) - raise(); - fbdbg<<"FluxboxWindow::buttonPressEvent: AllowEvent"<<endl; - - XAllowEvents(display, ReplayPointer, be.time); - - m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); - m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); - } else if (frame().handle() == be.window) - raise(); - - FbTk::Menu::hideShownMenu(); - if (!m_focused && acceptsFocus() && m_click_focus) //check focus - focus(); - } + XAllowEvents(display, ReplayPointer, be.time); } void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {

@@ -2650,15 +2613,7 @@

WinClient *client = 0; if (screen().focusControl().isMouseTabFocus()) { // determine if we're in a label button (tab) - Client2ButtonMap::iterator it = - find_if(m_labelbuttons.begin(), - m_labelbuttons.end(), - Compose(bind2nd(equal_to<Window>(), ev.window), - Compose(mem_fun(&TextButton::window), - Select2nd<Client2ButtonMap::value_type>()))); - if (it != m_labelbuttons.end()) - client = (*it).first; - + client = winClientOfLabelButtonWindow(ev.window); } if (ev.window == frame().window() ||

@@ -3149,21 +3104,26 @@

ungrabPointer(CurrentTime); } +WinClient* FluxboxWindow::winClientOfLabelButtonWindow(Window window) { + WinClient* result = 0; + Client2ButtonMap::iterator it = + find_if(m_labelbuttons.begin(), + m_labelbuttons.end(), + Compose(bind2nd(equal_to<Window>(), window), + Compose(mem_fun(&FbTk::Button::window), + Select2nd<Client2ButtonMap::value_type>()))); + if (it != m_labelbuttons.end()) + result = it->first; + + return result; +} + void FluxboxWindow::startTabbing(const XButtonEvent &be) { if (s_num_grabs > 0) return; - m_attaching_tab = 0; - // determine if we're in titlebar - Client2ButtonMap::iterator it = - find_if(m_labelbuttons.begin(), - m_labelbuttons.end(), - Compose(bind2nd(equal_to<Window>(), be.window), - Compose(mem_fun(&TextButton::window), - Select2nd<Client2ButtonMap::value_type>()))); - if (it != m_labelbuttons.end()) - m_attaching_tab = it->first; + m_attaching_tab = winClientOfLabelButtonWindow(be.window); // start drag'n'drop for tab grabPointer(be.window, False, ButtonMotionMask |

@@ -3704,8 +3664,6 @@ frame().theme().focusedTheme()->iconbarTheme(),

frame().theme().unfocusedTheme()->iconbarTheme(), client); frame().createTab(*btn); - FbTk::RefCount<FbTk::Command<void> > setcmd(new SetClientCmd(client)); - btn->setOnClick(setcmd, 1); btn->setTextPadding(Fluxbox::instance()->getTabsPadding()); btn->setPixmap(screen().getTabsUsePixmap());

@@ -3715,6 +3673,7 @@ FbTk::EventManager &evm = *FbTk::EventManager::instance();

evm.add(*this, btn->window()); // we take care of button events for this evm.add(*this, client.window()); + client.setFluxboxWindow(this); join(client.titleSig(), FbTk::MemFun(*this, &FluxboxWindow::setTitle));
M src/Window.hhsrc/Window.hh

@@ -398,6 +398,8 @@ const ClientList &clientList() const { return m_clientlist; }

WinClient &winClient() { return *m_client; } const WinClient &winClient() const { return *m_client; } + WinClient* winClientOfLabelButtonWindow(Window w); + bool isTyping() const; const FbTk::XLayerItem &layerItem() const { return m_frame.layerItem(); }
M src/fluxbox.ccsrc/fluxbox.cc

@@ -605,7 +605,7 @@

if (create_windowmenu) FbTk::FileUtil::copyFile(DEFAULT_WINDOWMENU, windowmenu_file.c_str()); -#define CONFIG_VERSION 11 +#define CONFIG_VERSION 12 FbTk::Resource<int> config_version(m_resourcemanager, 0, "session.configVersion", "Session.ConfigVersion"); if (*config_version < CONFIG_VERSION) {
M util/fluxbox-update_configs.ccutil/fluxbox-update_configs.cc

@@ -391,9 +391,25 @@ new_keyfile += "OnRightGrip Move1 :StartResizing bottomright\n";

new_keyfile += "OnWindowBorder Move1 :StartMoving\n\n"; new_keyfile += whole_keyfile; // don't forget user's old keybindings + new_keyfile += "\n"; // just for good looks write_file(keyfilename, new_keyfile); new_version = 11; + } + + if (old_version < 12) { // update keys for ActivateTab + + string whole_file = read_file(keyfilename); + string new_keyfile = ""; + + new_keyfile += "!mouse actions added by fluxbox-update_configs\n"; + new_keyfile += "OnTitlebar Mouse1 :MacroCmd {ActivateTab} {Raise} {Focus}\n"; + new_keyfile += whole_file; + + new_keyfile += "\n"; // just for good looks + write_file(keyfilename, new_keyfile); + + new_version = 12; } return new_version;