From 29a69a69c1a2f51d6fb790534a0da8683ee24eb9 Mon Sep 17 00:00:00 2001 From: rathnor Date: Mon, 6 Oct 2003 09:55:36 +0000 Subject: minor menu positioning tweaks --- src/FbTk/Menu.cc | 12 ++++++------ src/fluxbox.cc | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/FbTk/Menu.cc b/src/FbTk/Menu.cc index 199fa77..ebaea3b 100644 --- a/src/FbTk/Menu.cc +++ b/src/FbTk/Menu.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Menu.cc,v 1.38 2003/09/07 14:57:49 rathnor Exp $ +// $Id: Menu.cc,v 1.39 2003/10/06 09:55:36 rathnor Exp $ //use GNU extensions #ifndef _GNU_SOURCE @@ -1231,18 +1231,18 @@ void Menu::enterNotifyEvent(XCrossingEvent &ce) { menu.x_shift = menu.x, menu.y_shift = menu.y; if (menu.x + menu.width > m_screen_width) { - menu.x_shift = m_screen_width - menu.width - m_border_width; + menu.x_shift = m_screen_width - menu.width - 2*m_border_width; shifted = true; } else if (menu.x < 0) { - menu.x_shift = -m_border_width; + menu.x_shift = 0; //-m_border_width; shifted = true; } - if (menu.y + menu.height > m_screen_height) { - menu.y_shift = m_screen_height - menu.height - m_border_width; + if (menu.y + menu.height + 2*m_border_width > m_screen_height) { + menu.y_shift = m_screen_height - menu.height - 2*m_border_width; shifted = true; } else if (menu.y + (signed) menu.title_h < 0) { - menu.y_shift = -m_border_width;; + menu.y_shift = 0; // -m_border_width;; shifted = true; } diff --git a/src/fluxbox.cc b/src/fluxbox.cc index bc985a7..957ea15 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.196 2003/10/05 07:19:38 rathnor Exp $ +// $Id: fluxbox.cc,v 1.197 2003/10/06 09:55:36 rathnor Exp $ #include "fluxbox.hh" @@ -989,16 +989,16 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { if (mx + screen->getWorkspacemenu()->width() > screen->width()) { - mx = screen->width() - + mx = screen->width()-1 - screen->getWorkspacemenu()->width() - - screen->getWorkspacemenu()->fbwindow().borderWidth(); + 2*screen->getWorkspacemenu()->fbwindow().borderWidth(); } if (my + screen->getWorkspacemenu()->height() > screen->height()) { - my = screen->height() - + my = screen->height()-1 - screen->getWorkspacemenu()->height() - - screen->getWorkspacemenu()->fbwindow().borderWidth(); + 2*screen->getWorkspacemenu()->fbwindow().borderWidth(); } screen->getWorkspacemenu()->move(mx, my); @@ -1007,27 +1007,28 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) { screen->getWorkspacemenu()->show(); } } else if (be.button == 3) { - //calculate placement of workspace menu + //calculate placement of root menu //and show/hide it int mx = be.x_root - (screen->getRootmenu()->width() / 2); int my = be.y_root - (screen->getRootmenu()->titleHeight() / 2); + int borderw = screen->getRootmenu()->fbwindow().borderWidth(); if (mx < 0) mx = 0; if (my < 0) my = 0; - - if (mx + screen->getRootmenu()->width() > screen->width()) { + + if (mx + screen->getRootmenu()->width() + 2*borderw > screen->width()) { mx = screen->width() - screen->getRootmenu()->width() - - screen->getRootmenu()->fbwindow().borderWidth(); + 2*borderw; } - if (my + screen->getRootmenu()->height() > + if (my + screen->getRootmenu()->height() + 2*borderw > screen->height()) { my = screen->height() - screen->getRootmenu()->height() - - screen->getRootmenu()->fbwindow().borderWidth(); + 2*borderw; } screen->getRootmenu()->move(mx, my); -- cgit v0.11.2