From a722c163f7dd7f7d2bb73e14f29906805c0e7841 Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Thu, 10 May 2001 06:06:08 +0000 Subject: [PATCH] Wed May 9 23:03:20 PDT 2001 Michael Jennings Fixed the handling of menus larger than the screen, an issue noted by Laurence J. Lane . While I was at it, I also made the pointer move along with the menu when a move is necessary. SVN revision: 4752 --- ChangeLog | 7 +++++++ src/menus.c | 25 ++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1d97b9a..a2c76ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4133,3 +4133,10 @@ Wed May 9 17:18:11 PDT 2001 Michael Jennings files as pointed out by Laurence J. Lane . ------------------------------------------------------------------------------- +Wed May 9 23:03:20 PDT 2001 Michael Jennings + + Fixed the handling of menus larger than the screen, an issue noted by + Laurence J. Lane . While I was at it, I also made + the pointer move along with the menu when a move is necessary. + +------------------------------------------------------------------------------- diff --git a/src/menus.c b/src/menus.c index 4c0a82c..1833d3d 100644 --- a/src/menus.c +++ b/src/menus.c @@ -1013,11 +1013,17 @@ menu_draw(menu_t *menu) if (dx >= 0) { dx = 0; + } else if (menu->w > scr->width) { + dx = -menu->x; + menu->x = 0; } else { menu->x = scr->width - menu->w; } if (dy >= 0) { dy = 0; + } else if (menu->h > scr->height) { + dy = -menu->y; + menu->y = 0; } else { menu->y = scr->height - menu->h; } @@ -1030,7 +1036,24 @@ menu_draw(menu_t *menu) } D_MENU((" -> Checking menu \"%s\" to see if it needs to be moved.\n", tmp->title)); if (tmp->state & MENU_STATE_IS_MAPPED) { - menu_move(tmp, tmp->x + dx, tmp->y + dy); + int x = tmp->x + dx, y = tmp->y + dy; + int this_dx, this_dy; + + if (x < 0) { + x = 0; + this_dx = -tmp->x; + } else { + this_dx = dx; + } + if (y < 0) { + y = 0; + this_dy = -tmp->y; + } else { + this_dy = 0; + } + D_MENU((" -> Moving menu to %d, %d (a change of %d, %d from %d, %d)\n", x, y, this_dx, this_dy, tmp->x, tmp->y)); + XWarpPointer(Xdisplay, tmp->win, None, 0, 0, tmp->w, tmp->h, this_dx, this_dy); + menu_move(tmp, x, y); } } }