comparison src/xmenu.c @ 5865:8dc616f310e8

(xmenu_show ) [USE_X_TOOLKIT]: Implement a Motif behavior for the menubar. Now, if you move the pointer on another menubar item while displaying the contents of a selected menubar item, the current pulldown menu is closed and the new one corresponding to the new pointed item is displayed. Clean up code. Handle the MotionNotify events in the XEvent loop.
author Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
date Wed, 09 Feb 1994 13:51:25 +0000
parents 1493700a3d78
children 678a8470e4d1
comparison
equal deleted inserted replaced
5864:3e0d51feb34f 5865:8dc616f310e8
857 int x; 857 int x;
858 int y; 858 int y;
859 int menubarp; 859 int menubarp;
860 widget_value *vw; 860 widget_value *vw;
861 { 861 {
862 int menu_id, id = (int)f; 862 int menu_id, item_length;
863 Lisp_Object selection; 863 Lisp_Object selection;
864 Widget menu; 864 Widget menu;
865 XlwMenuWidget menuw = (XlwMenuWidget) f->display.x->menubar_widget;
865 866
866 /* 867 /*
867 * Define and allocate a foreign event queue to hold events 868 * Define and allocate a foreign event queue to hold events
868 * that don't belong to XMenu. These events are later restored 869 * that don't belong to XMenu. These events are later restored
869 * to the X event queue. 870 * to the X event queue.
913 914
914 /* We activate directly the lucid implementation */ 915 /* We activate directly the lucid implementation */
915 pop_up_menu (mw, &dummy); 916 pop_up_menu (mw, &dummy);
916 } 917 }
917 918
919 if (menubarp)
920 {
921 item_length = (x + string_width (menuw, vw->name)
922 + (2 * (menuw->menu.horizontal_spacing
923 + menuw->menu.shadow_thickness))
924 - 4);
925 }
926
918 /* Enters XEvent loop */ 927 /* Enters XEvent loop */
919 while (1) 928 while (1)
920 { 929 {
921 930
922 XEvent event; 931 XEvent event;
927 break; 936 break;
928 } 937 }
929 else 938 else
930 if (event.type == Expose) 939 if (event.type == Expose)
931 process_expose_from_menu (event); 940 process_expose_from_menu (event);
941 else
942 if (event.type == MotionNotify
943 && menubarp
944 && ((event.xmotion.y_root
945 >= (f->display.x->widget->core.y
946 + f->display.x->widget->core.border_width))
947 && (event.xmotion.y_root
948 < (f->display.x->widget->core.y
949 + f->display.x->widget->core.border_width
950 + f->display.x->menubar_widget->core.height)))
951 && (event.xmotion.x_root >= item_length
952 || event.xmotion.x_root < (x - 4)))
953 {
954 BLOCK_INPUT;
955 XtUngrabPointer ((Widget)
956 ((XlwMenuWidget)
957 ((CompositeWidget)menu)->composite.children[0]),
958 event.xbutton.time);
959 lw_destroy_all_widgets (menu_id);
960 UNBLOCK_INPUT;
961
962 event.type = ButtonPress;
963 event.xbutton.time = CurrentTime;
964 event.xbutton.button = Button1;
965 event.xbutton.window = XtWindow (f->display.x->menubar_widget);
966 event.xbutton.x = (event.xbutton.x_root
967 - (f->display.x->widget->core.x
968 + f->display.x->widget->core.border_width));
969 XPutBackEvent (XDISPLAY &event);
970 break;
971 }
972
932 XtDispatchEvent (&event); 973 XtDispatchEvent (&event);
933 feq_tmp = (XMEventQue *) malloc (sizeof (XMEventQue)); 974 feq_tmp = (XMEventQue *) malloc (sizeof (XMEventQue));
934 975
935 if (feq_tmp == NULL) 976 if (feq_tmp == NULL)
936 return(Qnil); 977 return(Qnil);