emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/nsmenu.m,v


From: Adrian Robert
Subject: [Emacs-diffs] Changes to emacs/src/nsmenu.m,v
Date: Mon, 04 Aug 2008 16:57:45 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Adrian Robert <arobert> 08/08/04 16:57:44

Index: nsmenu.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsmenu.m,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- nsmenu.m    1 Aug 2008 14:01:07 -0000       1.8
+++ nsmenu.m    4 Aug 2008 16:57:43 -0000       1.9
@@ -65,6 +65,9 @@
 extern long context_menu_value;
 EmacsMenu *mainMenu, *svcsMenu;
 
+/* Nonzero means a menu is currently active.  */
+static int popup_activated_flag;
+
 /* NOTE: toolbar implementation is at end,
   following complete menu implementation. */
 
@@ -94,6 +97,13 @@
 }
 
 
+int
+popup_activated ()
+{
+  return popup_activated_flag;
+}
+
+
 /* --------------------------------------------------------------------------
     Update menubar.  Three cases:
     1) deep_p = 0, submenu = nil: Fresh switch onto a frame -- either set up
@@ -592,6 +602,7 @@
   return [NSString stringWithFormat: @"%c", tpos[2]];
 }
 
+
 - (NSMenuItem *)addItemWithWidgetValue: (void *)wvptr
 {
   NSMenuItem *item;
@@ -1117,10 +1128,13 @@
   free_menubar_widget_value_tree (first_wv);
   unbind_to (specpdl_count2, Qnil);
 
+  popup_activated_flag = 1;
   tem = [pmenu runMenuAt: p forFrame: f keymaps: keymaps];
+  popup_activated_flag = 0;
   [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
 
   UNBLOCK_INPUT;
+  discard_menu_items ();
   unbind_to (specpdl_count, Qnil);
   UNGCPRO;
 
@@ -1511,8 +1525,9 @@
   p.y = (int)f->top_pos + (FRAME_LINE_HEIGHT (f) * f->text_lines)/2;
   dialog = [[EmacsDialogPanel alloc] initFromContents: contents
                                            isQuestion: isQ];
-
+  popup_activated_flag = 1;
   tem = [dialog runDialogAt: p];
+  popup_activated_flag = 0;
 
   [dialog close];
 
@@ -1934,6 +1949,12 @@
   return ns_popup_dialog (position, contents, header);
 }
 
+DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, 
Smenu_or_popup_active_p, 0, 0, 0,
+       doc: /* Return t if a menu or popup dialog is active.  */)
+     ()
+{
+  return popup_activated () ? Qt : Qnil;
+}
 
 /* ==========================================================================
 
@@ -1947,6 +1968,7 @@
   defsubr (&Sx_popup_menu);
   defsubr (&Sx_popup_dialog);
   defsubr (&Sns_reset_menu);
+  defsubr (&Smenu_or_popup_active_p);
   staticpro (&menu_items);
   menu_items = Qnil;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]