]> git.eshelyaron.com Git - emacs.git/commitdiff
use pgtk_menu_set_in_use.
authorYuuki Harano <masm+github@masm11.me>
Sun, 5 Apr 2020 10:23:10 +0000 (19:23 +0900)
committerJeff Walsh <jeff.walsh@drtusers-MacBook-Pro.local>
Tue, 24 Nov 2020 01:24:39 +0000 (12:24 +1100)
* ../src/pgtkfns.c:
(Fx_file_dialog, clean_up_dialog):

* src/pgtkmenu.c (pgtk_menu_wait_for_event):

src/pgtkfns.c
src/pgtkmenu.c
src/pgtkterm.h

index 69a7430b8d34498282fe720bd3b8a8bc58e34342..b7d34d56803bb114aa8807d8739ec12dc5b59a87 100644 (file)
@@ -2916,6 +2916,12 @@ visible.  */)
   return Qnil;
 }
 
+static void
+clean_up_dialog (void)
+{
+  pgtk_menu_set_in_use (false);
+}
+
 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
        doc: /* Read file name, prompting with PROMPT in directory DIR.
 Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
@@ -2940,14 +2946,17 @@ value of DIR as in previous invocations; this is standard MS Windows behavior.
 
   check_window_system (f);
 
+  if (popup_activated ())
+    error ("Trying to use a menu from within a menu-entry");
+  else
+    pgtk_menu_set_in_use (true);
+
   CHECK_STRING (prompt);
   CHECK_STRING (dir);
 
   /* Prevent redisplay.  */
   specbind (Qinhibit_redisplay, Qt);
-#if 0
   record_unwind_protect_void (clean_up_dialog);
-#endif
 
   block_input ();
 
index b9462208d66e09178958bb93111faf7d81845ba5..6f4195d6d8ae7f58f753fcb391c6a3428ef257c1 100644 (file)
@@ -69,7 +69,7 @@ pgtk_menu_set_in_use (bool in_use)
 
 /* Wait for an X event to arrive or for a timer to expire.  */
 
-void
+static void
 pgtk_menu_wait_for_event (void *data)
 {
   struct timespec next_time = timer_check (), *ntp;
index 73e04b7da6770b050b9bae0abf35cc51323cb8d1..e74031843938cb7ee53a42107ed1e0b254000381 100644 (file)
@@ -610,6 +610,9 @@ extern struct pgtk_display_info *check_pgtk_display_info (Lisp_Object object);
 
 extern void pgtk_default_font_parameter (struct frame *f, Lisp_Object parms);
 
+extern void pgtk_menu_set_in_use (bool in_use);
+
+
 extern void pgtk_enqueue_string(struct frame *f, gchar *str);
 extern void pgtk_enqueue_preedit(struct frame *f, Lisp_Object image_data);
 extern void pgtk_im_focus_in(struct frame *f);