comparison src/keyboard.c @ 11654:47ceabade5b2

(kbd_buffer_get_event): New arg USED_MOUSE_MENU. [USE_X_TOOLKIT]: Set *USED_MOUSE_MENU if returning menu-bar symbols. (read_char): Pass used_mouse_menu to kbd_buffer_get_event. This variable is now meaningful for toolkit menus as well as non-toolkit menus.
author Karl Heuer <kwzh@gnu.org>
date Tue, 02 May 1995 04:41:26 +0000
parents c4ef6460a9c9
children 5ec9a02755ec
comparison
equal deleted inserted replaced
11653:5416e2c64d19 11654:47ceabade5b2
1610 MAPS is an array of keymaps; NMAPS is the length of MAPS. 1610 MAPS is an array of keymaps; NMAPS is the length of MAPS.
1611 1611
1612 PREV_EVENT is the previous input event, or nil if we are reading 1612 PREV_EVENT is the previous input event, or nil if we are reading
1613 the first event of a key sequence. 1613 the first event of a key sequence.
1614 1614
1615 If USED_MOUSE_MENU is non-zero, then we set *USED_MOUSE_MENU to 1 1615 If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1
1616 if we used a mouse menu to read the input, or zero otherwise. If 1616 if we used a mouse menu to read the input, or zero otherwise. If
1617 USED_MOUSE_MENU is zero, *USED_MOUSE_MENU is left alone. 1617 USED_MOUSE_MENU is null, we don't dereference it.
1618 1618
1619 Value is t if we showed a menu and the user rejected it. */ 1619 Value is t if we showed a menu and the user rejected it. */
1620 1620
1621 Lisp_Object 1621 Lisp_Object
1622 read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) 1622 read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
1933 KBOARD *kb; 1933 KBOARD *kb;
1934 1934
1935 /* Actually read a character, waiting if necessary. */ 1935 /* Actually read a character, waiting if necessary. */
1936 save_getcjmp (save_jump); 1936 save_getcjmp (save_jump);
1937 restore_getcjmp (local_getcjmp); 1937 restore_getcjmp (local_getcjmp);
1938 c = kbd_buffer_get_event (&kb); 1938 c = kbd_buffer_get_event (&kb, used_mouse_menu);
1939 restore_getcjmp (save_jump); 1939 restore_getcjmp (save_jump);
1940 1940
1941 #ifdef MULTI_KBOARD 1941 #ifdef MULTI_KBOARD
1942 if (! NILP (c) && (kb != current_kboard)) 1942 if (! NILP (c) && (kb != current_kboard))
1943 { 1943 {
2395 The value is nil for an event that should be ignored, 2395 The value is nil for an event that should be ignored,
2396 or that was handled here. 2396 or that was handled here.
2397 We always read and discard one event. */ 2397 We always read and discard one event. */
2398 2398
2399 static Lisp_Object 2399 static Lisp_Object
2400 kbd_buffer_get_event (kbp) 2400 kbd_buffer_get_event (kbp, used_mouse_menu)
2401 KBOARD **kbp; 2401 KBOARD **kbp;
2402 int *used_mouse_menu;
2402 { 2403 {
2403 register int c; 2404 register int c;
2404 Lisp_Object obj; 2405 Lisp_Object obj;
2405 2406
2406 if (noninteractive) 2407 if (noninteractive)
2576 and build a real event from the queue entry. */ 2577 and build a real event from the queue entry. */
2577 2578
2578 if (NILP (obj)) 2579 if (NILP (obj))
2579 { 2580 {
2580 obj = make_lispy_event (event); 2581 obj = make_lispy_event (event);
2582 #ifdef USE_X_TOOLKIT
2583 /* If this was a menu selection, then set the flag to inhibit
2584 writing to last_nonmenu_event. Don't do this if the event
2585 we're returning is (menu-bar), though; that indicates the
2586 beginning of the menu sequence, and we might as well leave
2587 that as the `event with parameters' for this selection. */
2588 if (event->kind == menu_bar_event
2589 && !(CONSP (obj) && EQ (XCONS (obj)->car, Qmenu_bar))
2590 && used_mouse_menu)
2591 *used_mouse_menu = 1;
2592 #endif
2581 2593
2582 /* Wipe out this event, to catch bugs. */ 2594 /* Wipe out this event, to catch bugs. */
2583 event->kind = no_event; 2595 event->kind = no_event;
2584 XVECTOR (kbd_buffer_frame_or_window)->contents[event - kbd_buffer] = Qnil; 2596 XVECTOR (kbd_buffer_frame_or_window)->contents[event - kbd_buffer] = Qnil;
2585 2597
4568 Return t if we displayed a menu but the user rejected it. 4580 Return t if we displayed a menu but the user rejected it.
4569 4581
4570 PREV_EVENT is the previous input event, or nil if we are reading 4582 PREV_EVENT is the previous input event, or nil if we are reading
4571 the first event of a key sequence. 4583 the first event of a key sequence.
4572 4584
4573 If USED_MOUSE_MENU is non-zero, then we set *USED_MOUSE_MENU to 1 4585 If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1
4574 if we used a mouse menu to read the input, or zero otherwise. If 4586 if we used a mouse menu to read the input, or zero otherwise. If
4575 USED_MOUSE_MENU is zero, *USED_MOUSE_MENU is left alone. 4587 USED_MOUSE_MENU is null, we don't dereference it.
4576 4588
4577 The prompting is done based on the prompt-string of the map 4589 The prompting is done based on the prompt-string of the map
4578 and the strings associated with various map elements. 4590 and the strings associated with various map elements.
4579 4591
4580 This can be done with X menus or with menus put in the minibuf. 4592 This can be done with X menus or with menus put in the minibuf.