FVWM: mwm overlapping menus

From: Dan Espen <dane_at_bae.bellcore.com>
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
dane_at_bae.bellcore.com
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 majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Mon Mar 11 1996 - 09:24:51 GMT

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:37:58 BST