~ubuntu-branches/ubuntu/lucid/emacs22/lucid

« back to all changes in this revision

Viewing changes to debian/patches/fix-dynamic-menus.diff

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-11-06 11:14:23 UTC
  • Revision ID: james.westby@ubuntu.com-20091106111423-bukozxxirvt63uny
Tags: 22.2-0ubuntu8
backport patch from emacs23 to ensure that dynamic menus get updated properly
Closes: #550541,  LP: #415101

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
* Emacs should properly render dynamically generated menus.
 
2
  Patch: fix-dynamic-menus.diff
 
3
  Originally-reported-by: Baylis Shanks <bshanks3@hotmail.com>
 
4
  Date: Sat, 10 Oct 2009 22:15:05 UTC
 
5
  Added-by: Rob Browning <rlb@defaultvalue.org>
 
6
  Backported-by: Reinhard Tartler <siretart@ubuntu.com>
 
7
  Status: incorporated upstream
 
8
  Bug: 550541
 
9
 
 
10
  This Debian patch is taken from this upstream commit:
 
11
 
 
12
    commit 3715ffe3e3b2c64d113bf26d94aab559f8559e83
 
13
    Author: Jan Djärv <jan.h.d@swipnet.se>
 
14
    Date:   Wed Sep 2 17:03:20 2009 +0000
 
15
 
 
16
  It was backported to emacs22 for the ubuntu package
 
17
 
 
18
--- a/src/xfns.c
 
19
+++ b/src/xfns.c
 
20
@@ -369,10 +369,7 @@ x_any_window_to_frame (dpyinfo, wdesc)
 
21
 #ifdef USE_GTK
 
22
               GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
 
23
               if (gwdesc != 0
 
24
-                  && (gwdesc == x->widget
 
25
-                      || gwdesc == x->edit_widget
 
26
-                      || gwdesc == x->vbox_widget
 
27
-                      || gwdesc == x->menubar_widget))
 
28
+                  && gtk_widget_get_toplevel (gwdesc) == x->widget)
 
29
                 found = f;
 
30
 #else
 
31
              if (wdesc == XtWindow (x->widget)
 
32
@@ -393,54 +390,6 @@ x_any_window_to_frame (dpyinfo, wdesc)
 
33
   return found;
 
34
 }
 
35
 
 
36
-/* Likewise, but exclude the menu bar widget.  */
 
37
-
 
38
-struct frame *
 
39
-x_non_menubar_window_to_frame (dpyinfo, wdesc)
 
40
-     struct x_display_info *dpyinfo;
 
41
-     int wdesc;
 
42
-{
 
43
-  Lisp_Object tail, frame;
 
44
-  struct frame *f;
 
45
-  struct x_output *x;
 
46
-
 
47
-  if (wdesc == None) return 0;
 
48
-
 
49
-  for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
 
50
-    {
 
51
-      frame = XCAR (tail);
 
52
-      if (!GC_FRAMEP (frame))
 
53
-        continue;
 
54
-      f = XFRAME (frame);
 
55
-      if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
 
56
-       continue;
 
57
-      x = f->output_data.x;
 
58
-      /* This frame matches if the window is any of its widgets.  */
 
59
-      if (x->hourglass_window == wdesc)
 
60
-       return f;
 
61
-      else if (x->widget)
 
62
-       {
 
63
-#ifdef USE_GTK
 
64
-          GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
 
65
-          if (gwdesc != 0
 
66
-              && (gwdesc == x->widget
 
67
-                  || gwdesc == x->edit_widget
 
68
-                  || gwdesc == x->vbox_widget))
 
69
-            return f;
 
70
-#else
 
71
-         if (wdesc == XtWindow (x->widget)
 
72
-             || wdesc == XtWindow (x->column_widget)
 
73
-             || wdesc == XtWindow (x->edit_widget))
 
74
-           return f;
 
75
-#endif
 
76
-       }
 
77
-      else if (FRAME_X_WINDOW (f) == wdesc)
 
78
-       /* A tooltip frame.  */
 
79
-       return f;
 
80
-    }
 
81
-  return 0;
 
82
-}
 
