aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Pierresteguy1994-02-09 13:51:25 +0000
committerFred Pierresteguy1994-02-09 13:51:25 +0000
commit47e8f9a32221e397ea6ead42d3a0ecdf1f991c2a (patch)
treeba195a0938bda2bdedea6c226fe0229ab7252acc
parent07ff9ea94bad29f965503a999a146dcc91a52e28 (diff)
downloademacs-47e8f9a32221e397ea6ead42d3a0ecdf1f991c2a.tar.gz
emacs-47e8f9a32221e397ea6ead42d3a0ecdf1f991c2a.zip
(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.
-rw-r--r--src/xmenu.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index 498eb501fe2..027b4f7f68c 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -859,9 +859,10 @@ xmenu_show (f, val, x, y, menubarp, vw)
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
@@ -915,6 +916,14 @@ xmenu_show (f, val, x, y, menubarp, vw)
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 {
@@ -929,6 +938,38 @@ xmenu_show (f, val, x, y, menubarp, vw)
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