comparison src/menubar-x.c @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents d883f39b8495
children bbff43aa5eb7
comparison
equal deleted inserted replaced
379:76b7d63099ad 380:8626e4521993
25 25
26 #include <config.h> 26 #include <config.h>
27 #include "lisp.h" 27 #include "lisp.h"
28 28
29 #include "console-x.h" 29 #include "console-x.h"
30 #include "EmacsManager.h"
31 #include "EmacsFrame.h" 30 #include "EmacsFrame.h"
32 #include "EmacsShell.h"
33 #include "gui-x.h" 31 #include "gui-x.h"
34 32
35 #include "buffer.h" 33 #include "buffer.h"
36 #include "commands.h" /* zmacs_regions */ 34 #include "commands.h" /* zmacs_regions */
37 #include "gui.h" 35 #include "gui.h"
162 while (key = Fcar (desc), KEYWORDP (key)) 160 while (key = Fcar (desc), KEYWORDP (key))
163 { 161 {
164 Lisp_Object cascade = desc; 162 Lisp_Object cascade = desc;
165 desc = Fcdr (desc); 163 desc = Fcdr (desc);
166 if (NILP (desc)) 164 if (NILP (desc))
167 signal_simple_error ("keyword in menu lacks a value", 165 signal_simple_error ("Keyword in menu lacks a value",
168 cascade); 166 cascade);
169 val = Fcar (desc); 167 val = Fcar (desc);
170 desc = Fcdr (desc); 168 desc = Fcdr (desc);
171 if (EQ (key, Q_included)) 169 if (EQ (key, Q_included))
172 include_p = val, included_spec = 1; 170 include_p = val, included_spec = 1;
187 else if (EQ (key, Q_label)) 185 else if (EQ (key, Q_label))
188 { 186 {
189 /* implement in 21.2 */ 187 /* implement in 21.2 */
190 } 188 }
191 else 189 else
192 signal_simple_error ("unknown menu cascade keyword", cascade); 190 signal_simple_error ("Unknown menu cascade keyword", cascade);
193 } 191 }
194 192
195 if ((!NILP (config_tag) 193 if ((!NILP (config_tag)
196 && NILP (Fmemq (config_tag, Vmenubar_configuration))) 194 && NILP (Fmemq (config_tag, Vmenubar_configuration)))
197 || (included_spec && NILP (Feval (include_p)))) 195 || (included_spec && NILP (Feval (include_p))))
200 goto menu_item_done; 198 goto menu_item_done;
201 } 199 }
202 200
203 if (active_spec) 201 if (active_spec)
204 active_p = Feval (active_p); 202 active_p = Feval (active_p);
205 203
206 if (!NILP (hook_fn) && !NILP (active_p)) 204 if (!NILP (hook_fn) && !NILP (active_p))
207 { 205 {
208 #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF 206 #if defined LWLIB_MENUBARS_LUCID || defined LWLIB_MENUBARS_MOTIF
209 if (filter_p || depth == 0) 207 if (filter_p || depth == 0)
210 { 208 {
253 { 251 {
254 widget_value *dummy; 252 widget_value *dummy;
255 /* Add a fake entry so the menus show up */ 253 /* Add a fake entry so the menus show up */
256 wv->contents = dummy = xmalloc_widget_value (); 254 wv->contents = dummy = xmalloc_widget_value ();
257 dummy->name = "(inactive)"; 255 dummy->name = "(inactive)";
258 dummy->accel = NULL; 256 dummy->accel = LISP_TO_VOID (Qnil);
259 dummy->enabled = 0; 257 dummy->enabled = 0;
260 dummy->selected = 0; 258 dummy->selected = 0;
261 dummy->value = NULL; 259 dummy->value = NULL;
262 dummy->type = BUTTON_TYPE; 260 dummy->type = BUTTON_TYPE;
263 dummy->call_data = NULL; 261 dummy->call_data = NULL;
264 dummy->next = NULL; 262 dummy->next = NULL;
265 263
266 goto menu_item_done; 264 goto menu_item_done;
267 } 265 }
268 266
269 } 267 }
270 else if (menubar_root_p) 268 else if (menubar_root_p)
273 wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and 271 wv->type = CASCADE_TYPE; /* Well, nothing else seems to fit and
274 this is ignored anyway... */ 272 this is ignored anyway... */
275 } 273 }
276 else 274 else
277 { 275 {
278 signal_simple_error ("menu name (first element) must be a string", 276 signal_simple_error ("Menu name (first element) must be a string",
279 desc); 277 desc);
280 } 278 }
281 279
282 if (deep_p || menubar_root_p) 280 if (deep_p || menubar_root_p)
283 { 281 {
284 widget_value *next; 282 widget_value *next;
285 for (; !NILP (desc); desc = Fcdr (desc)) 283 for (; !NILP (desc); desc = Fcdr (desc))
286 { 284 {
287 Lisp_Object child = Fcar (desc); 285 Lisp_Object child = Fcar (desc);
288 if (menubar_root_p && NILP (child)) /* the partition */ 286 if (menubar_root_p && NILP (child)) /* the partition */
289 { 287 {
290 if (partition_seen) 288 if (partition_seen)
291 error ( 289 error (
292 "more than one partition (nil) in menubar description"); 290 "More than one partition (nil) in menubar description");
293 partition_seen = 1; 291 partition_seen = 1;
294 next = xmalloc_widget_value (); 292 next = xmalloc_widget_value ();
295 next->type = PUSHRIGHT_TYPE; 293 next->type = PUSHRIGHT_TYPE;
296 } 294 }
297 else 295 else
312 wv = NULL; 310 wv = NULL;
313 } 311 }
314 else if (NILP (desc)) 312 else if (NILP (desc))
315 error ("nil may not appear in menu descriptions"); 313 error ("nil may not appear in menu descriptions");
316 else 314 else
317 signal_simple_error ("unrecognized menu descriptor", desc); 315 signal_simple_error ("Unrecognized menu descriptor", desc);
318 316
319 menu_item_done: 317 menu_item_done:
320 318
321 if (wv) 319 if (wv)
322 { 320 {
613 XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer; 611 XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer;
614 return menubar_visible; 612 return menubar_visible;
615 } 613 }
616 614
617 615
618 /* Called from x_create_widgets() to create the inital menubar of a frame 616 /* Called from x_create_widgets() to create the initial menubar of a frame
619 before it is mapped, so that the window is mapped with the menubar already 617 before it is mapped, so that the window is mapped with the menubar already
620 there instead of us tacking it on later and thrashing the window after it 618 there instead of us tacking it on later and thrashing the window after it
621 is visible. */ 619 is visible. */
622 int 620 int
623 x_initialize_frame_menubar (struct frame *f) 621 x_initialize_frame_menubar (struct frame *f)
682 XtGetValues (shell, al, 2); 680 XtGetValues (shell, al, 2);
683 XtSetArg (al [0], XtNx, &framex); 681 XtSetArg (al [0], XtNx, &framex);
684 XtSetArg (al [1], XtNy, &framey); 682 XtSetArg (al [1], XtNy, &framey);
685 XtGetValues (daddy, al, 2); 683 XtGetValues (daddy, al, 2);
686 btn->x_root = shellx + framex + btn->x; 684 btn->x_root = shellx + framex + btn->x;
687 btn->y_root = shelly + framey + btn->y;; 685 btn->y_root = shelly + framey + btn->y;
688 btn->state = ButtonPressMask; /* all buttons pressed */ 686 btn->state = ButtonPressMask; /* all buttons pressed */
689 } 687 }
690 else 688 else
691 { 689 {
692 /* CurrentTime is just ZERO, so it's worthless for 690 /* CurrentTime is just ZERO, so it's worthless for