diff options
| author | Karoly Lorentey | 2006-06-12 07:27:12 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2006-06-12 07:27:12 +0000 |
| commit | 476e9367ec1f440aa23904b7bc482ea4a3b8041c (patch) | |
| tree | 4f7f5a5e9a6668f908834bb6e216c8fa3727d4b3 /src/xmenu.c | |
| parent | a13f8f50d4cc544d3bbfa78568e82ce09e68bded (diff) | |
| parent | 6b519504c3297595101628e823e72c91e562ab45 (diff) | |
| download | emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.tar.gz emacs-476e9367ec1f440aa23904b7bc482ea4a3b8041c.zip | |
Merged from emacs@sv.gnu.org.
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-294
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-295
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-296
Update from CVS: admin/FOR-RELEASE: Update refcard section.
* emacs@sv.gnu.org/emacs--devo--0--patch-297
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-298
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-299
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-300
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-301
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-302
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-303
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-304
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-103
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-104
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-570
Diffstat (limited to 'src/xmenu.c')
| -rw-r--r-- | src/xmenu.c | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/xmenu.c b/src/xmenu.c index 794a6f22898..48320479ad8 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1310,9 +1310,119 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers) | |||
| 1310 | } | 1310 | } |
| 1311 | } | 1311 | } |
| 1312 | 1312 | ||
| 1313 | DEFUN ("menu-bar-open", Fmenu_bar_open, Smenu_bar_open, 0, 1, "i", | ||
| 1314 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1315 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1316 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1317 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1318 | |||
| 1319 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1320 | (frame) | ||
| 1321 | Lisp_Object frame; | ||
| 1322 | { | ||
| 1323 | XEvent ev; | ||
| 1324 | FRAME_PTR f = check_x_frame (frame); | ||
| 1325 | Widget menubar; | ||
| 1326 | BLOCK_INPUT; | ||
| 1327 | |||
| 1328 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 1329 | set_frame_menubar (f, 0, 1); | ||
| 1330 | |||
| 1331 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | ||
| 1332 | if (menubar) | ||
| 1333 | { | ||
| 1334 | Window child; | ||
| 1335 | int error_p = 0; | ||
| 1336 | |||
| 1337 | x_catch_errors (FRAME_X_DISPLAY (f)); | ||
| 1338 | memset (&ev, 0, sizeof ev); | ||
| 1339 | ev.xbutton.display = FRAME_X_DISPLAY (f); | ||
| 1340 | ev.xbutton.window = XtWindow (menubar); | ||
| 1341 | ev.xbutton.root = FRAME_X_DISPLAY_INFO (f)->root_window; | ||
| 1342 | ev.xbutton.time = XtLastTimestampProcessed (FRAME_X_DISPLAY (f)); | ||
| 1343 | ev.xbutton.button = Button1; | ||
| 1344 | ev.xbutton.x = ev.xbutton.y = FRAME_MENUBAR_HEIGHT (f) / 2; | ||
| 1345 | ev.xbutton.same_screen = True; | ||
| 1346 | |||
| 1347 | #ifdef USE_MOTIF | ||
| 1348 | { | ||
| 1349 | Arg al[2]; | ||
| 1350 | WidgetList list; | ||
| 1351 | Cardinal nr; | ||
| 1352 | XtSetArg (al[0], XtNchildren, &list); | ||
| 1353 | XtSetArg (al[1], XtNnumChildren, &nr); | ||
| 1354 | XtGetValues (menubar, al, 2); | ||
| 1355 | ev.xbutton.window = XtWindow (list[0]); | ||
| 1356 | } | ||
| 1357 | #endif | ||
| 1358 | |||
| 1359 | XTranslateCoordinates (FRAME_X_DISPLAY (f), | ||
| 1360 | /* From-window, to-window. */ | ||
| 1361 | ev.xbutton.window, ev.xbutton.root, | ||
| 1362 | |||
| 1363 | /* From-position, to-position. */ | ||
| 1364 | ev.xbutton.x, ev.xbutton.y, | ||
| 1365 | &ev.xbutton.x_root, &ev.xbutton.y_root, | ||
| 1366 | |||
| 1367 | /* Child of win. */ | ||
| 1368 | &child); | ||
| 1369 | error_p = x_had_errors_p (FRAME_X_DISPLAY (f)); | ||
| 1370 | x_uncatch_errors (); | ||
| 1371 | |||
| 1372 | if (! error_p) | ||
| 1373 | { | ||
| 1374 | ev.type = ButtonPress; | ||
| 1375 | ev.xbutton.state = 0; | ||
| 1376 | |||
| 1377 | XtDispatchEvent (&ev); | ||
| 1378 | ev.xbutton.type = ButtonRelease; | ||
| 1379 | ev.xbutton.state = Button1Mask; | ||
| 1380 | XtDispatchEvent (&ev); | ||
| 1381 | } | ||
| 1382 | } | ||
| 1383 | |||
| 1384 | UNBLOCK_INPUT; | ||
| 1385 | |||
| 1386 | return Qnil; | ||
| 1387 | } | ||
| 1313 | #endif /* USE_X_TOOLKIT */ | 1388 | #endif /* USE_X_TOOLKIT */ |
| 1314 | 1389 | ||
| 1390 | |||
| 1315 | #ifdef USE_GTK | 1391 | #ifdef USE_GTK |
| 1392 | DEFUN ("menu-bar-open", Fmenu_bar_open, Smenu_bar_open, 0, 1, "i", | ||
| 1393 | doc: /* Start key navigation of the menu bar in FRAME. | ||
| 1394 | This initially opens the first menu bar item and you can then navigate with the | ||
| 1395 | arrow keys, select a menu entry with the return key or cancel with the | ||
| 1396 | escape key. If FRAME has no menu bar this function does nothing. | ||
| 1397 | |||
| 1398 | If FRAME is nil or not given, use the selected frame. */) | ||
| 1399 | (frame) | ||
| 1400 | Lisp_Object frame; | ||
| 1401 | { | ||
| 1402 | GtkWidget *menubar; | ||
| 1403 | BLOCK_INPUT; | ||
| 1404 | FRAME_PTR f = check_x_frame (frame); | ||
| 1405 | |||
| 1406 | if (FRAME_EXTERNAL_MENU_BAR (f)) | ||
| 1407 | set_frame_menubar (f, 0, 1); | ||
| 1408 | |||
| 1409 | menubar = FRAME_X_OUTPUT (f)->menubar_widget; | ||
| 1410 | if (menubar) | ||
| 1411 | { | ||
| 1412 | /* Activate the first menu. */ | ||
| 1413 | GList *children = gtk_container_get_children (GTK_CONTAINER (menubar)); | ||
| 1414 | |||
| 1415 | gtk_menu_shell_select_item (GTK_MENU_SHELL (menubar), | ||
| 1416 | GTK_WIDGET (children->data)); | ||
| 1417 | |||
| 1418 | popup_activated_flag = 1; | ||
| 1419 | g_list_free (children); | ||
| 1420 | } | ||
| 1421 | UNBLOCK_INPUT; | ||
| 1422 | |||
| 1423 | return Qnil; | ||
| 1424 | } | ||
| 1425 | |||
| 1316 | /* Loop util popup_activated_flag is set to zero in a callback. | 1426 | /* Loop util popup_activated_flag is set to zero in a callback. |
| 1317 | Used for popup menus and dialogs. */ | 1427 | Used for popup menus and dialogs. */ |
| 1318 | 1428 | ||
| @@ -3704,6 +3814,13 @@ The enable predicate for a menu command should check this variable. */); | |||
| 3704 | #endif | 3814 | #endif |
| 3705 | 3815 | ||
| 3706 | defsubr (&Sx_popup_menu); | 3816 | defsubr (&Sx_popup_menu); |
| 3817 | |||
| 3818 | #if defined (USE_GTK) || defined (USE_X_TOOLKIT) | ||
| 3819 | defsubr (&Smenu_bar_open); | ||
| 3820 | Fdefalias (intern ("accelerate-menu"), intern (Smenu_bar_open.symbol_name), | ||
| 3821 | Qnil); | ||
| 3822 | #endif | ||
| 3823 | |||
| 3707 | #ifdef HAVE_MENUS | 3824 | #ifdef HAVE_MENUS |
| 3708 | defsubr (&Sx_popup_dialog); | 3825 | defsubr (&Sx_popup_dialog); |
| 3709 | #endif | 3826 | #endif |