emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xfns.c [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/xfns.c [emacs-unicode-2]
Date: Fri, 19 Nov 2004 02:16:20 -0500

Index: emacs/src/xfns.c
diff -c emacs/src/xfns.c:1.590.2.12 emacs/src/xfns.c:1.590.2.13
*** emacs/src/xfns.c:1.590.2.12 Fri Nov 12 02:52:56 2004
--- emacs/src/xfns.c    Fri Nov 19 06:54:58 2004
***************
*** 5089,5094 ****
--- 5089,5111 ----
    *result = XmCR_CANCEL;
  }
  
+ static Lisp_Object
+ clean_up_file_dialog (arg)
+      Lisp_Object arg;
+ {
+   struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+   Widget dialog = (Widget) p->pointer;
+ 
+   /* Clean up.  */
+   BLOCK_INPUT;
+   XtUnmanageChild (dialog);
+   XtDestroyWidget (dialog);
+   x_menu_set_in_use (0);
+   UNBLOCK_INPUT;
+ 
+   return Qnil;
+ }
+ 
  
  DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
         doc: /* Read file name, prompting with PROMPT in directory DIR.
***************
*** 5110,5115 ****
--- 5127,5136 ----
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
  
    GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
+ 
+   if (popup_activated ())
+     error ("Trying to use a menu from within a menu-entry");
+ 
    CHECK_STRING (prompt);
    CHECK_STRING (dir);
  
***************
*** 5192,5204 ****
        XmStringFree (default_xmstring);
      }
  
    /* Process events until the user presses Cancel or OK.  */
    result = 0;
    while (result == 0)
      {
        XEvent event;
        XtAppNextEvent (Xt_app_con, &event);
!       (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f) );
      }
  
    /* Get the result.  */
--- 5213,5229 ----
        XmStringFree (default_xmstring);
      }
  
+   record_unwind_protect (clean_up_file_dialog, make_save_value (dialog, 0));
+ 
    /* Process events until the user presses Cancel or OK.  */
+   x_menu_set_in_use (1);
    result = 0;
    while (result == 0)
      {
        XEvent event;
+       x_menu_wait_for_event (0);
        XtAppNextEvent (Xt_app_con, &event);
!       (void) x_dispatch_event (&event, FRAME_X_DISPLAY (f));
      }
  
    /* Get the result.  */
***************
*** 5216,5224 ****
    else
      file = Qnil;
  
-   /* Clean up.  */
-   XtUnmanageChild (dialog);
-   XtDestroyWidget (dialog);
    UNBLOCK_INPUT;
    UNGCPRO;
  
--- 5241,5246 ----
***************
*** 5233,5238 ****
--- 5255,5269 ----
  
  #ifdef USE_GTK
  
+ static Lisp_Object
+ clean_up_dialog (arg)
+      Lisp_Object arg;
+ {
+   x_menu_set_in_use (0);
+ 
+   return Qnil;
+ }
+ 
  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
***************
*** 5245,5260 ****
    FRAME_PTR f = SELECTED_FRAME ();
    char *fn;
    Lisp_Object file = Qnil;
!   int count = specpdl_ptr - specpdl;
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
    char *cdef_file;
  
    GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
    CHECK_STRING (prompt);
    CHECK_STRING (dir);
  
    /* Prevent redisplay.  */
    specbind (Qinhibit_redisplay, Qt);
  
    BLOCK_INPUT;
  
--- 5276,5296 ----
    FRAME_PTR f = SELECTED_FRAME ();
    char *fn;
    Lisp_Object file = Qnil;
!   int count = SPECPDL_INDEX ();
    struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
    char *cdef_file;
  
    GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file);
+ 
+   if (popup_activated ())
+     error ("Trying to use a menu from within a menu-entry");
+ 
    CHECK_STRING (prompt);
    CHECK_STRING (dir);
  
    /* Prevent redisplay.  */
    specbind (Qinhibit_redisplay, Qt);
+   record_unwind_protect (clean_up_dialog, Qnil);
  
    BLOCK_INPUT;
  




reply via email to

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