merge trunk
[bpt/emacs.git] / src / nsmenu.m
index 02c5f9e..baa6839 100644 (file)
@@ -119,7 +119,6 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
   id menu = [NSApp mainMenu];
   static EmacsMenu *last_submenu = nil;
   BOOL needsSet = NO;
-  const char *submenuTitle = [[submenu title] UTF8String];
   bool owfi;
   Lisp_Object items;
   widget_value *wv, *first_wv, *prev_wv = 0;
@@ -239,7 +238,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
           /* FIXME: we'd like to only parse the needed submenu, but this
                was causing crashes in the _common parsing code.. need to make
                sure proper initialization done.. */
-/*        if (submenu && strcmp (submenuTitle, SSDATA (string)))
+/*        if (submenu && strcmp ([[submenu title] UTF8String], SSDATA (string)))
              continue; */
 
          submenu_start[i] = menu_items_used;
@@ -259,7 +258,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
         {
           /* should have found a menu for this one but didn't */
           fprintf (stderr, "ERROR: did not find lisp menu for submenu '%s'.\n",
-                  submenuTitle);
+                  [[submenu title] UTF8String]);
          discard_menu_items ();
          unbind_to (specpdl_count, Qnil);
           [pool release];
@@ -346,8 +345,6 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
          string = AREF (items, i + 1);
          if (NILP (string))
            break;
-/*           if (submenu && strcmp (submenuTitle, SSDATA (string)))
-               continue; */
 
          wv->name = SSDATA (string);
           update_submenu_strings (wv->contents);
@@ -358,6 +355,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
          create a new menu for each sub and fill it. */
       if (submenu)
         {
+          const char *submenuTitle = [[submenu title] UTF8String];
           for (wv = first_wv->contents; wv; wv = wv->next)
             {
               if (!strcmp (submenuTitle, wv->name))
@@ -508,7 +506,7 @@ void
 x_activate_menubar (struct frame *f)
 {
   NSArray *a = [[NSApp mainMenu] itemArray];
-  /* Update each submenu separatly so ns_update_menubar don't reset
+  /* Update each submenu separately so ns_update_menubar doesn't reset
      the delegate.  */
   int i = 0;
   while (i < [a count])
@@ -1328,6 +1326,7 @@ update_frame_tool_bar (FRAME_PTR f)
   wr.size = [textField frame].size;
 
   [win setFrame: wr display: YES];
+  [win setLevel: NSPopUpMenuWindowLevel];
   [win orderFront: self];
   [win display];
   timer = [NSTimer scheduledTimerWithTimeInterval: (float)seconds target: self
@@ -1408,8 +1407,6 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
 
   NSTRACE (x-popup-dialog);
 
-  check_ns ();
-
   isQ = NILP (header);
 
   if (EQ (position, Qt)
@@ -1447,6 +1444,8 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
   else
     CHECK_WINDOW (window);
 
+  check_window_system (f);
+
   p.x = (int)f->left_pos + ((int)FRAME_COLUMN_WIDTH (f) * f->text_cols)/2;
   p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2;