comparison src/xmenu.c @ 7459:1a6156c8731e

(xmenu_show): New var mb_item. Use it to determine the menubar item that led to the menu. (Fx_popup_menu): Suppress duplicate test case in the way to determine whether the menu is handling a menu bar click.
author Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
date Wed, 11 May 1994 09:33:15 +0000
parents ac210d94f33f
children 2971264ff9aa
comparison
equal deleted inserted replaced
7458:ac210d94f33f 7459:1a6156c8731e
720 x = Fcar (tem); 720 x = Fcar (tem);
721 y = Fcdr (tem); 721 y = Fcdr (tem);
722 722
723 /* Determine whether this menu is handling a menu bar click. */ 723 /* Determine whether this menu is handling a menu bar click. */
724 tem = Fcar (Fcdr (Fcar (Fcdr (position)))); 724 tem = Fcar (Fcdr (Fcar (Fcdr (position))));
725 if (XTYPE (Fcar (position)) != Lisp_Cons 725 if (CONSP (tem) && EQ (Fcar (tem), Qmenu_bar))
726 && CONSP (tem)
727 && EQ (Fcar (tem), Qmenu_bar))
728 menubarp = 1; 726 menubarp = 1;
729 } 727 }
730 } 728 }
731 729
732 CHECK_NUMBER (x, 0); 730 CHECK_NUMBER (x, 0);
1398 /* Figure out which menu bar item, if any, this menu is for. */ 1396 /* Figure out which menu bar item, if any, this menu is for. */
1399 if (menubarp) 1397 if (menubarp)
1400 { 1398 {
1401 int xbeg; 1399 int xbeg;
1402 int xend = 0; 1400 int xend = 0;
1403 1401 widget_value *mb_item = 0;
1404 for (menubar_item = menubar->menu.old_stack[0]->contents; 1402
1405 menubar_item; 1403 for (mb_item = menubar->menu.old_stack[0]->contents;
1406 menubar_item = menubar_item->next) 1404 mb_item;
1405 mb_item = mb_item->next)
1407 { 1406 {
1408 xbeg = xend; 1407 xbeg = xend;
1409 xend += (string_width (menubar, menubar_item->name) 1408 xend += (string_width (menubar, mb_item->name)
1410 + 2 * (menubar->menu.horizontal_spacing 1409 + 2 * (menubar->menu.horizontal_spacing
1411 + menubar->menu.shadow_thickness)); 1410 + menubar->menu.shadow_thickness));
1412 if (x >= xbeg && x < xend) 1411 if (x >= xbeg && x < xend)
1413 { 1412 {
1414 x = xbeg + 4; 1413 x = xbeg + 4;
1415 y = 0; 1414 y = 0;
1415 menubar_item = mb_item;
1416 /* Arrange to show a different menu if we move in the menu bar 1416 /* Arrange to show a different menu if we move in the menu bar
1417 to a different item. */ 1417 to a different item. */
1418 this_menu_bar_item_beg = xbeg; 1418 this_menu_bar_item_beg = xbeg;
1419 this_menu_bar_item_end = xend; 1419 this_menu_bar_item_end = xend;
1420 } 1420 }