Mercurial > emacs
annotate src/xmenu.c @ 5956:586a37656a31
(interpreter-mode-alist): New variable.
(set-auto-mode): Use that for chosing a mode.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 16 Feb 1994 07:06:10 +0000 |
parents | f394f25efb3c |
children | c072fed85d62 |
rev | line source |
---|---|
118 | 1 /* X Communication module for terminals which understand the X protocol. |
2961 | 2 Copyright (C) 1986, 1988, 1993 Free Software Foundation, Inc. |
118 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
1437
36ef55ecb265
* frame.c (make_frame_without_minibuffer, Fwindow_frame): Use
Jim Blandy <jimb@redhat.com>
parents:
1304
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option) |
118 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | |
20 /* X pop-up deck-of-cards menu facility for gnuemacs. | |
21 * | |
22 * Written by Jon Arnold and Roman Budzianowski | |
23 * Mods and rewrite by Robert Krawitz | |
24 * | |
25 */ | |
26 | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
27 /* Modified by Fred Pierresteguy on December 93 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
28 to make the popup menus and menubar use the Xt. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
29 |
118 | 30 #include <stdio.h> |
31 | |
32 /* On 4.3 this loses if it comes after xterm.h. */ | |
33 #include <signal.h> | |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4627
diff
changeset
|
34 #include <config.h> |
118 | 35 #include "lisp.h" |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
36 #include "termhooks.h" |
770 | 37 #include "frame.h" |
118 | 38 #include "window.h" |
1304
93d55019750e
* xmenu.c: #include "keyboard.h".
Jim Blandy <jimb@redhat.com>
parents:
1213
diff
changeset
|
39 #include "keyboard.h" |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
40 #include "blockinput.h" |
118 | 41 |
42 /* This may include sys/types.h, and that somehow loses | |
43 if this is not done before the other system files. */ | |
44 #include "xterm.h" | |
45 | |
46 /* Load sys/types.h if not already loaded. | |
47 In some systems loading it twice is suicidal. */ | |
48 #ifndef makedev | |
49 #include <sys/types.h> | |
50 #endif | |
51 | |
52 #include "dispextern.h" | |
53 | |
54 #ifdef HAVE_X11 | |
55 #include "../oldXMenu/XMenu.h" | |
56 #else | |
57 #include <X/XMenu.h> | |
58 #endif | |
59 | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
60 #ifdef USE_X_TOOLKIT |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
61 #include <X11/Xlib.h> |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
62 #include <X11/IntrinsicP.h> |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
63 #include <X11/CoreP.h> |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
64 #include <X11/StringDefs.h> |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
65 #include <X11/Xaw/Paned.h> |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
66 #include "../lwlib/lwlib.h" |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
67 #include "../lwlib/xlwmenuP.h" |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
68 #endif /* USE_X_TOOLKIT */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
69 |
118 | 70 #define min(x,y) (((x) < (y)) ? (x) : (y)) |
71 #define max(x,y) (((x) > (y)) ? (x) : (y)) | |
72 | |
73 #define NUL 0 | |
74 | |
75 #ifndef TRUE | |
76 #define TRUE 1 | |
77 #define FALSE 0 | |
3270
0c9a88fe24c9
* sysdep.c (sys_siglist): Comment out #endif trailer.
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
78 #endif /* TRUE */ |
118 | 79 |
80 #ifdef HAVE_X11 | |
81 extern Display *x_current_display; | |
82 #else | |
83 #define ButtonReleaseMask ButtonReleased | |
84 #endif /* not HAVE_X11 */ | |
85 | |
2514
6700e25af205
Since Qmenu_enable is used by non-X-specific code, it shouldn't be
Jim Blandy <jimb@redhat.com>
parents:
2439
diff
changeset
|
86 extern Lisp_Object Qmenu_enable; |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
87 extern Lisp_Object Qmenu_bar; |
118 | 88 Lisp_Object xmenu_show (); |
89 extern int x_error_handler (); | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
90 #ifdef USE_X_TOOLKIT |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
91 static widget_value *set_menu_items (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
92 static int string_width (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
93 static void free_menu_items (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
94 #endif |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
95 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
96 /* we need a unique id for each popup menu and dialog box */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
97 unsigned int popup_id_tick; |
118 | 98 |
99 /*************************************************************/ | |
100 | |
101 #if 0 | |
102 /* Ignoring the args is easiest. */ | |
103 xmenu_quit () | |
104 { | |
105 error ("Unknown XMenu error"); | |
106 } | |
107 #endif | |
108 | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
109 |
118 | 110 DEFUN ("x-popup-menu",Fx_popup_menu, Sx_popup_menu, 1, 2, 0, |
111 "Pop up a deck-of-cards menu and return user's selection.\n\ | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
112 POSITION is a position specification. This is either a mouse button event\n\ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
113 or a list ((XOFFSET YOFFSET) WINDOW)\n\ |
118 | 114 where XOFFSET and YOFFSET are positions in characters from the top left\n\ |
2147
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
115 corner of WINDOW's frame. (WINDOW may be a frame object instead of a window.)\n\ |
118 | 116 This controls the position of the center of the first line\n\ |
117 in the first pane of the menu, not the top left of the menu as a whole.\n\ | |
118 \n\ | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
119 MENU is a specifier for a menu. For the simplest case, MENU is a keymap.\n\ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
120 The menu items come from key bindings that have a menu string as well as\n\ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
121 a definition; actually, the \"definition\" in such a key binding looks like\n\ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
122 \(STRING . REAL-DEFINITION). To give the menu a title, put a string into\n\ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
123 the keymap as a top-level element.\n\n\ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
124 You can also use a list of keymaps as MENU.\n\ |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
125 Then each keymap makes a separate pane.\n\ |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
126 When MENU is a keymap or a list of keymaps, the return value\n\ |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
127 is a list of events.\n\n\ |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
128 Alternatively, you can specify a menu of multiple panes\n\ |
2191
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
129 with a list of the form (TITLE PANE1 PANE2...),\n\ |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
130 where each pane is a list of form (TITLE ITEM1 ITEM2...).\n\ |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
131 Each ITEM is normally a cons cell (STRING . VALUE);\n\ |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
132 but a string can appear as an item--that makes a nonselectable line\n\ |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
133 in the menu.\n\ |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
134 With this form of menu, the return value is VALUE from the chosen item.") |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
135 (position, menu) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
136 Lisp_Object position, menu; |
118 | 137 { |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
138 int number_of_panes, panes; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
139 Lisp_Object XMenu_return, keymap, tem; |
118 | 140 int XMenu_xpos, XMenu_ypos; |
141 char **menus; | |
142 char ***names; | |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
143 int **enables; |
118 | 144 Lisp_Object **obj_list; |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
145 Lisp_Object *prefixes; |
118 | 146 int *items; |
147 char *title; | |
148 char *error_name; | |
149 Lisp_Object ltitle, selection; | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
150 int i, j, menubarp = 0; |
770 | 151 FRAME_PTR f; |
118 | 152 Lisp_Object x, y, window; |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
153 #ifdef USE_X_TOOLKIT |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
154 widget_value *val, *vw = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
155 #endif /* USE_X_TOOLKIT */ |
118 | 156 |
5949 | 157 check_x (); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
158 /* Decode the first argument: find the window and the coordinates. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
159 tem = Fcar (position); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
160 if (XTYPE (tem) == Lisp_Cons) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
161 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
162 window = Fcar (Fcdr (position)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
163 x = Fcar (tem); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
164 y = Fcar (Fcdr (tem)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
165 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
166 else |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
167 { |
2153
42ceb87b43a1
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2147
diff
changeset
|
168 tem = Fcar (Fcdr (position)); /* EVENT_START (position) */ |
42ceb87b43a1
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2147
diff
changeset
|
169 window = Fcar (tem); /* POSN_WINDOW (tem) */ |
42ceb87b43a1
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2147
diff
changeset
|
170 tem = Fcar (Fcdr (Fcdr (tem))); /* POSN_WINDOW_POSN (tem) */ |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
171 x = Fcar (tem); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
172 y = Fcdr (tem); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
173 } |
118 | 174 CHECK_NUMBER (x, 0); |
175 CHECK_NUMBER (y, 0); | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
176 |
2147
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
177 if (XTYPE (window) == Lisp_Frame) |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
178 { |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
179 f = XFRAME (window); |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
180 |
2147
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
181 XMenu_xpos = 0; |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
182 XMenu_ypos = 0; |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
183 } |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
184 else if (XTYPE (window) == Lisp_Window) |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
185 { |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
186 CHECK_LIVE_WINDOW (window, 0); |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
187 f = XFRAME (WINDOW_FRAME (XWINDOW (window))); |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
188 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
189 XMenu_xpos = FONT_WIDTH (f->display.x->font) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
190 * XWINDOW (window)->left; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
191 XMenu_ypos = FONT_HEIGHT (f->display.x->font) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
192 * XWINDOW (window)->top; |
2147
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
193 } |
3501
33a309357161
(Fx_popup_menu): Error if we don't get a window or a frame somehow.
Richard M. Stallman <rms@gnu.org>
parents:
3270
diff
changeset
|
194 else |
33a309357161
(Fx_popup_menu): Error if we don't get a window or a frame somehow.
Richard M. Stallman <rms@gnu.org>
parents:
3270
diff
changeset
|
195 /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME, |
33a309357161
(Fx_popup_menu): Error if we don't get a window or a frame somehow.
Richard M. Stallman <rms@gnu.org>
parents:
3270
diff
changeset
|
196 but I don't want to make one now. */ |
33a309357161
(Fx_popup_menu): Error if we don't get a window or a frame somehow.
Richard M. Stallman <rms@gnu.org>
parents:
3270
diff
changeset
|
197 CHECK_WINDOW (window, 0); |
2147
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
198 |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
199 #ifdef USE_X_TOOLKIT |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
200 tem = Fcar (Fcdr (Fcar (Fcdr (position)))); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
201 if (XTYPE (Fcar (position)) != Lisp_Cons |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
202 && CONSP (tem) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
203 && EQ (Fcar (tem), Qmenu_bar)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
204 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
205 /* We are in the menubar */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
206 XlwMenuWidget mw; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
207 int w1 = 0, w2; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
208 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
209 mw = (XlwMenuWidget)f->display.x->menubar_widget; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
210 menubarp = 1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
211 for (vw = mw->menu.old_stack [0]->contents; vw; vw = vw->next) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
212 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
213 w2 = w1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
214 w1 += string_width (mw, vw->name) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
215 + 2 * (mw->menu.horizontal_spacing + |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
216 mw->menu.shadow_thickness); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
217 if (XINT (x) < w1) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
218 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
219 XMenu_xpos = w2 + 4; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
220 XMenu_ypos = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
221 break; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
222 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
223 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
224 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
225 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
226 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
227 XMenu_xpos += FONT_WIDTH (f->display.x->font) * XINT (x); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
228 XMenu_ypos += FONT_HEIGHT (f->display.x->font) * XINT (y); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
229 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
230 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
231 BLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
232 XMenu_xpos += (f->display.x->widget->core.x |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
233 + f->display.x->widget->core.border_width); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
234 XMenu_ypos += (f->display.x->widget->core.y |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
235 + f->display.x->widget->core.border_width |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
236 + f->display.x->menubar_widget->core.height); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
237 UNBLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
238 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
239 val = set_menu_items (menu, &prefixes, &panes, &names, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
240 &enables, &menus, &items, &number_of_panes, &obj_list, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
241 &title, &error_name); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
242 selection = xmenu_show (f, val, XMenu_xpos, XMenu_ypos, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
243 menubarp, vw); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
244 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
245 free_menu_items (names, enables, menus, items, number_of_panes, obj_list, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
246 title, error_name); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
247 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
248 if (selection != NUL) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
249 { /* selected something */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
250 XMenu_return = selection; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
251 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
252 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
253 { /* nothing selected */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
254 XMenu_return = Qnil; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
255 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
256 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
257 return XMenu_return; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
258 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
259 #else /* not USE_X_TOOLKIT */ |
4627
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
260 #ifdef HAVE_X11 |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
261 { |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
262 Window child; |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
263 int win_x = 0, win_y = 0; |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
264 |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
265 /* Find the position of the outside upper-left corner of |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
266 the inner window, with respect to the outer window. */ |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
267 if (f->display.x->parent_desc != ROOT_WINDOW) |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
268 { |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
269 BLOCK_INPUT; |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
270 XTranslateCoordinates (x_current_display, |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
271 |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
272 /* From-window, to-window. */ |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
273 f->display.x->window_desc, |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
274 f->display.x->parent_desc, |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
275 |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
276 /* From-position, to-position. */ |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
277 0, 0, &win_x, &win_y, |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
278 |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
279 /* Child of window. */ |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
280 &child); |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
281 UNBLOCK_INPUT; |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
282 XMenu_xpos += win_x; |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
283 XMenu_ypos += win_y; |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
284 } |
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
285 } |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
286 #endif /* HAVE_X11 */ |
4627
340c18d50337
(Fx_popup_menu): Adjust coords so they are relative to the inner window.
Richard M. Stallman <rms@gnu.org>
parents:
3747
diff
changeset
|
287 |
2147
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
288 XMenu_xpos += FONT_WIDTH (f->display.x->font) * XINT (x); |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
289 XMenu_ypos += FONT_HEIGHT (f->display.x->font) * XINT (y); |
1b6e54507323
(Fx_popup_menu): Allow a frame instead of a window, in arg.
Richard M. Stallman <rms@gnu.org>
parents:
2135
diff
changeset
|
290 |
770 | 291 XMenu_xpos += f->display.x->left_pos; |
292 XMenu_ypos += f->display.x->top_pos; | |
118 | 293 |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
294 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
295 keymap = Fkeymapp (menu); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
296 tem = Qnil; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
297 if (XTYPE (menu) == Lisp_Cons) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
298 tem = Fkeymapp (Fcar (menu)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
299 if (!NILP (keymap)) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
300 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
301 /* We were given a keymap. Extract menu info from the keymap. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
302 Lisp_Object prompt; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
303 keymap = get_keymap (menu); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
304 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
305 /* Search for a string appearing directly as an element of the keymap. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
306 That string is the title of the menu. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
307 prompt = map_prompt (keymap); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
308 if (!NILP (prompt)) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
309 title = (char *) XSTRING (prompt)->data; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
310 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
311 /* Extract the detailed info to make one pane. */ |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
312 number_of_panes = keymap_panes (&obj_list, &menus, &names, &enables, |
3747
6506b2fd475a
(xmenu_show): Store 0 in *ERROR at the beginning.
Richard M. Stallman <rms@gnu.org>
parents:
3501
diff
changeset
|
313 &items, &prefixes, &menu, 1); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
314 /* The menu title seems to be ignored, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
315 so put it in the pane title. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
316 if (menus[0] == 0) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
317 menus[0] = title; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
318 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
319 else if (!NILP (tem)) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
320 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
321 /* We were given a list of keymaps. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
322 Lisp_Object prompt; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
323 int nmaps = XFASTINT (Flength (menu)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
324 Lisp_Object *maps |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
325 = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
326 int i; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
327 title = 0; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
328 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
329 /* The first keymap that has a prompt string |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
330 supplies the menu title. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
331 for (tem = menu, i = 0; XTYPE (tem) == Lisp_Cons; tem = Fcdr (tem)) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
332 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
333 maps[i++] = keymap = get_keymap (Fcar (tem)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
334 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
335 prompt = map_prompt (keymap); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
336 if (title == 0 && !NILP (prompt)) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
337 title = (char *) XSTRING (prompt)->data; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
338 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
339 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
340 /* Extract the detailed info to make one pane. */ |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
341 number_of_panes = keymap_panes (&obj_list, &menus, &names, &enables, |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
342 &items, &prefixes, maps, nmaps); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
343 /* The menu title seems to be ignored, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
344 so put it in the pane title. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
345 if (menus[0] == 0) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
346 menus[0] = title; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
347 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
348 else |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
349 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
350 /* We were given an old-fashioned menu. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
351 ltitle = Fcar (menu); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
352 CHECK_STRING (ltitle, 1); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
353 title = (char *) XSTRING (ltitle)->data; |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
354 prefixes = 0; |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
355 number_of_panes = list_of_panes (&obj_list, &menus, &names, &enables, |
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
356 &items, Fcdr (menu)); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
357 } |
118 | 358 #ifdef XDEBUG |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
359 fprintf (stderr, "Panes = %d\n", number_of_panes); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
360 for (i = 0; i < number_of_panes; i++) |
118 | 361 { |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
362 fprintf (stderr, "Pane %d has lines %d title %s\n", |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
363 i, items[i], menus[i]); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
364 for (j = 0; j < items[i]; j++) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
365 fprintf (stderr, " Item %d %s\n", j, names[i][j]); |
118 | 366 } |
367 #endif | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
368 |
118 | 369 BLOCK_INPUT; |
1828
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
370 { |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
371 Window root; |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
372 int root_x, root_y; |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
373 int dummy_int; |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
374 unsigned int dummy_uint; |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
375 Window dummy_window; |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
376 |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
377 /* Figure out which root window F is on. */ |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
378 XGetGeometry (x_current_display, FRAME_X_WINDOW (f), &root, |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
379 &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
380 &dummy_uint, &dummy_uint); |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
381 |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
382 /* Translate the menu co-ordinates within f to menu co-ordinates |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
383 on that root window. */ |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
384 if (! XTranslateCoordinates (x_current_display, |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
385 FRAME_X_WINDOW (f), root, |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
386 XMenu_xpos, XMenu_ypos, &root_x, &root_y, |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
387 &dummy_window)) |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
388 /* But XGetGeometry said root was the root window of f's screen! */ |
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
389 abort (); |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
390 selection = xmenu_show (root, XMenu_xpos, XMenu_ypos, names, enables, |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
391 menus, prefixes, items, number_of_panes, obj_list, |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
392 title, &error_name); |
1828
1463592a6463
* xmenu.c (Fx_popup_menu): Don't forget to turn the frame-relative
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
393 } |
118 | 394 UNBLOCK_INPUT; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
395 /* fprintf (stderr, "selection = %x\n", selection); */ |
118 | 396 if (selection != NUL) |
397 { /* selected something */ | |
398 XMenu_return = selection; | |
399 } | |
400 else | |
401 { /* nothing selected */ | |
402 XMenu_return = Qnil; | |
403 } | |
404 /* now free up the strings */ | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
405 for (i = 0; i < number_of_panes; i++) |
118 | 406 { |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
407 xfree (names[i]); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
408 xfree (enables[i]); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
409 xfree (obj_list[i]); |
118 | 410 } |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
411 xfree (menus); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
412 xfree (obj_list); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
413 xfree (names); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
414 xfree (enables); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
415 xfree (items); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
416 /* free (title); */ |
118 | 417 if (error_name) error (error_name); |
418 return XMenu_return; | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
419 #endif /* not USE_X_TOOLKIT */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
420 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
421 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
422 #ifdef USE_X_TOOLKIT |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
423 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
424 static void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
425 dispatch_dummy_expose (w, x, y) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
426 Widget w; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
427 int x; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
428 int y; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
429 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
430 XExposeEvent dummy; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
431 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
432 dummy.type = Expose; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
433 dummy.window = XtWindow (w); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
434 dummy.count = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
435 dummy.serial = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
436 dummy.send_event = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
437 dummy.display = XtDisplay (w); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
438 dummy.x = x; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
439 dummy.y = y; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
440 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
441 XtDispatchEvent (&dummy); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
442 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
443 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
444 static int |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
445 string_width (mw, s) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
446 XlwMenuWidget mw; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
447 char* s; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
448 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
449 XCharStruct xcs; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
450 int drop; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
451 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
452 XTextExtents (mw->menu.font, s, strlen (s), &drop, &drop, &drop, &xcs); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
453 return xcs.width; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
454 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
455 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
456 static int |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
457 event_is_in_menu_item (mw, event, name, string_w) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
458 XlwMenuWidget mw; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
459 struct input_event *event; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
460 char *name; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
461 int *string_w; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
462 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
463 *string_w += string_width (mw, name) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
464 + 2 * (mw->menu.horizontal_spacing + mw->menu.shadow_thickness); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
465 return (XINT (event->x) < *string_w); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
466 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
467 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
468 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
469 Lisp_Object |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
470 map_event_to_object (event, f) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
471 struct input_event *event; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
472 FRAME_PTR f; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
473 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
474 int i,j, string_w; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
475 window_state* ws; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
476 XlwMenuWidget mw = (XlwMenuWidget) f->display.x->menubar_widget; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
477 widget_value *val; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
478 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
479 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
480 string_w = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
481 /* Find the window */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
482 for (val = mw->menu.old_stack [0]->contents; val; val = val->next) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
483 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
484 ws = &mw->menu.windows [0]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
485 if (ws && event_is_in_menu_item (mw, event, val->name, &string_w)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
486 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
487 Lisp_Object items; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
488 items = FRAME_MENU_BAR_ITEMS (f); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
489 for (; CONSP (items); items = XCONS (items)->cdr) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
490 if (!strcmp (val->name, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
491 XSTRING (Fcar (Fcdr (Fcar (items))))->data)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
492 return items; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
493 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
494 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
495 return Qnil; |
118 | 496 } |
497 | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
498 static widget_value * |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
499 set_menu_items (menu, prefixes, panes, names, enables, menus, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
500 items, number_of_panes, obj_list, title, error_name) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
501 Lisp_Object menu; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
502 Lisp_Object **prefixes; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
503 int *panes; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
504 char ***names[]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
505 int ***enables; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
506 char ***menus; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
507 int **items; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
508 int *number_of_panes; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
509 Lisp_Object ***obj_list; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
510 char **title; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
511 char **error_name; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
512 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
513 Lisp_Object keymap, tem; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
514 Lisp_Object ltitle, selection; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
515 int i, j; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
516 widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
517 int last, selidx, lpane, status; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
518 int lines, sofar; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
519 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
520 keymap = Fkeymapp (menu); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
521 tem = Qnil; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
522 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
523 if (XTYPE (menu) == Lisp_Cons) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
524 tem = Fkeymapp (Fcar (menu)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
525 if (!NILP (keymap)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
526 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
527 /* We were given a keymap. Extract menu info from the keymap. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
528 Lisp_Object prompt; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
529 keymap = get_keymap (menu); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
530 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
531 /* Search for a string appearing directly as an element of the keymap. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
532 That string is the title of the menu. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
533 prompt = map_prompt (keymap); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
534 if (!NILP (prompt)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
535 *title = (char *) XSTRING (prompt)->data; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
536 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
537 /* Extract the detailed info to make one pane. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
538 *number_of_panes = keymap_panes (obj_list, menus, names, enables, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
539 items, prefixes, menu, 1); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
540 /* The menu title seems to be ignored, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
541 so put it in the pane title. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
542 if ((*menus)[0] == 0) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
543 (*menus)[0] = *title; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
544 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
545 else if (!NILP (tem)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
546 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
547 /* We were given a list of keymaps. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
548 Lisp_Object prompt; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
549 int nmaps = XFASTINT (Flength (menu)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
550 Lisp_Object *maps |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
551 = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
552 int i; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
553 *title = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
554 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
555 /* The first keymap that has a prompt string |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
556 supplies the menu title. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
557 for (tem = menu, i = 0; XTYPE (tem) == Lisp_Cons; tem = Fcdr (tem)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
558 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
559 maps[i++] = keymap = get_keymap (Fcar (tem)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
560 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
561 prompt = map_prompt (keymap); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
562 if (*title == 0 && !NILP (prompt)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
563 *title = (char *) XSTRING (prompt)->data; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
564 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
565 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
566 /* Extract the detailed info to make one pane. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
567 *number_of_panes = keymap_panes (obj_list, menus, names, enables, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
568 items, prefixes, maps, nmaps); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
569 /* The menu title seems to be ignored, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
570 so put it in the pane title. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
571 if ((*menus)[0] == 0) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
572 (*menus)[0] = *title; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
573 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
574 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
575 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
576 /* We were given an old-fashioned menu. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
577 ltitle = Fcar (menu); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
578 CHECK_STRING (ltitle, 1); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
579 *title = (char *) XSTRING (ltitle)->data; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
580 *prefixes = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
581 *number_of_panes = list_of_panes (obj_list, menus, names, enables, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
582 items, Fcdr (menu)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
583 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
584 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
585 *error_name = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
586 if (*number_of_panes == 0) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
587 return 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
588 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
589 *error_name = (char *) 0; /* Initialize error pointer to null */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
590 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
591 wv = malloc_widget_value (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
592 wv->name = "menu"; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
593 wv->value = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
594 wv->enabled = 1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
595 first_wv = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
596 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
597 for (*panes = 0, lines = 0; *panes < *number_of_panes; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
598 lines += (*items)[*panes], (*panes)++) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
599 ; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
600 /* datap = (struct indices *) xmalloc (lines * sizeof (struct indices)); */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
601 /* datap = (char *) xmalloc (lines * sizeof (char)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
602 datap_save = datap;*/ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
603 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
604 for (*panes = 0, sofar = 0; *panes < *number_of_panes; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
605 sofar += (*items)[*panes], (*panes)++) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
606 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
607 if (strcmp((*menus)[*panes], "")) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
608 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
609 wv = malloc_widget_value (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
610 if (save_wv) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
611 save_wv->next = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
612 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
613 first_wv->contents = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
614 wv->name = (*menus)[*panes]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
615 wv->value = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
616 wv->enabled = 1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
617 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
618 prev_wv = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
619 save_wv = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
620 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
621 for (selidx = 0; selidx < (*items)[*panes]; selidx++) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
622 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
623 wv = malloc_widget_value (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
624 if (prev_wv) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
625 prev_wv->next = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
626 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
627 save_wv->contents = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
628 wv->name = (*names)[*panes][selidx]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
629 wv->value = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
630 selection = (*obj_list)[*panes][selidx]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
631 if (*prefixes != 0) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
632 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
633 selection = Fcons (selection, Qnil); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
634 if (!NILP ((*prefixes)[*panes])) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
635 selection = Fcons ((*prefixes)[*panes], selection); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
636 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
637 wv->call_data = LISP_TO_VOID(selection); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
638 wv->enabled = (*enables)[*panes][selidx]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
639 prev_wv = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
640 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
641 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
642 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
643 return (first_wv); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
644 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
645 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
646 static void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
647 free_menu_items (names, enables, menus, items, number_of_panes, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
648 obj_list, title, error_name) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
649 char **names[]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
650 int *enables[]; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
651 char **menus; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
652 int *items; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
653 int number_of_panes; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
654 Lisp_Object **obj_list; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
655 char *title; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
656 char *error_name; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
657 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
658 int i; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
659 /* now free up the strings */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
660 for (i = 0; i < number_of_panes; i++) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
661 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
662 xfree (names[i]); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
663 xfree (enables[i]); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
664 xfree (obj_list[i]); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
665 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
666 xfree (menus); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
667 xfree (obj_list); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
668 xfree (names); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
669 xfree (enables); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
670 xfree (items); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
671 /* free (title); */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
672 if (error_name) error (error_name); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
673 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
674 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
675 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
676 static Lisp_Object menu_item_selection; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
677 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
678 static void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
679 popup_selection_callback (widget, id, client_data) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
680 Widget widget; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
681 LWLIB_ID id; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
682 XtPointer client_data; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
683 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
684 #if 0 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
685 last_popup_selection_callback_id = id; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
686 menubar_selection_callback (widget, id, client_data); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
687 /* lw_destroy_all_widgets() will be called from popup_down_callback() */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
688 #endif |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
689 VOID_TO_LISP (menu_item_selection, client_data); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
690 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
691 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
692 static void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
693 popup_down_callback (widget, id, client_data) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
694 Widget widget; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
695 LWLIB_ID id; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
696 XtPointer client_data; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
697 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
698 #if 0 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
699 if (popup_menu_up_p == 0) abort (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
700 popup_menu_up_p--; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
701 /* if this isn't called immediately after the selection callback, then |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
702 there wasn't a menu selection. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
703 if (id != last_popup_selection_callback_id) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
704 menubar_selection_callback (widget, id, (XtPointer) -1); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
705 #endif |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
706 BLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
707 lw_destroy_all_widgets (id); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
708 UNBLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
709 /* ungcpro_popup_callbacks (make_number (id)); */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
710 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
711 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
712 /* This recursively calls free_widget_value() on the tree of widgets. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
713 It must free all data that was malloc'ed for these widget_values. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
714 Currently, emacs only allocates new storage for the `key' slot. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
715 All other slots are pointers into the data of Lisp_Strings, and |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
716 must be left alone. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
717 */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
718 void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
719 free_menubar_widget_value_tree (wv) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
720 widget_value *wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
721 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
722 if (! wv) return; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
723 if (wv->key) xfree (wv->key); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
724 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
725 wv->name = wv->value = wv->key = (char *) 0xDEADBEEF; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
726 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
727 if (wv->contents && (wv->contents != (widget_value*)1)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
728 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
729 free_menubar_widget_value_tree (wv->contents); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
730 wv->contents = (widget_value *) 0xDEADBEEF; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
731 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
732 if (wv->next) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
733 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
734 free_menubar_widget_value_tree (wv->next); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
735 wv->next = (widget_value *) 0xDEADBEEF; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
736 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
737 BLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
738 free_widget_value (wv); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
739 UNBLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
740 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
741 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
742 static void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
743 update_one_frame_psheets (f) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
744 FRAME_PTR f; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
745 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
746 struct x_display *x = f->display.x; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
747 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
748 int menubar_changed; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
749 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
750 menubar_changed = (x->menubar_widget |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
751 && !XtIsManaged (x->menubar_widget)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
752 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
753 if (! (menubar_changed)) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
754 return; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
755 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
756 BLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
757 XawPanedSetRefigureMode (x->column_widget, 0); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
758 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
759 /* the order in which children are managed is the top to |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
760 bottom order in which they are displayed in the paned window. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
761 First, remove the text-area widget. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
762 */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
763 XtUnmanageChild (x->edit_widget); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
764 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
765 /* remove the menubar that is there now, and put up the menubar that |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
766 should be there. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
767 */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
768 if (menubar_changed) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
769 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
770 XtManageChild (x->menubar_widget); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
771 XtMapWidget (x->menubar_widget); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
772 XtVaSetValues (x->menubar_widget, XtNmappedWhenManaged, 1, 0); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
773 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
774 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
775 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
776 /* Re-manage the text-area widget */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
777 XtManageChild (x->edit_widget); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
778 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
779 /* and now thrash the sizes */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
780 XawPanedSetRefigureMode (x->column_widget, 1); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
781 UNBLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
782 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
783 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
784 void |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
785 set_frame_menubar (f) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
786 FRAME_PTR f; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
787 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
788 Widget menubar_widget = f->display.x->menubar_widget; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
789 int id = (int) f; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
790 Lisp_Object tail; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
791 widget_value *wv, *save_wv, *first_wv, *prev_wv = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
792 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
793 BLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
794 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
795 wv = malloc_widget_value (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
796 wv->name = "menubar"; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
797 wv->value = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
798 wv->enabled = 1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
799 save_wv = first_wv = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
800 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
801 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
802 for (tail = FRAME_MENU_BAR_ITEMS (f); CONSP (tail); tail = XCONS (tail)->cdr) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
803 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
804 Lisp_Object string; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
805 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
806 string = Fcar (Fcdr (Fcar (tail))); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
807 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
808 wv = malloc_widget_value (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
809 if (prev_wv) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
810 prev_wv->next = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
811 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
812 save_wv->contents = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
813 wv->name = XSTRING (string)->data; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
814 wv->value = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
815 wv->enabled = 1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
816 prev_wv = wv; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
817 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
818 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
819 if (menubar_widget) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
820 lw_modify_all_widgets (id, first_wv, False); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
821 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
822 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
823 menubar_widget = lw_create_widget ("menubar", "menubar", |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
824 id, first_wv, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
825 f->display.x->column_widget, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
826 0, 0, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
827 0, 0); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
828 f->display.x->menubar_widget = menubar_widget; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
829 XtVaSetValues (menubar_widget, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
830 XtNshowGrip, 0, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
831 XtNresizeToPreferred, 1, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
832 XtNallowResize, 1, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
833 0); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
834 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
835 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
836 free_menubar_widget_value_tree (first_wv); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
837 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
838 update_one_frame_psheets (f); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
839 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
840 UNBLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
841 } |
5897
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
842 |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
843 void |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
844 free_frame_menubar (f) |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
845 FRAME_PTR f; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
846 { |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
847 Widget menubar_widget; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
848 int id; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
849 |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
850 menubar_widget = f->display.x->menubar_widget; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
851 id = (int) f; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
852 |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
853 if (menubar_widget) |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
854 { |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
855 BLOCK_INPUT; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
856 lw_destroy_all_widgets (id); |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
857 UNBLOCK_INPUT; |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
858 } |
5a68abc8f1f9
(free_frame_menubar) [USE_X_TOOLKIT]. New function to destroy the X Widget
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5896
diff
changeset
|
859 } |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
860 #endif /* USE_X_TOOLKIT */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
861 |
118 | 862 struct indices { |
863 int pane; | |
864 int line; | |
865 }; | |
866 | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
867 extern void process_expose_from_menu (); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
868 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
869 #ifdef USE_X_TOOLKIT |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
870 extern XtAppContext Xt_app_con; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
871 |
118 | 872 Lisp_Object |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
873 xmenu_show (f, val, x, y, menubarp, vw) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
874 FRAME_PTR f; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
875 widget_value *val; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
876 int x; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
877 int y; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
878 int menubarp; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
879 widget_value *vw; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
880 { |
5865
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
881 int menu_id, item_length; |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
882 Lisp_Object selection; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
883 Widget menu; |
5865
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
884 XlwMenuWidget menuw = (XlwMenuWidget) f->display.x->menubar_widget; |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
885 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
886 /* |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
887 * Define and allocate a foreign event queue to hold events |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
888 * that don't belong to XMenu. These events are later restored |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
889 * to the X event queue. |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
890 */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
891 typedef struct _xmeventque |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
892 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
893 XEvent event; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
894 struct _xmeventque *next; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
895 } XMEventQue; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
896 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
897 XMEventQue *feq = NULL; /* Foreign event queue. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
898 XMEventQue *feq_tmp; /* Foreign event queue temporary. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
899 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
900 BLOCK_INPUT; |
5896
b20145eafe0c
(xmenu_show) [USE_X_TOOLKIT]: return Qnil when val is null.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5881
diff
changeset
|
901 if (val == 0) return Qnil; |
b20145eafe0c
(xmenu_show) [USE_X_TOOLKIT]: return Qnil when val is null.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5881
diff
changeset
|
902 |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
903 menu_id = ++popup_id_tick; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
904 menu = lw_create_widget ("popup", val->name, menu_id, val, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
905 f->display.x->widget, 1, 0, |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
906 popup_selection_callback, popup_down_callback); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
907 free_menubar_widget_value_tree (val); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
908 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
909 /* reset the selection */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
910 menu_item_selection = Qnil; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
911 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
912 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
913 XButtonPressedEvent dummy; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
914 XlwMenuWidget mw; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
915 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
916 mw = ((XlwMenuWidget) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
917 ((CompositeWidget)menu)->composite.children[0]); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
918 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
919 dummy.type = ButtonPress; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
920 dummy.serial = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
921 dummy.send_event = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
922 dummy.display = XtDisplay (menu); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
923 dummy.window = XtWindow (XtParent (menu)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
924 dummy.time = CurrentTime; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
925 dummy.button = 0; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
926 dummy.x_root = x; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
927 dummy.y_root = y; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
928 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
929 if (menubarp) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
930 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
931 vw->call_data = (XtPointer) 1; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
932 dispatch_dummy_expose (f->display.x->menubar_widget, x, y); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
933 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
934 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
935 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
936 /* We activate directly the lucid implementation */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
937 pop_up_menu (mw, &dummy); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
938 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
939 |
5865
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
940 if (menubarp) |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
941 { |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
942 item_length = (x + string_width (menuw, vw->name) |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
943 + (2 * (menuw->menu.horizontal_spacing |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
944 + menuw->menu.shadow_thickness)) |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
945 - 4); |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
946 } |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
947 |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
948 /* Enters XEvent loop */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
949 while (1) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
950 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
951 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
952 XEvent event; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
953 XtAppNextEvent (Xt_app_con, &event); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
954 if (event.type == ButtonRelease) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
955 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
956 XtDispatchEvent (&event); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
957 break; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
958 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
959 else |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
960 if (event.type == Expose) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
961 process_expose_from_menu (event); |
5865
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
962 else |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
963 if (event.type == MotionNotify |
5881
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
964 && menubarp |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
965 && ((event.xmotion.y_root |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
966 >= (f->display.x->widget->core.y |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
967 + f->display.x->widget->core.border_width)) |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
968 && (event.xmotion.y_root |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
969 < (f->display.x->widget->core.y |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
970 + f->display.x->widget->core.border_width |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
971 + f->display.x->menubar_widget->core.height))) |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
972 && ((event.xmotion.x_root |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
973 >= (f->display.x->widget->core.x |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
974 + f->display.x->widget->core.border_width)) |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
975 && (event.xmotion.x_root |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
976 < (f->display.x->widget->core.x |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
977 + f->display.x->widget->core.border_width |
678a8470e4d1
(xmenu_show) [USE_X_TOOLKIT]: Test event.xmotion.x_root in the MotionNotify
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5865
diff
changeset
|
978 + f->display.x->widget->core.width))) |
5865
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
979 && (event.xmotion.x_root >= item_length |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
980 || event.xmotion.x_root < (x - 4))) |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
981 { |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
982 BLOCK_INPUT; |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
983 XtUngrabPointer ((Widget) |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
984 ((XlwMenuWidget) |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
985 ((CompositeWidget)menu)->composite.children[0]), |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
986 event.xbutton.time); |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
987 lw_destroy_all_widgets (menu_id); |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
988 UNBLOCK_INPUT; |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
989 |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
990 event.type = ButtonPress; |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
991 event.xbutton.time = CurrentTime; |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
992 event.xbutton.button = Button1; |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
993 event.xbutton.window = XtWindow (f->display.x->menubar_widget); |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
994 event.xbutton.x = (event.xbutton.x_root |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
995 - (f->display.x->widget->core.x |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
996 + f->display.x->widget->core.border_width)); |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
997 XPutBackEvent (XDISPLAY &event); |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
998 break; |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
999 } |
8dc616f310e8
(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now,
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5809
diff
changeset
|
1000 |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1001 XtDispatchEvent (&event); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1002 feq_tmp = (XMEventQue *) malloc (sizeof (XMEventQue)); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1003 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1004 if (feq_tmp == NULL) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1005 return(Qnil); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1006 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1007 feq_tmp->event = event; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1008 feq_tmp->next = feq; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1009 feq = feq_tmp; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1010 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1011 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1012 if (menubarp) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1013 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1014 vw->call_data = (XtPointer) 0; |
5775
07a36e38e514
(xmenu_show) [USE_X_TOOLKIT]: Remove the #if 0 directives and reverse one to
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5673
diff
changeset
|
1015 dispatch_dummy_expose (f->display.x->menubar_widget, x, y); |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1016 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1017 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1018 /* Return any foreign events that were queued to the X event queue. */ |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1019 while (feq != NULL) |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1020 { |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1021 feq_tmp = feq; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1022 XPutBackEvent (XDISPLAY &feq_tmp->event); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1023 feq = feq_tmp->next; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1024 free ((char *)feq_tmp); |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1025 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1026 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1027 UNBLOCK_INPUT; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1028 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1029 return menu_item_selection; |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1030 } |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1031 |
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1032 #else /* not USE_X_TOOLKIT */ |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1033 xmenu_show (parent, startx, starty, line_list, enable_list, pane_list, |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1034 prefixes, line_cnt, pane_cnt, item_list, title, error) |
118 | 1035 Window parent; |
1036 int startx, starty; /* upper left corner position BROKEN */ | |
1037 char **line_list[]; /* list of strings for items */ | |
5602 | 1038 int *enable_list[]; /* enable flags of lines */ |
118 | 1039 char *pane_list[]; /* list of pane titles */ |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1040 Lisp_Object *prefixes; /* Prefix key for each pane */ |
118 | 1041 char *title; |
1042 int pane_cnt; /* total number of panes */ | |
1043 Lisp_Object *item_list[]; /* All items */ | |
1044 int line_cnt[]; /* Lines in each pane */ | |
1045 char **error; /* Error returned */ | |
1046 { | |
1047 XMenu *GXMenu; | |
1048 int last, panes, selidx, lpane, status; | |
1049 int lines, sofar; | |
1050 Lisp_Object entry; | |
1051 /* struct indices *datap, *datap_save; */ | |
1052 char *datap; | |
1053 int ulx, uly, width, height; | |
1054 int dispwidth, dispheight; | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1055 |
3747
6506b2fd475a
(xmenu_show): Store 0 in *ERROR at the beginning.
Richard M. Stallman <rms@gnu.org>
parents:
3501
diff
changeset
|
1056 *error = 0; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1057 if (pane_cnt == 0) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1058 return 0; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1059 |
2209
7b95f29936cb
(xmenu_show): Do BLOCK_INPUT; unblock just before returning.
Richard M. Stallman <rms@gnu.org>
parents:
2191
diff
changeset
|
1060 BLOCK_INPUT; |
118 | 1061 *error = (char *) 0; /* Initialize error pointer to null */ |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1062 |
118 | 1063 GXMenu = XMenuCreate (XDISPLAY parent, "emacs"); |
1064 if (GXMenu == NUL) | |
1065 { | |
1066 *error = "Can't create menu"; | |
2209
7b95f29936cb
(xmenu_show): Do BLOCK_INPUT; unblock just before returning.
Richard M. Stallman <rms@gnu.org>
parents:
2191
diff
changeset
|
1067 UNBLOCK_INPUT; |
118 | 1068 return (0); |
1069 } | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1070 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1071 for (panes = 0, lines = 0; panes < pane_cnt; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1072 lines += line_cnt[panes], panes++) |
118 | 1073 ; |
1074 /* datap = (struct indices *) xmalloc (lines * sizeof (struct indices)); */ | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1075 /* datap = (char *) xmalloc (lines * sizeof (char)); |
118 | 1076 datap_save = datap;*/ |
1077 | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1078 for (panes = 0, sofar = 0; panes < pane_cnt; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1079 sofar += line_cnt[panes], panes++) |
118 | 1080 { |
1081 /* create all the necessary panes */ | |
1082 lpane = XMenuAddPane (XDISPLAY GXMenu, pane_list[panes], TRUE); | |
1083 if (lpane == XM_FAILURE) | |
1084 { | |
1085 XMenuDestroy (XDISPLAY GXMenu); | |
1086 *error = "Can't create pane"; | |
2209
7b95f29936cb
(xmenu_show): Do BLOCK_INPUT; unblock just before returning.
Richard M. Stallman <rms@gnu.org>
parents:
2191
diff
changeset
|
1087 UNBLOCK_INPUT; |
118 | 1088 return (0); |
1089 } | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1090 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1091 for (selidx = 0; selidx < line_cnt[panes]; selidx++) |
118 | 1092 { |
1093 /* add the selection stuff to the menus */ | |
1094 /* datap[selidx+sofar].pane = panes; | |
1095 datap[selidx+sofar].line = selidx; */ | |
1096 if (XMenuAddSelection (XDISPLAY GXMenu, lpane, 0, | |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1097 line_list[panes][selidx], |
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1098 enable_list[panes][selidx]) |
118 | 1099 == XM_FAILURE) |
1100 { | |
1101 XMenuDestroy (XDISPLAY GXMenu); | |
1102 /* free (datap); */ | |
1103 *error = "Can't add selection to menu"; | |
1104 /* error ("Can't add selection to menu"); */ | |
2209
7b95f29936cb
(xmenu_show): Do BLOCK_INPUT; unblock just before returning.
Richard M. Stallman <rms@gnu.org>
parents:
2191
diff
changeset
|
1105 UNBLOCK_INPUT; |
118 | 1106 return (0); |
1107 } | |
1108 } | |
1109 } | |
1110 /* all set and ready to fly */ | |
1111 XMenuRecompute (XDISPLAY GXMenu); | |
1112 dispwidth = DisplayWidth (x_current_display, XDefaultScreen (x_current_display)); | |
1113 dispheight = DisplayHeight (x_current_display, XDefaultScreen (x_current_display)); | |
1114 startx = min (startx, dispwidth); | |
1115 starty = min (starty, dispheight); | |
1116 startx = max (startx, 1); | |
1117 starty = max (starty, 1); | |
1118 XMenuLocate (XDISPLAY GXMenu, 0, 0, startx, starty, | |
1119 &ulx, &uly, &width, &height); | |
1120 if (ulx+width > dispwidth) | |
1121 { | |
1122 startx -= (ulx + width) - dispwidth; | |
1123 ulx = dispwidth - width; | |
1124 } | |
1125 if (uly+height > dispheight) | |
1126 { | |
1127 starty -= (uly + height) - dispheight; | |
1128 uly = dispheight - height; | |
1129 } | |
1130 if (ulx < 0) startx -= ulx; | |
1131 if (uly < 0) starty -= uly; | |
1132 | |
1133 XMenuSetFreeze (GXMenu, TRUE); | |
1134 panes = selidx = 0; | |
1135 | |
1136 status = XMenuActivate (XDISPLAY GXMenu, &panes, &selidx, | |
1137 startx, starty, ButtonReleaseMask, &datap); | |
1138 switch (status) | |
1139 { | |
1140 case XM_SUCCESS: | |
1141 #ifdef XDEBUG | |
1142 fprintf (stderr, "pane= %d line = %d\n", panes, selidx); | |
1143 #endif | |
1144 entry = item_list[panes][selidx]; | |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1145 if (prefixes != 0) |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1146 { |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1147 entry = Fcons (entry, Qnil); |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1148 if (!NILP (prefixes[panes])) |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1149 entry = Fcons (prefixes[panes], entry); |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1150 } |
118 | 1151 break; |
1152 case XM_FAILURE: | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1153 /* free (datap_save); */ |
118 | 1154 XMenuDestroy (XDISPLAY GXMenu); |
1155 *error = "Can't activate menu"; | |
1156 /* error ("Can't activate menu"); */ | |
1157 case XM_IA_SELECT: | |
1158 case XM_NO_SELECT: | |
1159 entry = Qnil; | |
1160 break; | |
1161 } | |
1162 XMenuDestroy (XDISPLAY GXMenu); | |
2209
7b95f29936cb
(xmenu_show): Do BLOCK_INPUT; unblock just before returning.
Richard M. Stallman <rms@gnu.org>
parents:
2191
diff
changeset
|
1163 UNBLOCK_INPUT; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1164 /* free (datap_save);*/ |
118 | 1165 return (entry); |
1166 } | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1167 #endif /* not USE_X_TOOLKIT */ |
118 | 1168 |
1169 syms_of_xmenu () | |
1170 { | |
5673
7035bc81858b
Find lwlib.h and xlwmenuP.h in ../lwlib.
Richard M. Stallman <rms@gnu.org>
parents:
5602
diff
changeset
|
1171 popup_id_tick = (1<<16); |
118 | 1172 defsubr (&Sx_popup_menu); |
1173 } | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1174 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1175 /* Construct the vectors that describe a menu |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1176 and store them in *VECTOR, *PANES, *NAMES, *ENABLES and *ITEMS. |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1177 Each of those four values is a vector indexed by pane number. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1178 Return the number of panes. |
118 | 1179 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1180 KEYMAPS is a vector of keymaps. NMAPS gives the length of KEYMAPS. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1181 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1182 int |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1183 keymap_panes (vector, panes, names, enables, items, prefixes, keymaps, nmaps) |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1184 Lisp_Object ***vector; /* RETURN all menu objects */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1185 char ***panes; /* RETURN pane names */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1186 char ****names; /* RETURN all line names */ |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1187 int ***enables; /* RETURN enable-flags of lines */ |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1188 int **items; /* RETURN number of items per pane */ |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1189 Lisp_Object **prefixes; /* RETURN vector of prefix keys, per pane */ |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1190 Lisp_Object *keymaps; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1191 int nmaps; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1192 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1193 /* Number of panes we have made. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1194 int p = 0; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1195 /* Number of panes we have space for. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1196 int npanes_allocated = nmaps; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1197 int mapno; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1198 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1199 if (npanes_allocated < 4) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1200 npanes_allocated = 4; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1201 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1202 /* Make space for an estimated number of panes. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1203 *vector = (Lisp_Object **) xmalloc (npanes_allocated * sizeof (Lisp_Object *)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1204 *panes = (char **) xmalloc (npanes_allocated * sizeof (char *)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1205 *items = (int *) xmalloc (npanes_allocated * sizeof (int)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1206 *names = (char ***) xmalloc (npanes_allocated * sizeof (char **)); |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1207 *enables = (int **) xmalloc (npanes_allocated * sizeof (int *)); |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1208 *prefixes = (Lisp_Object *) xmalloc (npanes_allocated * sizeof (Lisp_Object)); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1209 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1210 /* Loop over the given keymaps, making a pane for each map. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1211 But don't make a pane that is empty--ignore that map instead. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1212 P is the number of panes we have made so far. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1213 for (mapno = 0; mapno < nmaps; mapno++) |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1214 single_keymap_panes (keymaps[mapno], panes, vector, names, enables, items, |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1215 prefixes, &p, &npanes_allocated, ""); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1216 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1217 /* Return the number of panes. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1218 return p; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1219 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1220 |
5809
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1221 /* This is used as the handler when calling internal_condition_case_1. */ |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1222 |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1223 static Lisp_Object |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1224 single_keymap_panes_1 (arg) |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1225 Lisp_Object arg; |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1226 { |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1227 return Qnil; |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1228 } |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1229 |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1230 /* This is a recursive subroutine of keymap_panes. |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1231 It handles one keymap, KEYMAP. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1232 The other arguments are passed along |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1233 or point to local variables of the previous function. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1234 |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1235 single_keymap_panes (keymap, panes, vector, names, enables, items, prefixes, |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1236 p_ptr, npanes_allocated_ptr, pane_name) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1237 Lisp_Object keymap; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1238 Lisp_Object ***vector; /* RETURN all menu objects */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1239 char ***panes; /* RETURN pane names */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1240 char ****names; /* RETURN all line names */ |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1241 int ***enables; /* RETURN enable flags of lines */ |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1242 int **items; /* RETURN number of items per pane */ |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1243 Lisp_Object **prefixes; /* RETURN vector of prefix keys, per pane */ |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1244 int *p_ptr; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1245 int *npanes_allocated_ptr; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1246 char *pane_name; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1247 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1248 int i; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1249 Lisp_Object pending_maps; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1250 Lisp_Object tail, item, item1, item2, table; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1251 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1252 pending_maps = Qnil; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1253 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1254 /* Make sure we have room for another pane. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1255 if (*p_ptr == *npanes_allocated_ptr) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1256 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1257 *npanes_allocated_ptr *= 2; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1258 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1259 *vector |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1260 = (Lisp_Object **) xrealloc (*vector, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1261 *npanes_allocated_ptr * sizeof (Lisp_Object *)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1262 *panes |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1263 = (char **) xrealloc (*panes, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1264 *npanes_allocated_ptr * sizeof (char *)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1265 *items |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1266 = (int *) xrealloc (*items, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1267 *npanes_allocated_ptr * sizeof (int)); |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1268 *prefixes |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1269 = (Lisp_Object *) xrealloc (*prefixes, |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1270 (*npanes_allocated_ptr |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1271 * sizeof (Lisp_Object))); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1272 *names |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1273 = (char ***) xrealloc (*names, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1274 *npanes_allocated_ptr * sizeof (char **)); |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1275 *enables |
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1276 = (int **) xrealloc (*enables, |
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1277 *npanes_allocated_ptr * sizeof (int *)); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1278 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1279 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1280 /* When a menu comes from keymaps, don't give names to the panes. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1281 (*panes)[*p_ptr] = pane_name; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1282 |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1283 /* Normally put nil as pane's prefix key. |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1284 Caller will override this if appropriate. */ |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1285 (*prefixes)[*p_ptr] = Qnil; |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1286 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1287 /* Get the length of the list level of the keymap. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1288 i = XFASTINT (Flength (keymap)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1289 |
1213
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1290 /* Add in lengths of any arrays. */ |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1291 for (tail = keymap; XTYPE (tail) == Lisp_Cons; tail = XCONS (tail)->cdr) |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1292 if (XTYPE (XCONS (tail)->car) == Lisp_Vector) |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1293 i += XVECTOR (XCONS (tail)->car)->size; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1294 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1295 /* Create vectors for the names and values of the items in the pane. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1296 I is an upper bound for the number of items. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1297 (*vector)[*p_ptr] = (Lisp_Object *) xmalloc (i * sizeof (Lisp_Object)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1298 (*names)[*p_ptr] = (char **) xmalloc (i * sizeof (char *)); |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1299 (*enables)[*p_ptr] = (int *) xmalloc (i * sizeof (int)); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1300 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1301 /* I is now the index of the next unused slots. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1302 i = 0; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1303 for (tail = keymap; XTYPE (tail) == Lisp_Cons; tail = XCONS (tail)->cdr) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1304 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1305 /* Look at each key binding, and if it has a menu string, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1306 make a menu item from it. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1307 item = XCONS (tail)->car; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1308 if (XTYPE (item) == Lisp_Cons) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1309 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1310 item1 = XCONS (item)->cdr; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1311 if (XTYPE (item1) == Lisp_Cons) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1312 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1313 item2 = XCONS (item1)->car; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1314 if (XTYPE (item2) == Lisp_String) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1315 { |
2135
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1316 Lisp_Object def, tem; |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1317 Lisp_Object enabled; |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1318 |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1319 def = Fcdr (item1); |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1320 enabled = Qt; |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1321 if (XTYPE (def) == Lisp_Symbol) |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1322 { |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1323 /* No property, or nil, means enable. |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1324 Otherwise, enable if value is not nil. */ |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1325 tem = Fget (def, Qmenu_enable); |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1326 if (!NILP (tem)) |
5809
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1327 /* (condition-case nil (eval tem) |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1328 (error nil)) */ |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1329 enabled = internal_condition_case_1 (Feval, tem, |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1330 Qerror, |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1331 single_keymap_panes_1); |
2135
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1332 } |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1333 tem = Fkeymapp (def); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1334 if (XSTRING (item2)->data[0] == '@' && !NILP (tem)) |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1335 pending_maps = Fcons (Fcons (def, Fcons (item2, XCONS (item)->car)), |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1336 pending_maps); |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1337 else |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1338 { |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1339 (*names)[*p_ptr][i] = (char *) XSTRING (item2)->data; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1340 /* The menu item "value" is the key bound here. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1341 (*vector)[*p_ptr][i] = XCONS (item)->car; |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1342 (*enables)[*p_ptr][i] |
2191
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1343 = (NILP (def) ? -1 : !NILP (enabled) ? 1 : 0); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1344 i++; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1345 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1346 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1347 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1348 } |
1213
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1349 else if (XTYPE (item) == Lisp_Vector) |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1350 { |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1351 /* Loop over the char values represented in the vector. */ |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1352 int len = XVECTOR (item)->size; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1353 int c; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1354 for (c = 0; c < len; c++) |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1355 { |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1356 Lisp_Object character; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1357 XFASTINT (character) = c; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1358 item1 = XVECTOR (item)->contents[c]; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1359 if (XTYPE (item1) == Lisp_Cons) |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1360 { |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1361 item2 = XCONS (item1)->car; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1362 if (XTYPE (item2) == Lisp_String) |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1363 { |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1364 Lisp_Object tem; |
2135
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1365 Lisp_Object def; |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1366 Lisp_Object enabled; |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1367 |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1368 def = Fcdr (item1); |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1369 enabled = Qt; |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1370 if (XTYPE (def) == Lisp_Symbol) |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1371 { |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1372 tem = Fget (def, Qmenu_enable); |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1373 /* No property, or nil, means enable. |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1374 Otherwise, enable if value is not nil. */ |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1375 if (!NILP (tem)) |
5809
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1376 /* (condition-case nil (eval tem) |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1377 (error nil)) */ |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1378 enabled = internal_condition_case_1 (Feval, tem, |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1379 Qerror, |
1493700a3d78
(single_keymap_panes): Use internal_condition_case_1.
Richard M. Stallman <rms@gnu.org>
parents:
5775
diff
changeset
|
1380 single_keymap_panes_1); |
2135
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1381 } |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1382 |
0634d08c28d1
(syms_of_xmenu): Set up Qmenu_enable.
Richard M. Stallman <rms@gnu.org>
parents:
1933
diff
changeset
|
1383 tem = Fkeymapp (def); |
1213
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1384 if (XSTRING (item2)->data[0] == '@' && !NILP (tem)) |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1385 pending_maps = Fcons (Fcons (def, Fcons (item2, character)), |
1213
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1386 pending_maps); |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1387 else |
1213
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1388 { |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1389 (*names)[*p_ptr][i] = (char *) XSTRING (item2)->data; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1390 /* The menu item "value" is the key bound here. */ |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1391 (*vector)[*p_ptr][i] = character; |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1392 (*enables)[*p_ptr][i] |
2191
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1393 = (NILP (def) ? -1 : !NILP (enabled) ? 1 : 0); |
1213
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1394 i++; |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1395 } |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1396 } |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1397 } |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1398 } |
0901fe62d97b
(single_keymap_panes): Handle vectors properly.
Richard M. Stallman <rms@gnu.org>
parents:
1210
diff
changeset
|
1399 } |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1400 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1401 /* Record the number of items in the pane. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1402 (*items)[*p_ptr] = i; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1403 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1404 /* If we just made an empty pane, get rid of it. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1405 if (i == 0) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1406 { |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
1407 xfree ((*vector)[*p_ptr]); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
1408 xfree ((*names)[*p_ptr]); |
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2209
diff
changeset
|
1409 xfree ((*enables)[*p_ptr]); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1410 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1411 /* Otherwise, advance past it. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1412 else |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1413 (*p_ptr)++; |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1414 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1415 /* Process now any submenus which want to be panes at this level. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1416 while (!NILP (pending_maps)) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1417 { |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1418 Lisp_Object elt, eltcdr; |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1419 int panenum = *p_ptr; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1420 elt = Fcar (pending_maps); |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1421 eltcdr = XCONS (elt)->cdr; |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1422 single_keymap_panes (Fcar (elt), panes, vector, names, enables, items, |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1423 prefixes, p_ptr, npanes_allocated_ptr, |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1424 /* Add 1 to discard the @. */ |
2747
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1425 (char *) XSTRING (XCONS (eltcdr)->car)->data + 1); |
f258c79c9162
(Fx_popup_menu): Add a vector of prefix keys for the panes.
Richard M. Stallman <rms@gnu.org>
parents:
2514
diff
changeset
|
1426 (*prefixes)[panenum] = XCONS (eltcdr)->cdr; |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1427 pending_maps = Fcdr (pending_maps); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1428 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1429 } |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1430 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1431 /* Construct the vectors that describe a menu |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1432 and store them in *VECTOR, *PANES, *NAMES, *ENABLES and *ITEMS. |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1433 Each of those four values is a vector indexed by pane number. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1434 Return the number of panes. |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1435 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1436 MENU is the argument that was given to Fx_popup_menu. */ |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1437 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1438 int |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1439 list_of_panes (vector, panes, names, enables, items, menu) |
118 | 1440 Lisp_Object ***vector; /* RETURN all menu objects */ |
1441 char ***panes; /* RETURN pane names */ | |
1442 char ****names; /* RETURN all line names */ | |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1443 int ***enables; /* RETURN enable flags of lines */ |
118 | 1444 int **items; /* RETURN number of items per pane */ |
1445 Lisp_Object menu; | |
1446 { | |
1447 Lisp_Object tail, item, item1; | |
1448 int i; | |
1449 | |
1450 if (XTYPE (menu) != Lisp_Cons) menu = wrong_type_argument (Qlistp, menu); | |
1451 | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1452 i = XFASTINT (Flength (menu)); |
118 | 1453 |
1454 *vector = (Lisp_Object **) xmalloc (i * sizeof (Lisp_Object *)); | |
1455 *panes = (char **) xmalloc (i * sizeof (char *)); | |
1456 *items = (int *) xmalloc (i * sizeof (int)); | |
1457 *names = (char ***) xmalloc (i * sizeof (char **)); | |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1458 *enables = (int **) xmalloc (i * sizeof (int *)); |
118 | 1459 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1460 for (i = 0, tail = menu; !NILP (tail); tail = Fcdr (tail), i++) |
118 | 1461 { |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1462 item = Fcdr (Fcar (tail)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1463 if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item); |
118 | 1464 #ifdef XDEBUG |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1465 fprintf (stderr, "list_of_panes check tail, i=%d\n", i); |
118 | 1466 #endif |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1467 item1 = Fcar (Fcar (tail)); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1468 CHECK_STRING (item1, 1); |
118 | 1469 #ifdef XDEBUG |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1470 fprintf (stderr, "list_of_panes check pane, i=%d%s\n", i, |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1471 XSTRING (item1)->data); |
118 | 1472 #endif |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1473 (*panes)[i] = (char *) XSTRING (item1)->data; |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1474 (*items)[i] = list_of_items ((*vector)+i, (*names)+i, (*enables)+i, item); |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1475 /* (*panes)[i] = (char *) xmalloc ((XSTRING (item1)->size)+1); |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1476 bcopy (XSTRING (item1)->data, (*panes)[i], XSTRING (item1)->size + 1) |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1477 ; */ |
118 | 1478 } |
1479 return i; | |
1480 } | |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1481 |
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1482 /* Construct the lists of values and names for a single pane, from the |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1483 alist PANE. Put them in *VECTOR and *NAMES. Put the enable flags |
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1484 int *ENABLES. Return the number of items. */ |
118 | 1485 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1486 int |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1487 list_of_items (vector, names, enables, pane) |
118 | 1488 Lisp_Object **vector; /* RETURN menu "objects" */ |
1489 char ***names; /* RETURN line names */ | |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1490 int **enables; /* RETURN enable flags of lines */ |
118 | 1491 Lisp_Object pane; |
1492 { | |
1493 Lisp_Object tail, item, item1; | |
1494 int i; | |
1495 | |
1496 if (XTYPE (pane) != Lisp_Cons) pane = wrong_type_argument (Qlistp, pane); | |
1497 | |
1933
63ba4f555b90
* minibuf.c (Fdisplay_completion_list): Pass the proper number of
Jim Blandy <jimb@redhat.com>
parents:
1828
diff
changeset
|
1498 i = XFASTINT (Flength (pane)); |
118 | 1499 |
1500 *vector = (Lisp_Object *) xmalloc (i * sizeof (Lisp_Object)); | |
1501 *names = (char **) xmalloc (i * sizeof (char *)); | |
2160
0639c52f017c
(xmenu_show): New arg enable_list.
Richard M. Stallman <rms@gnu.org>
parents:
2153
diff
changeset
|
1502 *enables = (int *) xmalloc (i * sizeof (int)); |
118 | 1503 |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1504 for (i = 0, tail = pane; !NILP (tail); tail = Fcdr (tail), i++) |
118 | 1505 { |
1082
d24afc1bef38
(xmenu_show): If no panes, just return.
Richard M. Stallman <rms@gnu.org>
parents:
975
diff
changeset
|
1506 item = Fcar (tail); |
2191
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1507 if (STRINGP (item)) |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1508 { |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1509 (*vector)[i] = Qnil; |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1510 (*names)[i] = (char *) XSTRING (item)->data; |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1511 (*enables)[i] = -1; |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1512 } |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1513 else |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1514 { |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1515 CHECK_CONS (item, 0); |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1516 (*vector)[i] = Fcdr (item); |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1517 item1 = Fcar (item); |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1518 CHECK_STRING (item1, 1); |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1519 (*names)[i] = (char *) XSTRING (item1)->data; |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1520 (*enables)[i] = 1; |
12480fa04422
(list_of_items): Allow strings among the alist items;
Richard M. Stallman <rms@gnu.org>
parents:
2160
diff
changeset
|
1521 } |
118 | 1522 } |
1523 return i; | |
1524 } |