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
10
This Debian patch is taken from this upstream commit:
12
commit 3715ffe3e3b2c64d113bf26d94aab559f8559e83
13
Author: Jan Djärv <jan.h.d@swipnet.se>
14
Date: Wed Sep 2 17:03:20 2009 +0000
16
It was backported to emacs22 for the ubuntu package
20
@@ -369,10 +369,7 @@ x_any_window_to_frame (dpyinfo, wdesc)
22
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
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)
31
if (wdesc == XtWindow (x->widget)
32
@@ -393,54 +390,6 @@ x_any_window_to_frame (dpyinfo, wdesc)
36
-/* Likewise, but exclude the menu bar widget. */
39
-x_non_menubar_window_to_frame (dpyinfo, wdesc)
40
- struct x_display_info *dpyinfo;
43
- Lisp_Object tail, frame;
47
- if (wdesc == None) return 0;
49
- for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
51
- frame = XCAR (tail);
52
- if (!GC_FRAMEP (frame))
55
- if (!FRAME_X_P (f) || FRAME_X_DISPLAY_INFO (f) != dpyinfo)
57
- x = f->output_data.x;
58
- /* This frame matches if the window is any of its widgets. */
59
- if (x->hourglass_window == wdesc)
64
- GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
66
- && (gwdesc == x->widget
67
- || gwdesc == x->edit_widget
68
- || gwdesc == x->vbox_widget))
71
- if (wdesc == XtWindow (x->widget)
72
- || wdesc == XtWindow (x->column_widget)
73
- || wdesc == XtWindow (x->edit_widget))
77
- else if (FRAME_X_WINDOW (f) == wdesc)
78
- /* A tooltip frame. */
84
/* Likewise, but consider only the menu bar widget. */
87
@@ -468,15 +417,14 @@ x_menubar_window_to_frame (dpyinfo, wdes
88
if (x->menubar_widget)
90
GtkWidget *gwdesc = xg_win_to_widget (dpyinfo->display, wdesc);
94
+ /* This gives false positives, but the rectangle check in xterm.c
95
+ where this is called takes care of that. */
97
&& (gwdesc == x->menubar_widget
98
- || gtk_widget_get_parent (gwdesc) == x->menubar_widget))
101
- if (found) return f;
102
+ || gtk_widget_is_ancestor (x->menubar_widget, gwdesc)
103
+ || gtk_widget_is_ancestor (gwdesc, x->menubar_widget)))
107
if (x->menubar_widget
110
@@ -110,8 +110,6 @@ extern void xlwmenu_redisplay P_ ((Widge
111
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
113
extern void free_frame_menubar P_ ((struct frame *));
114
-extern struct frame *x_menubar_window_to_frame P_ ((struct x_display_info *,
119
@@ -144,11 +142,6 @@ extern void _XEditResCheckMessages ();
121
#endif /* USE_X_TOOLKIT */
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
130
#ifndef XtNinitialState
131
@@ -3788,7 +3781,14 @@ XTmouse_position (fp, insist, bar_window
133
if (child == None || child == win)
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))
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.) */
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);
156
/* Is win one of our frames? */
157
f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win);
161
/* If we end up with the menu bar window, say it's not
164
@@ -414,7 +414,7 @@ extern struct frame *x_window_to_frame P
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));