Subject: FVWM: mwm overlapping menus

From: Dan Espen <[email-masked]>
Date: Mon, 11 Mar 1996 10:24:37 -0500

----------

If you  use "mwm" menus, and you  pop them up  too  close to the right
hand edge of the screen, you may find that a submenu pops up obscuring
the parent  menu, making it  impossible to  select something else from
the parent menu.

Enclosed is a patch to 2.0.41 that fixes the problem. The patch causes
sub-menus  to pop up on the   right until the right   hand edge of the
screen is hit, then submenus start popping up on the left.

*** menus.c.orig	Mon Mar 11 10:04:04 1996
--- menus.c	Mon Mar 11 10:07:48 1996
***************
*** 714,719 ****
--- 714,721 ----
   *      center	- whether or not to center horizontally over position
   *
   ***********************************************************************/
+ static int leftmost;
+ static int last_went_left;
  Bool PopUpMenu (MenuRoot *menu, int x, int y)
  {
  
***************
*** 757,766 ****
      }
  
    /* clip to screen */
!   if (x + menu->width > Scr.MyDisplayWidth-2) 
!     x = Scr.MyDisplayWidth - menu->width-2;
    if (x < 0) x = 0;
! 
    if (y + menu->height > Scr.MyDisplayHeight-2) 
      {
        y = Scr.MyDisplayHeight - menu->height-2;
--- 759,784 ----
      }
  
    /* clip to screen */
!   last_went_left = 0;                   /* init last direction */
!   if (x + menu->width > Scr.MyDisplayWidth-2) {
!     if (!(Scr.flags & MWMMenus)) {      /* if NOT fvwm menus */
!       x = Scr.MyDisplayWidth - menu->width-2;
!     } else {                            /* fvwm menus */
!       if (menu_on < 2 ) {               /* if first menu up */
!         x = Scr.MyDisplayWidth - menu->width-2;
!       } else {
!         /* Place submenu to the left of the leftmost menu. */
!         /* Note, leftmost may be negative, fixed below */
!         leftmost -= ActiveMenu->width;  /* shift to left of leftmost menu */
!         x=leftmost;                     /* Move screen to new x */
!         last_went_left = 1;             /* remember last direction */
!       }                                 /* end not first mwm menu */
!     }                                   /* end mwm menu */
!   }                                     /* end screen needs clipping */
    if (x < 0) x = 0;
!   if (menu_on < 2) {                    /* if first menu up */
!     leftmost=x;                         /* reset new leftmost menu */
!   }
    if (y + menu->height > Scr.MyDisplayHeight-2) 
      {
        y = Scr.MyDisplayHeight - menu->height-2;
***************
*** 792,798 ****
  {
    if (ActiveMenu == NULL)
      return;
!   
    menu_on--;
    if (ActiveItem)
      ActiveItem->state = 0;
--- 810,820 ----
  {
    if (ActiveMenu == NULL)
      return;
! 
!   /* mwm menu can popup to left, track its location */
!   if (last_went_left) {
!     leftmost += ActiveMenu->width;      /* come back to right */
!   }
    menu_on--;
    if (ActiveItem)
      ActiveItem->state = 0;

--
Dan Espen                                    Phone: (908) 699-5570
[email-masked]
444 Hoes Lane  Room RRC 1C-214
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Chris Taylor <[email-masked]>
Date: Mon, 11 Mar 1996 14:08:09 -0500 (EST)

> The patch causes sub-menus to pop up on the right until the right hand
> edge of the screen is hit, then submenus start popping up on the left.

I like it! I've wanted this for some time.

But... a small bug.

First, my setup: SparcStation 5, SunOS 4.1.4, Fvwm 2.0.41.

It's true that, when there's no room on the right, submenus appear on the left.
The problem is that the new menus appear to the left of *all* the menus. You
get an arrangement like this:

    menu4 MENU> menu2> menu3> edge-of-screen

This means that I can't reach menu4. Menu4 will stay posted if I move the
pointer over the submenu arrow from menu3, but that makes the feature difficult
to use.

I would guess that, when posting menus toward the left, fvwm should ignore
previous menus posted toward the right. Conceivably this should also hold true
when switching from left to right as well, but it would take a *lot* of
submenus to get that far.

Chris Taylor     / My views do not represent \ PGP public key available
[email-masked] \    those of Cabletron.    / via keyserver or request

---

From: Dan Espen <[email-masked]>
Date: Mon, 11 Mar 1996 15:29:50 -0500

----------
> I like it! I've wanted this for some time.

Glad you like it.

> It's true that, when there's no room on the right,
> submenus appear on the left,
> pointer over the submenu arrow from menu3, but that makes the feature
> difficult to use.
> 
> previous menus posted toward the right. Conceivably this should also hold
> true when switching from left to right as well, but it would take a *lot* of

If I didn't place the leftward menus to the left of all menus, I would
create  the same problem I  was trying to  fix, Ie. obscuring menus so
that they can't be popped down.

If you can manage to go off menu3 to  the right, you can circle around
all the menus and get into menu4.  Since  the new logic avoids putting
menus flush against the right, there  should always be  room to go off
the right.

I am not  sure you can  ignore the  previous menus  to the right,  you
could be moving to the right to pop down a menu.

---

From: "Alan Wild" <[email-masked]>
Date: Mon, 11 Mar 1996 13:36:04 -0800 (PST)

> that they can't be popped down.

I would have to disagree here.  Although I am glad someone is looking
into this, I hate excessive mouse motions.

I feel like MwmMenus needs to behave more like mwm anyway.  When you
click on the title of a pull down, that pull down should remian active
until you kill it, or you explicitly click on another option.

Essentially, I want click-to-focus for pull-down menus.  I also want my
menus to pop up in the immediate vicinity that way I don't have to move
my mouse all over the place.  i.e.

	menu1
		menu2
			menu3
		menu4

What do others think?  

I like this methodology, becasue I feel like the less I move the mouse,
the better.  I don't want to have to move my mouse randomly around the
screen in a vain attempt to click on something.

What's really aggrivating is when I open a second popup and I
accidentally pass my mouse over the title of a seperate option and I
could a new menu.  i.e.

	main
	stuff
	applications
	programming

original state.

	main
	stuff		stuff
	applications	stuff
	programming	stuff
			stuff
			stuff
			stuff

"stuff" open

	main
	stuff
	applications	applications
	programming	applications
			applications
			applications
			
after accidentally passing my mouse over "applications".

This is an incredibly difficult concept to demonstrate in ASCII, but I
feel like it's important enough that someone should look at it.

I really wish I had the time, but I'm afraid I have other projects
forthcoming.  :(

-Alan 
-- 
Alan Wild
Intel SET-CA Software Validation Group
Office Phone:	(503)677-4538
[email-masked]
f/s/c  [email-masked]
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].