summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-01-22 02:04:17 +0000
committerRichard M. Stallman <rms@gnu.org>1997-01-22 02:04:17 +0000
commit2ea5c799c036a3676a53db950f4baa5760218391 (patch)
treeb96f998e4eac612240e7b651ba31c962039c3cf5 /lwlib
parente310b6959599eca8db6512ba633b5b93c5d60769 (diff)
downloademacs-2ea5c799c036a3676a53db950f4baa5760218391.tar.gz
(enriched-translations): Add top' and choice' everywhere so that *
can be entered. (custom-face-attributes): Don't use top-line'. (mode-line-format): Replace (:eval mode-line-mode-name)'. (mode-line-mode-name): New. (make-mode-line-mouse-sensitive): Don't change default value of x' are found before files starting with down_p'.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/xlwmenu.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 24e80e23edc..1e2c3103ac5 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -781,6 +781,9 @@ fit_to_screen (mw, ws, previous_ws, horizontal_p)
{
unsigned int screen_width = WidthOfScreen (XtScreen (mw));
unsigned int screen_height = HeightOfScreen (XtScreen (mw));
+ /* 1 if we are unable to avoid an overlap between
+ this menu and the parent menu in the X dimension. */
+ int horizontal_overlap = 0;
if (ws->x < 0)
ws->x = 0;
@@ -791,8 +794,24 @@ fit_to_screen (mw, ws, previous_ws, horizontal_p)
else
ws->x = screen_width - ws->width;
if (ws->x < 0)
- ws->x = 0;
+ {
+ ws->x = 0;
+ horizontal_overlap = 1;
+ }
+ }
+ /* If we overlap in X, try to avoid overlap in Y. */
+ if (horizontal_overlap
+ && ws->y < previous_ws->y + previous_ws->height
+ && previous_ws->y < ws->y + ws->height)
+ {
+ /* Put this menu right below or right above PREVIOUS_WS
+ if there's room. */
+ if (previous_ws->y + previous_ws->height + ws->height < screen_height)
+ ws->y = previous_ws->y + previous_ws->height;
+ else if (previous_ws->y - ws->height > 0)
+ ws->y = previous_ws->y - ws->height;
}
+
if (ws->y < 0)
ws->y = 0;
else if (ws->y + ws->height > screen_height)
@@ -855,18 +874,18 @@ remap_menubar (mw)
display_menu (mw, last_same, new_selection == old_selection,
&selection_position, NULL, NULL, old_selection, new_selection);
- /* Now popup the new menus */
- for (i = last_same + 1; i < new_depth && new_stack [i]->contents; i++)
+ /* Now place the new menus. */
+ for (i = last_same + 1; i < new_depth && new_stack[i]->contents; i++)
{
- window_state* previous_ws = &windows [i - 1];
- window_state* ws = &windows [i];
+ window_state *previous_ws = &windows[i - 1];
+ window_state *ws = &windows[i];
- ws->x =
- previous_ws->x + selection_position.x + mw->menu.shadow_thickness;
+ ws->x
+ = previous_ws->x + selection_position.x + mw->menu.shadow_thickness;
if (!mw->menu.horizontal || i > 1)
ws->x += mw->menu.shadow_thickness;
- ws->y =
- previous_ws->y + selection_position.y + mw->menu.shadow_thickness;
+ ws->y
+ = previous_ws->y + selection_position.y + mw->menu.shadow_thickness;
size_menu (mw, i);
@@ -881,8 +900,8 @@ remap_menubar (mw)
/* unmap the menus that popped down */
for (i = new_depth - 1; i < old_depth; i++)
- if (i >= new_depth || !new_stack [i]->contents)
- XUnmapWindow (XtDisplay (mw), windows [i].window);
+ if (i >= new_depth || !new_stack[i]->contents)
+ XUnmapWindow (XtDisplay (mw), windows[i].window);
}
static Boolean