aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-19 09:56:48 +0000
committerRichard M. Stallman1994-10-19 09:56:48 +0000
commit92280f67937a2247ac51abf2f1f8f20f34039f86 (patch)
tree1d857822a375a195034cce643d2a00af3d0d3442 /src
parentd0a497168636bfd0928c990a7eddde3b489dfc66 (diff)
downloademacs-92280f67937a2247ac51abf2f1f8f20f34039f86.tar.gz
emacs-92280f67937a2247ac51abf2f1f8f20f34039f86.zip
Use FRAME_X_DISPLAY, not XDISPLAY or x_current_display.
(menu_item_equiv_key): Reject equiv sequences that start with mouse clicks.
Diffstat (limited to 'src')
-rw-r--r--src/xmenu.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index c44b23f9115..fea869ebe60 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -77,10 +77,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
77#define FALSE 0 77#define FALSE 0
78#endif /* no TRUE */ 78#endif /* no TRUE */
79 79
80extern Display *x_current_display;
81
82extern Lisp_Object Qmenu_enable; 80extern Lisp_Object Qmenu_enable;
83extern Lisp_Object Qmenu_bar; 81extern Lisp_Object Qmenu_bar;
82extern Lisp_Object Qmouse_click, Qevent_kind;
84 83
85#ifdef USE_X_TOOLKIT 84#ifdef USE_X_TOOLKIT
86extern void process_expose_from_menu (); 85extern void process_expose_from_menu ();
@@ -348,6 +347,18 @@ menu_item_equiv_key (item_string, item1, descrip_ptr)
348 if (VECTORP (savedkey) 347 if (VECTORP (savedkey)
349 && EQ (XVECTOR (savedkey)->contents[0], Qmenu_bar)) 348 && EQ (XVECTOR (savedkey)->contents[0], Qmenu_bar))
350 savedkey = Qnil; 349 savedkey = Qnil;
350 /* Reject two-key sequences that start with a mouse click.
351 These are probably menu items. */
352 if (VECTORP (savedkey)
353 && XVECTOR (savedkey)->size > 1
354 && SYMBOLP (XVECTOR (savedkey)->contents[0]))
355 {
356 Lisp_Object tem;
357
358 tem = Fget (XVECTOR (savedkey)->contents[0], Qevent_kind);
359 if (EQ (tem, Qmouse_click))
360 savedkey = Qnil;
361 }
351 if (!NILP (savedkey)) 362 if (!NILP (savedkey))
352 { 363 {
353 descrip = Fkey_description (savedkey); 364 descrip = Fkey_description (savedkey);
@@ -1720,7 +1731,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
1720 while (queue != NULL) 1731 while (queue != NULL)
1721 { 1732 {
1722 queue_tmp = queue; 1733 queue_tmp = queue;
1723 XPutBackEvent (XDISPLAY &queue_tmp->event); 1734 XPutBackEvent (FRAME_X_DISPLAY (f), &queue_tmp->event);
1724 queue = queue_tmp->next; 1735 queue = queue_tmp->next;
1725 free ((char *)queue_tmp); 1736 free ((char *)queue_tmp);
1726 /* Cause these events to get read as soon as we UNBLOCK_INPUT. */ 1737 /* Cause these events to get read as soon as we UNBLOCK_INPUT. */
@@ -1958,7 +1969,7 @@ xdialog_show (f, menubarp, keymaps, title, error)
1958 else if (event.type == Expose) 1969 else if (event.type == Expose)
1959 process_expose_from_menu (event); 1970 process_expose_from_menu (event);
1960 XtDispatchEvent (&event); 1971 XtDispatchEvent (&event);
1961 if (XtWindowToWidget(XDISPLAY event.xany.window) != menu) 1972 if (XtWindowToWidget (FRAME_X_DISPLAY (f), event.xany.window) != menu)
1962 { 1973 {
1963 queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue)); 1974 queue_tmp = (struct event_queue *) malloc (sizeof (struct event_queue));
1964 1975
@@ -1984,7 +1995,7 @@ xdialog_show (f, menubarp, keymaps, title, error)
1984 while (queue != NULL) 1995 while (queue != NULL)
1985 { 1996 {
1986 queue_tmp = queue; 1997 queue_tmp = queue;
1987 XPutBackEvent (XDISPLAY &queue_tmp->event); 1998 XPutBackEvent (FRAME_X_DISPLAY (f), &queue_tmp->event);
1988 queue = queue_tmp->next; 1999 queue = queue_tmp->next;
1989 free ((char *)queue_tmp); 2000 free ((char *)queue_tmp);
1990 /* Cause these events to get read as soon as we UNBLOCK_INPUT. */ 2001 /* Cause these events to get read as soon as we UNBLOCK_INPUT. */
@@ -2064,12 +2075,12 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2064 } 2075 }
2065 2076
2066 /* Figure out which root window F is on. */ 2077 /* Figure out which root window F is on. */
2067 XGetGeometry (x_current_display, FRAME_X_WINDOW (f), &root, 2078 XGetGeometry (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), &root,
2068 &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, 2079 &dummy_int, &dummy_int, &dummy_uint, &dummy_uint,
2069 &dummy_uint, &dummy_uint); 2080 &dummy_uint, &dummy_uint);
2070 2081
2071 /* Make the menu on that window. */ 2082 /* Make the menu on that window. */
2072 menu = XMenuCreate (XDISPLAY root, "emacs"); 2083 menu = XMenuCreate (FRAME_X_DISPLAY (f), root, "emacs");
2073 if (menu == NULL) 2084 if (menu == NULL)
2074 { 2085 {
2075 *error = "Can't create menu"; 2086 *error = "Can't create menu";
@@ -2087,7 +2098,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2087 if (f->display.x->parent_desc != ROOT_WINDOW) 2098 if (f->display.x->parent_desc != ROOT_WINDOW)
2088 { 2099 {
2089 BLOCK_INPUT; 2100 BLOCK_INPUT;
2090 XTranslateCoordinates (x_current_display, 2101 XTranslateCoordinates (FRAME_X_DISPLAY (f),
2091 2102
2092 /* From-window, to-window. */ 2103 /* From-window, to-window. */
2093 f->display.x->window_desc, 2104 f->display.x->window_desc,
@@ -2126,10 +2137,10 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2126 if (keymaps && !NILP (prefix)) 2137 if (keymaps && !NILP (prefix))
2127 pane_string++; 2138 pane_string++;
2128 2139
2129 lpane = XMenuAddPane (XDISPLAY menu, pane_string, TRUE); 2140 lpane = XMenuAddPane (FRAME_X_DISPLAY (f), menu, pane_string, TRUE);
2130 if (lpane == XM_FAILURE) 2141 if (lpane == XM_FAILURE)
2131 { 2142 {
2132 XMenuDestroy (XDISPLAY menu); 2143 XMenuDestroy (FRAME_X_DISPLAY (f), menu);
2133 *error = "Can't create pane"; 2144 *error = "Can't create pane";
2134 return Qnil; 2145 return Qnil;
2135 } 2146 }
@@ -2197,11 +2208,12 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2197 else 2208 else
2198 item_data = XSTRING (item_name)->data; 2209 item_data = XSTRING (item_name)->data;
2199 2210
2200 if (XMenuAddSelection (XDISPLAY menu, lpane, 0, item_data, 2211 if (XMenuAddSelection (FRAME_X_DISPLAY (f),
2212 menu, lpane, 0, item_data,
2201 !NILP (enable)) 2213 !NILP (enable))
2202 == XM_FAILURE) 2214 == XM_FAILURE)
2203 { 2215 {
2204 XMenuDestroy (XDISPLAY menu); 2216 XMenuDestroy (FRAME_X_DISPLAY (f), menu);
2205 *error = "Can't add selection to menu"; 2217 *error = "Can't add selection to menu";
2206 return Qnil; 2218 return Qnil;
2207 } 2219 }
@@ -2210,14 +2222,16 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2210 } 2222 }
2211 2223
2212 /* All set and ready to fly. */ 2224 /* All set and ready to fly. */
2213 XMenuRecompute (XDISPLAY menu); 2225 XMenuRecompute (FRAME_X_DISPLAY (f), menu);
2214 dispwidth = DisplayWidth (x_current_display, XDefaultScreen (x_current_display)); 2226 dispwidth = DisplayWidth (FRAME_X_DISPLAY (f),
2215 dispheight = DisplayHeight (x_current_display, XDefaultScreen (x_current_display)); 2227 XDefaultScreen (FRAME_X_DISPLAY (f)));
2228 dispheight = DisplayHeight (FRAME_X_DISPLAY (f),
2229 XDefaultScreen (FRAME_X_DISPLAY (f)));
2216 x = min (x, dispwidth); 2230 x = min (x, dispwidth);
2217 y = min (y, dispheight); 2231 y = min (y, dispheight);
2218 x = max (x, 1); 2232 x = max (x, 1);
2219 y = max (y, 1); 2233 y = max (y, 1);
2220 XMenuLocate (XDISPLAY menu, 0, 0, x, y, 2234 XMenuLocate (FRAME_X_DISPLAY (f), menu, 0, 0, x, y,
2221 &ulx, &uly, &width, &height); 2235 &ulx, &uly, &width, &height);
2222 if (ulx+width > dispwidth) 2236 if (ulx+width > dispwidth)
2223 { 2237 {
@@ -2236,7 +2250,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2236 XMenuSetFreeze (menu, TRUE); 2250 XMenuSetFreeze (menu, TRUE);
2237 pane = selidx = 0; 2251 pane = selidx = 0;
2238 2252
2239 status = XMenuActivate (XDISPLAY menu, &pane, &selidx, 2253 status = XMenuActivate (FRAME_X_DISPLAY (f), menu, &pane, &selidx,
2240 x, y, ButtonReleaseMask, &datap); 2254 x, y, ButtonReleaseMask, &datap);
2241 switch (status) 2255 switch (status)
2242 { 2256 {
@@ -2287,7 +2301,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2287 entry = Qnil; 2301 entry = Qnil;
2288 break; 2302 break;
2289 } 2303 }
2290 XMenuDestroy (XDISPLAY menu); 2304 XMenuDestroy (FRAME_X_DISPLAY (f), menu);
2291 2305
2292#ifdef HAVE_X_WINDOWS 2306#ifdef HAVE_X_WINDOWS
2293 /* State that no mouse buttons are now held. 2307 /* State that no mouse buttons are now held.