aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-09-29 23:34:25 +0300
committerEli Zaretskii2013-09-29 23:34:25 +0300
commitbdaed46f365f1b6c6222f572cd2c4c9574617ea5 (patch)
tree2ba997fc217ba18a011252ed118226a7b8523d0f /src
parent9f8551de937fbc95d4476d18ab1f1b986cfbf90e (diff)
downloademacs-bdaed46f365f1b6c6222f572cd2c4c9574617ea5.tar.gz
emacs-bdaed46f365f1b6c6222f572cd2c4c9574617ea5.zip
Improved horizontal position of TTY dialogs.
Diffstat (limited to 'src')
-rw-r--r--src/menu.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/menu.c b/src/menu.c
index 7c34a9cacd4..3f7aa0c33c3 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1486,26 +1486,30 @@ for instance using the window manager, then this produces a quit and
1486 /* Display a menu with these alternatives 1486 /* Display a menu with these alternatives
1487 in the middle of frame F. */ 1487 in the middle of frame F. */
1488 { 1488 {
1489 Lisp_Object x, y, frame, newpos; 1489 Lisp_Object x, y, frame, newpos, prompt;
1490 int frame_width, frame_height; 1490 int x_coord, y_coord;
1491 1491
1492 prompt = Fcar (contents);
1492 if (FRAME_WINDOW_P (f)) 1493 if (FRAME_WINDOW_P (f))
1493 { 1494 {
1494 frame_width = FRAME_PIXEL_WIDTH (f); 1495 x_coord = FRAME_PIXEL_WIDTH (f);
1495 frame_height = FRAME_PIXEL_HEIGHT (f); 1496 y_coord = FRAME_PIXEL_HEIGHT (f);
1496 } 1497 }
1497 else 1498 else
1498 { 1499 {
1499 frame_width = FRAME_COLS (f); 1500 x_coord = FRAME_COLS (f);
1500 frame_height = FRAME_LINES (f); 1501 /* Center the title at frame middle. (TTY menus have their
1502 upper-left corner at the given position.) */
1503 if (STRINGP (prompt))
1504 x_coord -= SCHARS (prompt);
1505 y_coord = FRAME_LINES (f);
1501 } 1506 }
1502 XSETFRAME (frame, f); 1507 XSETFRAME (frame, f);
1503 XSETINT (x, frame_width / 2); 1508 XSETINT (x, x_coord / 2);
1504 XSETINT (y, frame_height / 2); 1509 XSETINT (y, y_coord / 2);
1505 newpos = list2 (list2 (x, y), frame); 1510 newpos = list2 (list2 (x, y), frame);
1506 1511
1507 return Fx_popup_menu (newpos, 1512 return Fx_popup_menu (newpos, list2 (prompt, contents));
1508 list2 (Fcar (contents), contents));
1509 } 1513 }
1510} 1514}
1511 1515