From e828391b1c09e22a4431926f13a27d3bde3369b6 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 12 Apr 2004 23:05:10 +0000 Subject: hide window menu if click on another window, patch from Mathias Gumz --- src/Screen.cc | 10 ++++++++-- src/Screen.hh | 5 ++++- src/Window.cc | 15 ++++++++------- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Screen.cc b/src/Screen.cc index 5941c1d..d026f12 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.cc,v 1.273 2004/03/30 13:46:34 fluxgen Exp $ +// $Id: Screen.cc,v 1.274 2004/04/12 23:05:10 fluxgen Exp $ #include "Screen.hh" @@ -901,6 +901,11 @@ void BScreen::hideMenus() { (*it)->menu().hide(); } // hide all client menus + hideWindowMenus(); + +} + +void BScreen::hideWindowMenus(const FluxboxWindow* except) { Workspaces::iterator w_it = getWorkspacesList().begin(); const Workspaces::iterator w_it_end = getWorkspacesList().end(); for (; w_it != w_it_end; ++w_it) { @@ -908,13 +913,14 @@ void BScreen::hideMenus() { Workspace::Windows::iterator win_it = (*w_it)->windowList().begin(); const Workspace::Windows::iterator win_it_end = (*w_it)->windowList().end(); for (; win_it != win_it_end; ++win_it) { + if (*win_it != except) (*win_it)->menu().hide(); } } } +} -} void BScreen::reconfigure() { m_menutheme->setAlpha(*resource.menu_alpha); diff --git a/src/Screen.hh b/src/Screen.hh index b84b950..6731d14 100644 --- a/src/Screen.hh +++ b/src/Screen.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Screen.hh,v 1.137 2004/03/30 13:45:20 fluxgen Exp $ +// $Id: Screen.hh,v 1.138 2004/04/12 23:05:10 fluxgen Exp $ #ifndef SCREEN_HH #define SCREEN_HH @@ -178,6 +178,9 @@ public: FbTk::Menu *createMenu(const std::string &label); void hideMenus(); + /// hide all windowmenus except the given one (if given) + void hideWindowMenus(const FluxboxWindow* except= 0); + /// @return the resource value of number of workspace inline int getNumberOfWorkspaces() const { return *resource.workspaces; } diff --git a/src/Window.cc b/src/Window.cc index f77d79e..faeec93 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Window.cc,v 1.276 2004/04/12 18:19:10 fluxgen Exp $ +// $Id: Window.cc,v 1.277 2004/04/12 23:03:34 fluxgen Exp $ #include "Window.hh" @@ -393,8 +393,8 @@ void FluxboxWindow::init() { FbTk::TextButton *btn = new FbTk::TextButton(frame().label(), - frame().theme().font(), - m_client->title()); + frame().theme().font(), + m_client->title()); btn->setJustify(frame().theme().justify()); m_labelbuttons[m_client] = btn; frame().addLabelButton(*btn); @@ -2354,8 +2354,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); } - if (m_windowmenu.isVisible()) - m_windowmenu.hide(); + Fluxbox::instance()->hideExtraMenus(screen()); + screen().hideWindowMenus(this); } } @@ -3523,7 +3523,8 @@ void FluxboxWindow::setupWindow() { */ void FluxboxWindow::reconfigTheme() { - m_frame.setBorderWidth(decorations.border?frame().theme().border().width():0); + m_frame.setBorderWidth(decorations.border ? + frame().theme().border().width() : 0); if (decorations.handle && frame().theme().handleWidth() != 0) frame().showHandle(); else @@ -3545,7 +3546,7 @@ void FluxboxWindow::reconfigTheme() { sendConfigureNotify(); } -// grab pointer an increase counter. +// grab pointer and increase counter. // we need this to count grab pointers, // especially at startup, where we can drag/resize while starting // and causing it to send events to windows later on and make -- cgit v0.11.2