*** ChangeLog.orig	Sat Oct 18 14:42:28 2003
--- ChangeLog	Sat Oct 18 14:20:41 2003
***************
*** 1,3 ****
--- 1,11 ----
+ 2003-10-18  Dan Espen  <dane@mk.telcordia.com>
+ 
+ 	* fvwm/menus.c (__mloop_handle_event): Really crude ability to disable button
+ 	2 tearoff.
+ 	* libs/wcontext.h (enum): Add MENU context.
+ 	* libs/wcontext.c (win_contexts): More common binding contexts first in table.
+ 	* libs/charmap.c (charmap_string_to_mask): Space before char in error message.
+ 
  2003-10-15  Mikhael Goikhman  <migo@homemail.com>
  
  	* configure.in:
*** fvwm/bindings.c.orig	Sat Oct 18 14:42:29 2003
--- fvwm/bindings.c	Sat Oct 18 09:17:56 2003
***************
*** 34,39 ****
--- 34,40 ----
  #include "misc.h"
  #include "screen.h"
  #include "focus.h"
+ #include "menus.h"		/* for menu_binding */
  #ifdef HAVE_STROKE
  #include "stroke.h"
  #endif /* HAVE_STROKE */
***************
*** 425,430 ****
--- 426,436 ----
  		is_unbind_request = True;
  	}
  
+ 	/* short circuit menu bindings for now. */
+ 	if (context == C_MENU)
+ 	{
+ 		return(menu_binding(button,keysym,modifier,action));
+ 	}
  	/*
  	** Remove the "old" bindings if any
  	*/
*** fvwm/menus.c.orig	Sat Oct 18 14:42:31 2003
--- fvwm/menus.c	Sat Oct 18 14:44:30 2003
***************
*** 210,215 ****
--- 210,217 ----
  	{ 0, 0, 0.0, 0.0, 0, 0, False, False, False, False }
  };
  
+ static int menu_tear_button = 2;
+ 
  /* structures for menus */
  static MenuInfo Menus;
  
***************
*** 4656,4662 ****
  		}
  		if (med->mi != NULL)
  		{
! 			if ((*pmp->pexc)->x.elast->xbutton.button == 2 &&
  			    MI_IS_TITLE(med->mi))
  			{
  				pmret->rc = MENU_TEAR_OFF;
--- 4658,4664 ----
  		}
  		if (med->mi != NULL)
  		{
! 			if ((*pmp->pexc)->x.elast->xbutton.button == menu_tear_button &&
  			    MI_IS_TITLE(med->mi))
  			{
  				pmret->rc = MENU_TEAR_OFF;
***************
*** 7983,7985 ****
--- 7985,8025 ----
  	return;
  }
  #endif
+ 
+ int menu_binding(int button,KeySym keysym,int modifier,char *action)
+ {
+ 	fprintf(stderr,"Entered menu_binding, button %d, keysym %X,"
+ 		" modifier %X, action %s\n",button,(int)keysym,modifier,action);
+ 	if (keysym != 0)
+ 	{
+ 		/* fixme */
+ 		fvwm_msg(ERR, "menu_binding",
+ 			 "sorry, menu keybindings not allowed. yet.");
+ 		return 1;
+ 	}
+ 	if (modifier != 0)
+ 	{
+ 		/* fixme */
+ 		fvwm_msg(ERR, "menu_binding",
+ 			 "sorry, menu binding modifiers not allowed. yet.");
+ 		return 1;
+ 	}
+ 	if (strcmp(action,"-") == 0)
+ 	{
+ 		if (keysym == 0) /* must be button binding */
+ 		{
+ 			menu_tear_button=-1;
+ 		}
+ 	} else if (strcasecmp(action,"tearoff") == 0)
+ 	{
+ 		if (keysym == 0) /* must be button binding */
+ 		{
+ 			menu_tear_button=button;
+ 		}
+ 	} else {
+ 		fvwm_msg(ERR, "menu_binding",
+ 			 "invalid action, only tearoff or - allowed");
+ 	}
+ 	
+ 	return 0;
+ }
*** fvwm/menus.h.orig	Sat Oct 18 14:42:32 2003
--- fvwm/menus.h	Sat Oct 18 09:17:56 2003
***************
*** 352,356 ****
  	MenuRepaintTransparentParameters *prtmp,
  	Bool first, int x, int y, int end_x, int end_y);
  void menu_expose(XEvent *event, FvwmWindow *fw);
! 
  #endif /* _MENUS_ */
--- 352,356 ----
  	MenuRepaintTransparentParameters *prtmp,
  	Bool first, int x, int y, int end_x, int end_y);
  void menu_expose(XEvent *event, FvwmWindow *fw);
