diff src/menubar-msw.c @ 371:cc15677e0335 r21-2b1

Import from CVS: tag r21-2b1
author cvs
date Mon, 13 Aug 2007 11:03:08 +0200
parents a4f53d9b3154
children 6240c7796c7a
line wrap: on
line diff
--- a/src/menubar-msw.c	Mon Aug 13 11:01:58 2007 +0200
+++ b/src/menubar-msw.c	Mon Aug 13 11:03:08 2007 +0200
@@ -130,37 +130,11 @@
      and better be caught than displayed! */
   
   static char buf[MAX_MENUITEM_LENGTH+2];
-  char *ptr;
   unsigned int ll, lr;
 
   /* Left flush part of the string */
   ll = gui_item_display_flush_left (pgui_item, buf, MAX_MENUITEM_LENGTH);
 
-  /* Escape '&' as '&&' */
-  ptr = buf;
-  while ((ptr=memchr (ptr, '&', ll-(ptr-buf))) != NULL)
-    {
-      if (ll+2 >= MAX_MENUITEM_LENGTH)
-	signal_simple_error ("Menu item produces too long displayable string",
-			     pgui_item->name);
-      memmove (ptr+1, ptr, (ll-(ptr-buf))+1);
-      ll++;
-      ptr+=2;
-    }
-
-  /* Replace XEmacs accelerator '%_' with Windows accelerator '&' */
-  ptr = buf;
-  while ((ptr=memchr (ptr, '%', ll-(ptr-buf))) != NULL)
-    {
-      if (*(ptr+1) == '_')
-	{
-	  *ptr = '&';
-	  memmove (ptr+1, ptr+2, ll-(ptr-buf+2));
-	  ll--;
-	}
-      ptr++;
-    }
-
   /* Right flush part */
   assert (MAX_MENUITEM_LENGTH > ll + 1);
   lr = gui_item_display_flush_right (pgui_item, buf + ll + 1,
@@ -277,11 +251,9 @@
       HMENU submenu;
       struct gui_item gui_item;
       struct gcpro gcpro1;
-      struct gcpro ngcpro1;
 
       gui_item_init (&gui_item);
       GCPRO_GUI_ITEM (&gui_item);
-      NGCPRO1 (path);
 
       menu_parse_submenu_keywords (item, &gui_item);
 
@@ -289,11 +261,7 @@
 	signal_simple_error ("Menu name (first element) must be a string", item);
 
       if (!gui_item_included_p (&gui_item, Vmenubar_configuration))
-	{
-	  NUNGCPRO;
-	  UNGCPRO;
-	  return;
-	}
+	return;
 
       if (!gui_item_active_p (&gui_item))
 	item_info.fState = MFS_GRAYED;
@@ -325,7 +293,6 @@
 	  /* Fputhash GCPRO'es PATH */
 	  Fputhash (hmenu_to_lisp_object (submenu), path, hash_tab);
 	}
-      NUNGCPRO;
       UNGCPRO; /* gui_item */
     } 
   else if (VECTORP (item))
@@ -341,10 +308,7 @@
       gui_parse_item_keywords (item, &gui_item);
 
       if (!gui_item_included_p (&gui_item, Vmenubar_configuration))
-	{
-	  UNGCPRO;
-	  return;
-	}
+	return;
 
       if (!gui_item_active_p (&gui_item))
 	item_info.fState = MFS_GRAYED;
@@ -403,11 +367,9 @@
   struct gcpro gcpro1;
   unsigned long checksum;
   struct gui_item gui_item;
-  struct gcpro ngcpro1;
 
   gui_item_init (&gui_item);
   GCPRO_GUI_ITEM (&gui_item);
-  NGCPRO1 (desc);
 
   /* We are sometimes called with the menubar unchanged, and with changed
      right flush. We have to update the menubar in ths case,
@@ -470,7 +432,6 @@
 	  SetMenuDefaultItem (menu, 0, MF_BYPOSITION);
 	}
     }
-  NUNGCPRO;
   UNGCPRO; /* gui_item */
   return checksum;
 }
@@ -496,10 +457,6 @@
   Lisp_Object desc = (!NILP (w->menubar_visible_p)
 		      ? symbol_value_in_buffer (Qcurrent_menubar, w->buffer)
 		      : Qnil);
-  struct gcpro gcpro1;
-
-  GCPRO1 (desc); /* it's safest to do this, just in case some filter
-		    or something changes the value of current-menubar */
 
   top_level_menu = menubar;
 
@@ -510,7 +467,6 @@
       SetMenu (FRAME_MSWINDOWS_HANDLE (f), NULL);
       DestroyMenu (menubar);
       DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
-      UNGCPRO;
       return;
     }
 
@@ -524,16 +480,12 @@
   if (NILP (desc))
     {
       /* We did not have the bar and are not going to */
-      UNGCPRO;
       return;
     }
 
   /* Now we bail out if the menubar has not changed */
   if (FRAME_MSWINDOWS_MENU_CHECKSUM(f) == checksum_menu (desc))
-    {
-      UNGCPRO;
-      return;
-    }
+    return;
 
 populate:
   /* Come with empty hash table */
@@ -550,8 +502,6 @@
   DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
 
   FRAME_MSWINDOWS_MENU_CHECKSUM(f) = checksum_menu (desc);
-
-  UNGCPRO;
 }
 
 static void
@@ -559,8 +509,6 @@
 {
   HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
   Lisp_Object desc = current_frame_menubar (f);
-  struct gcpro gcpro1;
-
   if (menubar == NULL)
     return;
 
@@ -572,7 +520,6 @@
     /* abort(); */
     return;
 
-  GCPRO1 (desc); /* just to be safe -- see above */
   /* We do the trick by removing all items and re-populating top level */
   empty_menu (menubar, 0);
 
@@ -583,7 +530,6 @@
 	    FRAME_MSWINDOWS_MENU_HASHTABLE(f));
   populate_menu (menubar, Qnil, desc, 
 		 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
-  UNGCPRO;
 }
 
 /*
@@ -764,9 +710,6 @@
   HMENU menu;
   POINT pt;
   int ok;
-  struct gcpro gcpro1;
-
-  GCPRO1 (menu_desc); /* to be safe -- see above */
 
   if (!NILP (event))
     {
@@ -827,7 +770,6 @@
     signal_simple_error ("Cannot track popup menu while in menu",
 			 menu_desc);
   }
-  UNGCPRO;
 }