aboutsummaryrefslogtreecommitdiffstats
path: root/lwlib
diff options
context:
space:
mode:
authorPaul Reilly1994-09-23 21:02:25 +0000
committerPaul Reilly1994-09-23 21:02:25 +0000
commit4cc76151a78729491e07f9d035f5122a6749aabd (patch)
tree35dc6536712d4c6d4ce38b9b5cdd3185b850813d /lwlib
parent30d653c4016b637ac3bf47ccf71278568f3754c0 (diff)
downloademacs-4cc76151a78729491e07f9d035f5122a6749aabd.tar.gz
emacs-4cc76151a78729491e07f9d035f5122a6749aabd.zip
*** empty log message ***
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/xlwmenu.c68
1 files changed, 40 insertions, 28 deletions
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index e53a1074638..7b7c3b3adbf 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -1327,28 +1327,21 @@ Start (w, ev, params, num_params)
1327 if (!mw->menu.popped_up) 1327 if (!mw->menu.popped_up)
1328 { 1328 {
1329 menu_post_event = *ev; 1329 menu_post_event = *ev;
1330 next_release_must_exit = 0; 1330 pop_up_menu (mw, ev);
1331 } 1331 }
1332 else 1332 else
1333 /* If we push a button while the menu is posted semipermanently, 1333 {
1334 releasing the button should always pop the menu down. */ 1334 /* If we push a button while the menu is posted semipermanently,
1335 next_release_must_exit = 1; 1335 releasing the button should always pop the menu down. */
1336 next_release_must_exit = 1;
1336 1337
1337 XtCallCallbackList ((Widget)mw, mw->menu.open, NULL); 1338 /* notes the absolute position of the menubar window */
1338 1339 mw->menu.windows [0].x = ev->xmotion.x_root - ev->xmotion.x;
1339 /* notes the absolute position of the menubar window */ 1340 mw->menu.windows [0].y = ev->xmotion.y_root - ev->xmotion.y;
1340 mw->menu.windows [0].x = ev->xmotion.x_root - ev->xmotion.x;
1341 mw->menu.windows [0].y = ev->xmotion.y_root - ev->xmotion.y;
1342 1341
1343 /* handles the down like a move, slots are compatible */ 1342 /* handles the down like a move, slots are compatible */
1344 handle_motion_event (mw, &ev->xmotion); 1343 handle_motion_event (mw, &ev->xmotion);
1345 XtGrabPointer ((Widget)mw, False, 1344 }
1346 (PointerMotionMask | PointerMotionHintMask
1347 | ButtonReleaseMask | ButtonPressMask),
1348 GrabModeAsync, GrabModeAsync, None,
1349 mw->menu.cursor_shape,
1350 ((XButtonPressedEvent *)ev)->time);
1351 pointer_grabbed = 1;
1352} 1345}
1353 1346
1354static void 1347static void
@@ -1390,12 +1383,17 @@ Select (w, ev, params, num_params)
1390 { 1383 {
1391 mw->menu.popped_up = False; 1384 mw->menu.popped_up = False;
1392 XtUngrabPointer ((Widget)mw, ev->xmotion.time); 1385 XtUngrabPointer ((Widget)mw, ev->xmotion.time);
1393 XtPopdown (XtParent (mw)); 1386 if (XtIsShell (XtParent (mw)))
1387 XtPopdown (XtParent (mw));
1388 else
1389 {
1390 XtRemoveGrab ((Widget) mw);
1391 display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
1392 }
1394 } 1393 }
1395 1394
1396 /* callback */ 1395 /* callback */
1397 XtCallCallbackList ((Widget)mw, mw->menu.select, (XtPointer)selected_item); 1396 XtCallCallbackList ((Widget)mw, mw->menu.select, (XtPointer)selected_item);
1398
1399} 1397}
1400 1398
1401 1399
@@ -1416,7 +1414,8 @@ pop_up_menu (mw, event)
1416 1414
1417 XtCallCallbackList ((Widget)mw, mw->menu.open, NULL); 1415 XtCallCallbackList ((Widget)mw, mw->menu.open, NULL);
1418 1416
1419 size_menu (mw, 0); 1417 if (XtIsShell (XtParent (mw)))
1418 size_menu (mw, 0);
1420 1419
1421 w = mw->menu.windows [0].width; 1420 w = mw->menu.windows [0].width;
1422 h = mw->menu.windows [0].height; 1421 h = mw->menu.windows [0].height;
@@ -1433,10 +1432,26 @@ pop_up_menu (mw, event)
1433 y = HeightOfScreen (screen) - h - 2 * borderwidth; 1432 y = HeightOfScreen (screen) - h - 2 * borderwidth;
1434 1433
1435 mw->menu.popped_up = True; 1434 mw->menu.popped_up = True;
1436 XtConfigureWidget (XtParent (mw), x, y, w, h, 1435 if (XtIsShell (XtParent (mw)))
1437 XtParent (mw)->core.border_width); 1436 {
1438 XtPopup (XtParent (mw), XtGrabExclusive); 1437 XtConfigureWidget (XtParent (mw), x, y, w, h,
1439 display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL); 1438 XtParent (mw)->core.border_width);
1439 XtPopup (XtParent (mw), XtGrabExclusive);
1440 display_menu (mw, 0, False, NULL, NULL, NULL, NULL, NULL);
1441 mw->menu.windows [0].x = x + borderwidth;
1442 mw->menu.windows [0].y = y + borderwidth;
1443 }
1444 else
1445 {
1446 XEvent *ev = (XEvent *) event;
1447
1448 XtAddGrab ((Widget) mw, True, True);
1449
1450 /* notes the absolute position of the menubar window */
1451 mw->menu.windows [0].x = ev->xmotion.x_root - ev->xmotion.x;
1452 mw->menu.windows [0].y = ev->xmotion.y_root - ev->xmotion.y;
1453 }
1454
1440#ifdef emacs 1455#ifdef emacs
1441 x_catch_errors (); 1456 x_catch_errors ();
1442#endif 1457#endif
@@ -1455,8 +1470,5 @@ pop_up_menu (mw, event)
1455 x_uncatch_errors (); 1470 x_uncatch_errors ();
1456#endif 1471#endif
1457 1472
1458 mw->menu.windows [0].x = x + borderwidth;
1459 mw->menu.windows [0].y = y + borderwidth;
1460
1461 handle_motion_event (mw, (XMotionEvent*)event); 1473 handle_motion_event (mw, (XMotionEvent*)event);
1462} 1474}