! int menu_binding(int button,KeySym keysym,int modifier,char *action);
  #endif /* _MENUS_ */
*** libs/charmap.c.orig	Sat Oct 18 14:42:33 2003
--- libs/charmap.c	Sat Oct 18 08:47:10 2003
***************
*** 75,80 ****
--- 75,81 ----
  			{
  				fputs(errstring, stderr);
  			}
+ 			fputc(' ', stderr);
  			fputc(c, stderr);
  			fputc('\n', stderr);
  			error = 1;
*** libs/wcontext.c.orig	Sat Oct 18 14:42:34 2003
--- libs/wcontext.c	Sat Oct 18 08:59:57 2003
***************
*** 38,61 ****
  
  /* ---------------------------- exported variables (globals) --------------- */
  
! /* The keys must be in lower case! */
  charmap_t win_contexts[] =
  {
- 	{'d', C_EWMH_DESKTOP},
- 	{'f', C_FRAME},
- 	{'<', C_F_TOPLEFT},
- 	{'^', C_F_TOPRIGHT},
- 	{'>', C_F_BOTTOMRIGHT},
- 	{'v', C_F_BOTTOMLEFT},
- 	{'i', C_ICON},
  	{'r', C_ROOT},
- 	{'s', C_SIDEBAR},
- 	{'[', C_SB_LEFT},
- 	{']', C_SB_RIGHT},
- 	{'-', C_SB_TOP},
- 	{'_', C_SB_BOTTOM},
  	{'t', C_TITLE},
  	{'w', C_WINDOW},
  	{'1', C_L1},
  	{'2', C_R1},
  	{'3', C_L2},
--- 38,53 ----
  
  /* ---------------------------- exported variables (globals) --------------- */
  
! /* The keys must be in lower case!
!    Put more common contexts toward the front. */
  charmap_t win_contexts[] =
  {
  	{'r', C_ROOT},
  	{'t', C_TITLE},
  	{'w', C_WINDOW},
+ 	{'f', C_FRAME},
+ 	{'i', C_ICON},
+ 	{'a', C_ALL},
  	{'1', C_L1},
  	{'2', C_R1},
  	{'3', C_L2},
***************
*** 66,72 ****
  	{'8', C_R4},
  	{'9', C_L5},
  	{'0', C_R5},
! 	{'a', C_ALL},
  	{0, 0}
  };
  
--- 58,74 ----
  	{'8', C_R4},
  	{'9', C_L5},
  	{'0', C_R5},
! 	{'d', C_EWMH_DESKTOP},
! 	{'<', C_F_TOPLEFT},
! 	{'^', C_F_TOPRIGHT},
! 	{'>', C_F_BOTTOMRIGHT},
! 	{'v', C_F_BOTTOMLEFT},
! 	{'s', C_SIDEBAR},
! 	{'[', C_SB_LEFT},
! 	{']', C_SB_RIGHT},
! 	{'-', C_SB_TOP},
! 	{'_', C_SB_BOTTOM},
! 	{'m', C_MENU},
  	{0, 0}
  };
  
*** libs/wcontext.h.orig	Sat Oct 18 14:42:35 2003
--- libs/wcontext.h	Sat Oct 18 09:00:29 2003
***************
*** 19,25 ****
  	C_TITLE = 0x02,
  	C_ICON = 0x04,
  	C_ROOT = 0x08,
! 	/* C_ = 0x10, */
  	/* C_ = 0x20, */
  	C_L1 = 0x40,
  	C_R1 = 0x80,
--- 19,25 ----
  	C_TITLE = 0x02,
  	C_ICON = 0x04,
  	C_ROOT = 0x08,
! 	C_MENU = 0x10,
  	/* C_ = 0x20, */
  	C_L1 = 0x40,
  	C_R1 = 0x80,
