From 36993a80f4a246456429932abf596f2d2ef4b89d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Sat, 3 Sep 2016 22:35:38 +0200 Subject: hide menus when clicking title or toolbar BUG: 1149 --- src/IconbarTool.cc | 2 ++ src/Toolbar.cc | 3 +++ src/Window.cc | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 128b71e..84c91ef 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc @@ -194,6 +194,7 @@ class ShowMenu: public FbTk::Command { public: explicit ShowMenu(FluxboxWindow &win):m_win(win) { } void execute() { + FbTk::Menu::hideShownMenu(); // get last button pos const XEvent &e = Fluxbox::instance()->lastEvent(); m_win.popupMenu(e.xbutton.x_root, e.xbutton.y_root); @@ -206,6 +207,7 @@ class FocusCommand: public FbTk::Command { public: explicit FocusCommand(Focusable &win): m_win(win) { } void execute() { + FbTk::Menu::hideShownMenu(); // this needs to be a local variable, as this object could be destroyed // if the workspace is changed. FluxboxWindow *fbwin = m_win.fbwindow(); diff --git a/src/Toolbar.cc b/src/Toolbar.cc index bfaec94..f343552 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -514,6 +514,9 @@ void Toolbar::reconfigure() { void Toolbar::buttonPressEvent(XButtonEvent &be) { Display *dpy = Fluxbox::instance()->display(); + + FbTk::Menu::hideShownMenu(); + if (be.subwindow) { // Do not intercept mouse events that are meant for the tray icon if (SystemTray::doesControl(be.subwindow)) { diff --git a/src/Window.cc b/src/Window.cc index ad58263..1e15dc8 100644 --- a/src/Window.cc +++ b/src/Window.cc @@ -2415,6 +2415,8 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { m_last_button_y = be.y_root; m_last_pressed_button = be.button; + FbTk::Menu::hideShownMenu(); + Keys *k = Fluxbox::instance()->keys(); int context = 0; context = frame().getContext(be.subwindow ? be.subwindow : be.window, be.x_root, be.y_root); @@ -2448,7 +2450,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { m_button_grab_x = be.x_root - frame().x() - frame().window().borderWidth(); m_button_grab_y = be.y_root - frame().y() - frame().window().borderWidth(); } - FbTk::Menu::hideShownMenu(); + if (!m_focused && acceptsFocus() && m_click_focus) focus(); -- cgit v0.11.2