83
-
 
84
 /* Likewise, but consider only the menu bar widget.  */
 
85
 
 
86
 struct frame *
 
87
@@ -468,15 +417,14 @@ x_menubar_window_to_frame (dpyinfo, wdes
 
88
       if (x->menubar_widget)
 
89
         {
 
90
           GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
 
91
-          int found = 0;
 
92
 
 
93
-          BLOCK_INPUT;
 
94
+         /* This gives false positives, but the rectangle check in xterm.c
 
95
+            where this is called takes care of that.  */
 
96
           if (gwdesc != 0
 
97
               && (gwdesc == x->menubar_widget
 
98
-                  || gtk_widget_get_parent (gwdesc) == x->menubar_widget))
 
99
-            found = 1;
 
100
-          UNBLOCK_INPUT;
 
101
-          if (found) return f;
 
102
+                  || gtk_widget_is_ancestor (x->menubar_widget, gwdesc)
 
103
+                 || gtk_widget_is_ancestor (gwdesc, x->menubar_widget)))
 
104
+            return f;
 
105
         }
 
106
 #else
 
107
       if (x->menubar_widget
 
108
--- a/src/xterm.c
 
109
+++ b/src/xterm.c
 
110
@@ -110,8 +110,6 @@ extern void xlwmenu_redisplay P_ ((Widge
 
111
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
 
112
 
 
113
 extern void free_frame_menubar P_ ((struct frame *));
 
114
-extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *,
 
115
-                                                   int));
 
116
 #endif
 
117
 
 
118
 #ifdef USE_X_TOOLKIT
 
119
@@ -144,11 +142,6 @@ extern void _XEditResCheckMessages ();
 
120
 
 
121
 #endif /* USE_X_TOOLKIT */
 
122
 
 
123
-#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK)
 
124
-#define x_any_window_to_frame x_window_to_frame
 
125
-#define x_top_window_to_frame x_window_to_frame
 
126
-#endif
 
127
-
 
128
 #ifdef USE_X_TOOLKIT
 
129
 #include "widget.h"
 
130
 #ifndef XtNinitialState
 
131
@@ -3788,7 +3781,14 @@ XTmouse_position (fp, insist, bar_window
 
132
 
 
133
                if (child == None || child == win)
 
134
                  break;
 
135
-
 
136
+#ifdef USE_GTK
 
137
+               /* We don't wan't to know the innermost window.  We
 
138
+                  want the edit window.  For non-Gtk+ the innermost
 
139
+                  window is the edit window.  For Gtk+ it might not
 
140
+                  be.  It might be the tool bar for example.  */
 
141
+               if (x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win))
 
142
+                 break;
 
143
+#endif
 
144
                win = child;
 
145
                parent_x = win_x;
 
146
                parent_y = win_y;
 
147
@@ -3805,8 +3805,14 @@ XTmouse_position (fp, insist, bar_window
 
148
               parent_{x,y} are invalid, but that's okay, because we'll
 
149
               never use them in that case.)  */
 
150
 
 
151
+#ifdef USE_GTK
 
152
+           /* We don't wan't to know the innermost window.  We
 
153
+              want the edit window.  */
 
154
+           f1 = x_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win);
 
155
+#else
 
156
            /* Is win one of our frames?  */
 
157
            f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win);
 
158
+#endif
 
159
 
 
160
 #ifdef USE_X_TOOLKIT
 
161
            /* If we end up with the menu bar window, say it's not
 
162
--- a/src/xterm.h
 
163
+++ b/src/xterm.h
 
164
@@ -414,7 +414,7 @@ extern struct frame *x_window_to_frame P
 
165
 
 
166
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
 
167
 extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int));
 
168
-extern struct frame *x_non_menubar_window_to_frame P_ ((struct x_display_info *, int));
 
169
+extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *, int));
 
170
 extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int));
 
171
 #endif
 
172