minor menu positioning tweaks

This commit is contained in:
rathnor 2003-10-06 09:55:36 +00:00
parent e5dd3d2e85
commit 29a69a69c1
2 changed files with 18 additions and 17 deletions

View file

@ -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;
}

View file

@ -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);