components/emacs/patches/buffer_menu.patch
changeset 686 b4fe91eb660b
parent 685 5e6df462e21d
child 687 05f0db35db4e
equal deleted inserted replaced
685:5e6df462e21d 686:b4fe91eb660b
     1 *** emacs-23.1/src/ChangeLog.orig	Wed Oct 14 16:57:29 2009
       
     2 --- emacs-23.1/src/ChangeLog	Wed Oct 14 17:35:12 2009
       
     3 ***************
       
     4 *** 1,3 ****
       
     5 --- 1,19 ----
       
     6 + 2009-09-02  Jan Djärv  <[email protected]>
       
     7 + 
       
     8 + 	* xterm.h: Rename x_non_menubar_window_to_frame to
       
     9 + 	x_menubar_window_to_frame
       
    10 + 
       
    11 + 	* xterm.c: Remove declarations also in xterm.h
       
    12 + 	(XTmouse_position): Do not return valid positions
       
    13 + 	for clicks in the menubar and the toolbar for Gtk+.
       
    14 + 
       
    15 + 	* xfns.c (x_any_window_to_frame): Assume less about Gtk+ internals,
       
    16 + 	if the widget for the event has the same top level as a frame,
       
    17 + 	return the frame.
       
    18 + 	(x_menubar_window_to_frame): Detect menu bar even with Gtk+
       
    19 + 	internal windows, bug #4122.
       
    20 + 	(x_non_menubar_window_to_frame): Remove.
       
    21 + 	
       
    22   2009-07-29  Chong Yidong  <[email protected]>
       
    23   
       
    24   	* Version 23.1 released.
       
    25 *** emacs-23.1/src/xfns.c.orig	Wed Oct 14 16:50:22 2009
       
    26 --- emacs-23.1/src/xfns.c	Wed Oct 14 17:35:12 2009
       
    27 ***************
       
    28 *** 374,383 ****
       
    29   #ifdef USE_GTK
       
    30                 GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
       
    31                 if (gwdesc != 0
       
    32 !                   && (gwdesc == x->widget
       
    33 !                       || gwdesc == x->edit_widget
       
    34 !                       || gwdesc == x->vbox_widget
       
    35 !                       || gwdesc == x->menubar_widget))
       
    36                   found = f;
       
    37   #else
       
    38   	      if (wdesc == XtWindow (x->widget)
       
    39 --- 374,380 ----
       
    40   #ifdef USE_GTK
       
    41                 GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
       
    42                 if (gwdesc != 0
       
    43 !                   && gtk_widget_get_toplevel(gwdesc) == x->widget)
       
    44                   found = f;
       
    45   #else
       
    46   	      if (wdesc == XtWindow (x->widget)
       
    47 ***************
       
    48 *** 398,451 ****
       
    49     return found;
       
    50   }
       
    51   
       
    52 - /* Likewise, but exclude the menu bar widget.  */
       
    53 - 
       
    54 - struct frame *
       
    55 - x_non_menubar_window_to_frame (dpyinfo, wdesc)
       
    56 -      struct x_display_info *dpyinfo;
       
    57 -      int wdesc;
       
    58 - {
       
    59 -   Lisp_Object tail, frame;
       
    60 -   struct frame *f;
       
    61 -   struct x_output *x;
       
    62 - 
       
    63 -   if (wdesc == None) return 0;
       
    64 - 
       
    65 -   for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
       
    66 -     {
       
    67 -       frame = XCAR (tail);
       
    68 -       if (!FRAMEP (frame))
       
    69 -         continue;
       
    70 -       f = XFRAME (frame);
       
    71 -       if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
       
    72 - 	continue;
       
    73 -       x = f->output_data.x;
       
    74 -       /* This frame matches if the window is any of its widgets.  */
       
    75 -       if (x->hourglass_window == wdesc)
       
    76 - 	return f;
       
    77 -       else if (x->widget)
       
    78 - 	{
       
    79 - #ifdef USE_GTK
       
    80 -           GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
       
    81 -           if (gwdesc != 0
       
    82 -               && (gwdesc == x->widget
       
    83 -                   || gwdesc == x->edit_widget
       
    84 -                   || gwdesc == x->vbox_widget))
       
    85 -             return f;
       
    86 - #else
       
    87 - 	  if (wdesc == XtWindow (x->widget)
       
    88 - 	      || wdesc == XtWindow (x->column_widget)
       
    89 - 	      || wdesc == XtWindow (x->edit_widget))
       
    90 - 	    return f;
       
    91 - #endif
       
    92 - 	}
       
    93 -       else if (FRAME_X_WINDOW (f) == wdesc)
       
    94 - 	/* A tooltip frame.  */
       
    95 - 	return f;
       
    96 -     }
       
    97 -   return 0;
       
    98 - }
       
    99 - 
       
   100   /* Likewise, but consider only the menu bar widget.  */
       
   101   
       
   102   struct frame *
       
   103 --- 395,400 ----
       
   104 ***************
       
   105 *** 473,487 ****
       
   106         if (x->menubar_widget)
       
   107           {
       
   108             GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
       
   109 -           int found = 0;
       
   110   
       
   111 !           BLOCK_INPUT;
       
   112             if (gwdesc != 0
       
   113                 && (gwdesc == x->menubar_widget
       
   114 !                   || gtk_widget_get_parent (gwdesc) == x->menubar_widget))
       
   115 !             found = 1;
       
   116 !           UNBLOCK_INPUT;
       
   117 !           if (found) return f;
       
   118           }
       
   119   #else
       
   120         if (x->menubar_widget
       
   121 --- 422,435 ----
       
   122         if (x->menubar_widget)
       
   123           {
       
   124             GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
       
   125   
       
   126 ! 	  /* This gives false positives, but the rectangle check in xterm.c
       
   127 ! 	     where this is called takes care of that. */
       
   128             if (gwdesc != 0
       
   129                 && (gwdesc == x->menubar_widget
       
   130 ! 		  || gtk_widget_is_ancestor (x->menubar_widget, gwdesc)
       
   131 ! 		  || gtk_widget_is_ancestor (gwdesc, x->menubar_widget)))
       
   132 ! 	    return f;
       
   133           }
       
   134   #else
       
   135         if (x->menubar_widget
       
   136 *** emacs-23.1/src/xterm.c.orig	Wed Oct 14 16:37:20 2009
       
   137 --- emacs-23.1/src/xterm.c	Wed Oct 14 17:35:12 2009
       
   138 ***************
       
   139 *** 109,116 ****
       
   140   #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
       
   141   
       
   142   extern void free_frame_menubar P_ ((struct frame *));
       
   143 - extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *,
       
   144 - 						    int));
       
   145   #endif
       
   146   
       
   147   #ifdef USE_X_TOOLKIT
       
   148 --- 109,114 ----
       
   149 ***************
       
   150 *** 143,153 ****
       
   151   
       
   152   #endif /* USE_X_TOOLKIT */
       
   153   
       
   154 - #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
       
   155 - #define x_any_window_to_frame x_window_to_frame
       
   156 - #define x_top_window_to_frame x_window_to_frame
       
   157 - #endif
       
   158 - 
       
   159   #ifdef USE_X_TOOLKIT
       
   160   #include "widget.h"
       
   161   #ifndef XtNinitialState
       
   162 --- 141,146 ----
       
   163 ***************
       
   164 *** 3916,3921 ****
       
   165 --- 3909,3923 ----
       
   166   		if (child == None || child == win)
       
   167   		  break;
       
   168   
       
   169 + #ifdef USE_GTK
       
   170 + 		/* We don't wan't to know the innermost window.  We
       
   171 + 		   want the edit window.  For non-Gtk+ the innermost
       
   172 + 		   window is the edit window.  For Gtk+ it might not
       
   173 + 		   be.  It might be the tool bar for example.  */
       
   174 + 		if (x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win))
       
   175 + 		  break;
       
   176 + #endif
       
   177 + 
       
   178   		win = child;
       
   179   		parent_x = win_x;
       
   180   		parent_y = win_y;
       
   181 ***************
       
   182 *** 3932,3939 ****
       
   183 --- 3934,3947 ----
       
   184   	       parent_{x,y} are invalid, but that's okay, because we'll
       
   185   	       never use them in that case.)  */
       
   186   
       
   187 + #ifdef USE_GTK
       
   188 + 	     /* We don't wan't to know the innermost window. We
       
   189 + 		want the edit window. */
       
   190 + 	    f1 = x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win);
       
   191 + #else
       
   192   	    /* Is win one of our frames?  */
       
   193   	    f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win);
       
   194 + #endif
       
   195   
       
   196   #ifdef USE_X_TOOLKIT
       
   197   	    /* If we end up with the menu bar window, say it's not
       
   198 *** emacs-23.1/src/xterm.h.orig	Wed Oct 14 15:08:03 2009
       
   199 --- emacs-23.1/src/xterm.h	Wed Oct 14 17:35:12 2009
       
   200 ***************
       
   201 *** 374,380 ****
       
   202   
       
   203   #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
       
   204   extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int));
       
   205 ! extern struct frame *x_non_menubar_window_to_frame P_ ((struct x_display_info *, int));
       
   206   extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int));
       
   207   #endif
       
   208   
       
   209 --- 374,380 ----
       
   210   
       
   211   #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
       
   212   extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int));
       
   213 ! extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, int));
       
   214   extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int));
       
   215   #endif
       
   216