From eb11184ef04c67e7cca3383e76e2cf299b4780c1 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 20 Apr 2001 01:22:41 +0000 Subject: [PATCH] Made the menus be mapped on the center of the screen when invoked with the keyboard shortcuts. --- src/event.c | 10 ++++++---- src/rootmenu.c | 13 ++++++++++++- src/switchmenu.c | 15 +++++++++++++-- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/event.c b/src/event.c index cfb397e1..b140091e 100644 --- a/src/event.c +++ b/src/event.c @@ -1359,11 +1359,13 @@ handleKeyPress(XEvent *event) switch (command) { #ifndef LITE case WKBD_ROOTMENU: - OpenRootMenu(scr, event->xkey.x_root, event->xkey.y_root, True); - break; + /*OpenRootMenu(scr, event->xkey.x_root, event->xkey.y_root, True);*/ + OpenRootMenu(scr, scr->scr_width/2, scr->scr_height/2, True); + break; case WKBD_WINDOWLIST: - OpenSwitchMenu(scr, event->xkey.x_root, event->xkey.y_root, True); - break; + /*OpenSwitchMenu(scr, event->xkey.x_root, event->xkey.y_root, True);*/ + OpenSwitchMenu(scr, scr->scr_width/2, scr->scr_height/2, True); + break; #endif /* !LITE */ case WKBD_WINDOWMENU: if (ISMAPPED(wwin) && ISFOCUSED(wwin)) diff --git a/src/rootmenu.c b/src/rootmenu.c index 95e709dc..ce195324 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -1803,7 +1803,18 @@ OpenRootMenu(WScreen *scr, int x, int y, int keyboard) scr->root_menu = menu; } if (menu) { - wMenuMapAt(menu, x-menu->frame->core->width/2, y, keyboard); + int newx, newy; + + if (keyboard && x==0 && y==0) { + newx = newy = 0; + } else if (keyboard && x==scr->scr_width/2 && y==scr->scr_height/2) { + newx = x - menu->frame->core->width/2; + newy = y - menu->frame->core->height/2; + } else { + newx = x - menu->frame->core->width/2; + newy = y; + } + wMenuMapAt(menu, newx, newy, keyboard); } if (scr->flags.root_menu_changed_shortcuts) diff --git a/src/switchmenu.c b/src/switchmenu.c index 9640a5f0..2f109e28 100644 --- a/src/switchmenu.c +++ b/src/switchmenu.c @@ -123,10 +123,21 @@ OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard) } if (switchmenu) { + int newx, newy; + if (!switchmenu->flags.realized) wMenuRealize(switchmenu); - wMenuMapAt(switchmenu, x-switchmenu->frame->core->width/2, y, - keyboard); + + if (keyboard && x==0 && y==0) { + newx = newy = 0; + } else if (keyboard && x==scr->scr_width/2 && y==scr->scr_height/2) { + newx = x - switchmenu->frame->core->width/2; + newy = y - switchmenu->frame->core->height/2; + } else { + newx = x - switchmenu->frame->core->width/2; + newy = y; + } + wMenuMapAt(switchmenu, newx, newy, keyboard); } }