From cd1981f07970542e625c131bc41562b54df2bfbf Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 19 Aug 1999 19:58:38 +0000 Subject: [PATCH] menu patch - todo updated SVN revision: 60 --- src/TODO | 1 + src/menus.c | 34 +++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/TODO b/src/TODO index e980fbed..8f91ea1a 100644 --- a/src/TODO +++ b/src/TODO @@ -4,6 +4,7 @@ user: add submenu resistance / timeout for running across to a submenu user: add "virtual" resistance boxes user: resistance is still in effect for iconified window user: finer grained control on selecting icon display policy +kainx: translucent and group window moves if move != opaque - fix :) kainx: new tooltip stuff doesnt saccoutn for 2x extra in calculating iconbox kainx: reduce need for tooltip text to have auto gened tooltips work raster: window groups... diff --git a/src/menus.c b/src/menus.c index 5c468455..332e7ef6 100644 --- a/src/menus.c +++ b/src/menus.c @@ -280,7 +280,7 @@ void ShowMenu(Menu * m, char noshow) { EWin *ewin; - int x, y; + int x, y, wx, wy; /* wx, wy added to stop menus from appearing offscreen */ unsigned int w, h, mw, mh; EDBUG(5, "ShowMenu"); @@ -299,19 +299,43 @@ ShowMenu(Menu * m, char noshow) GetWinXY(m->items[0]->win, &x, &y); GetWinWH(m->items[0]->win, &w, &h); GetWinWH(m->win, &mw, &mh); - if ((mode.x >= 0) && (mode.y >= 0)) - EMoveWindow(disp, m->win, mode.x - x - (w / 2), mode.y - y - (h / 2)); + + if (mode.x - x -(w / 2) > root.w) + { + wx = 0 + (mw - w); + } + else if (mode.x + w > root.w) + { + wx = root.w - mw - (mw - w); + } + else + { + wx = mode.x - x -(w / 2); + } + + if (mode.y + mh > root.h) + { + wy = root.h - mh; + } + else + { + wy = mode.y - y - (h / 2); + } + + if ((mode.x >= 0) && (mode.y >= 0)) + EMoveWindow(disp, m->win, wx, wy); + else if ((mode.x >= 0) && (mode.y < 0)) { if (((-mode.y) + (int)mh) > (int)root.h) mode.y = -((-mode.y) - mode.context_h - mh); - EMoveWindow(disp, m->win, mode.x - x - (w / 2), -mode.y); + EMoveWindow(disp, m->win, wx, -mode.y); } else if ((mode.x < 0) && (mode.y >= 0)) { if (((-mode.x) + (int)mw) > (int)root.w) mode.x = -((-mode.x) - mode.context_w - mw); - EMoveWindow(disp, m->win, -mode.x, mode.y - y - (h / 2)); + EMoveWindow(disp, m->win, -mode.x, wy); } else {