emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xmenu.c


From: Jan Djärv
Subject: [Emacs-diffs] Changes to emacs/src/xmenu.c
Date: Sun, 14 Nov 2004 06:02:42 -0500

Index: emacs/src/xmenu.c
diff -c emacs/src/xmenu.c:1.269 emacs/src/xmenu.c:1.270
*** emacs/src/xmenu.c:1.269     Sat Nov 13 23:29:11 2004
--- emacs/src/xmenu.c   Sun Nov 14 10:55:45 2004
***************
*** 2427,2446 ****
    if (cb_data) menu_item_selection = (Lisp_Object *) cb_data->call_data;
  }
  
- static GtkWidget *current_menu;
- 
  static Lisp_Object
! pop_down_menu (dummy)
!      Lisp_Object dummy;
  {
    popup_activated_flag = 0;
!   if (current_menu)
!     {
!       BLOCK_INPUT;
!       gtk_widget_destroy (current_menu);
!       UNBLOCK_INPUT;
!       current_menu = 0;
!     }
    return Qnil;
  }
  
--- 2427,2442 ----
    if (cb_data) menu_item_selection = (Lisp_Object *) cb_data->call_data;
  }
  
  static Lisp_Object
! pop_down_menu (arg)
!      Lisp_Object arg;
  {
+   struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
+ 
    popup_activated_flag = 0;
!   BLOCK_INPUT;
!   gtk_widget_destroy (GTK_WIDGET (p->pointer));
!   UNBLOCK_INPUT;
    return Qnil;
  }
  
***************
*** 2490,2497 ****
    gtk_widget_show_all (menu);
    gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
  
!   current_menu = menu;
!   record_unwind_protect (pop_down_menu, Qnil);
  
    /* Set this to one.  popup_widget_loop increases it by one, so it becomes
       two.  show_help_echo uses this to detect popup menus.  */
--- 2486,2493 ----
    gtk_widget_show_all (menu);
    gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0);
  
!   fprintf (stderr, "Unwind: %p\n", menu);
!   record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
  
    /* Set this to one.  popup_widget_loop increases it by one, so it becomes
       two.  show_help_echo uses this to detect popup menus.  */
***************
*** 2925,2932 ****
    if (menu)
      {
        int specpdl_count = SPECPDL_INDEX ();
!       current_menu = menu;
!       record_unwind_protect (pop_down_menu, Qnil);
  
        /* Display the menu.  */
        gtk_widget_show_all (menu);
--- 2921,2927 ----
    if (menu)
      {
        int specpdl_count = SPECPDL_INDEX ();
!       record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
  
        /* Display the menu.  */
        gtk_widget_show_all (menu);
***************
*** 3217,3240 ****
                  Qnil, menu_object, make_number (item), 1);
  }
  
- static XMenu *current_menu;
- 
  static Lisp_Object
! pop_down_menu (frame)
!      Lisp_Object frame;
  {
!   struct frame *f = XFRAME (frame);
  
    BLOCK_INPUT;
-   if (current_menu)
-     {
  #ifndef MSDOS
!       XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime);
!       XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime);
  #endif
!       XMenuDestroy (FRAME_X_DISPLAY (f), current_menu);
!       current_menu = 0;
!     }
  
  #ifdef HAVE_X_WINDOWS
    /* Assume the mouse has moved out of the X window.
--- 3212,3233 ----
                  Qnil, menu_object, make_number (item), 1);
  }
  
  static Lisp_Object
! pop_down_menu (arg)
!      Lisp_Object arg;
  {
!   struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg));
!   struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg));
!   
!   FRAME_PTR f = p1->pointer;
!   XMenu *menu = p2->pointer;
  
    BLOCK_INPUT;
  #ifndef MSDOS
!   XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime);
!   XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime);
  #endif
!   XMenuDestroy (FRAME_X_DISPLAY (f), menu);
  
  #ifdef HAVE_X_WINDOWS
    /* Assume the mouse has moved out of the X window.
***************
*** 3267,3273 ****
    Window root;
    XMenu *menu;
    int pane, selidx, lpane, status;
!   Lisp_Object entry, pane_prefix, frame;
    char *datap;
    int ulx, uly, width, height;
    int dispwidth, dispheight;
--- 3260,3266 ----
    Window root;
    XMenu *menu;
    int pane, selidx, lpane, status;
!   Lisp_Object entry, pane_prefix;
    char *datap;
    int ulx, uly, width, height;
    int dispwidth, dispheight;
***************
*** 3469,3481 ****
    XMenuActivateSetWaitFunction (x_menu_wait_for_event, FRAME_X_DISPLAY (f));
  #endif
    
!   XSETFRAME (frame, f);
!   record_unwind_protect (pop_down_menu, frame);
  
    /* Help display under X won't work because XMenuActivate contains
       a loop that doesn't give Emacs a chance to process it.  */
    menu_help_frame = f;
-   current_menu = menu;
    status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
                            x, y, ButtonReleaseMask, &datap,
                            menu_help_callback);
--- 3462,3474 ----
    XMenuActivateSetWaitFunction (x_menu_wait_for_event, FRAME_X_DISPLAY (f));
  #endif
    
!   record_unwind_protect (pop_down_menu,
!                          Fcons (make_save_value (f, 0),
!                                 make_save_value (menu, 0)));
  
    /* Help display under X won't work because XMenuActivate contains
       a loop that doesn't give Emacs a chance to process it.  */
    menu_help_frame = f;
    status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
                            x, y, ButtonReleaseMask, &datap,
                            menu_help_callback);




reply via email to

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