windowmenu always visible, fixes bug [ 604634 ] Fluxbox 0.1.11 menu on iconbar problem
fluxgen fluxgen
1 files changed,
17 insertions(+),
4 deletions(-)
jump to
M
src/Toolbar.cc
→
src/Toolbar.cc
@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ } else if (be->button == 2 && (! on_top)) {
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;