From 799617f6d1ef27de7126b05e27d1ba6e0814bc39 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 19 Oct 2002 14:07:00 +0000 Subject: windowmenu always visible, fixes bug [ 604634 ] Fluxbox 0.1.11 menu on iconbar problem --- src/Toolbar.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Toolbar.cc b/src/Toolbar.cc index 6bf5654..96500af 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Toolbar.cc,v 1.34 2002/10/15 17:13:24 fluxgen Exp $ +// $Id: Toolbar.cc,v 1.35 2002/10/19 14:07:00 fluxgen Exp $ #include "Toolbar.hh" @@ -998,10 +998,23 @@ void Toolbar::buttonPressEvent(XButtonEvent *be) { XLowerWindow(display, frame.window); } else if (be->button == 3) { FluxboxWindow *fluxboxwin = 0; + // if we clicked on a icon then show window menu if ( iconbar && (fluxboxwin = iconbar->findWindow(be->window)) ) { - Windowmenu *wm = fluxboxwin->getWindowmenu(); - if (wm) - fluxboxwin->showMenu(be->x_root, be->y_root - wm->height()); + const Windowmenu * const wm = fluxboxwin->getWindowmenu(); + if (wm != 0) { + int menu_y = be->y_root - wm->height(); + int menu_x = be->x_root; + // make sure the menu is visible + if (menu_y < 0) { + menu_y = 0; + } + if (menu_x < 0) { + menu_x = 0; + } else if (menu_x + wm->width() > screen->getWidth()) { + menu_x = screen->getWidth() - wm->width(); + } + fluxboxwin->showMenu(menu_x, menu_y); + } } else if (! toolbarmenu->isVisible()) { int x, y; -- cgit v0.11.2