(query_default_callback): clarify widget position.

If dialog should be placed too high (in the upper half of the screen
closer to the screen top), show it centered.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2022-05-22 15:30:55 +03:00
parent 4008d3b96c
commit 101714e39b
1 changed files with 4 additions and 0 deletions

View File

@ -99,6 +99,10 @@ query_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
else else
ypos = WIDGET (prev_dlg)->rect.y + 2; ypos = WIDGET (prev_dlg)->rect.y + 2;
/* if dialog is too high, place it centered */
if (ypos + w->rect.lines < LINES / 2 )
w->pos_flags |= WPOS_CENTER;
xpos = COLS / 2 - w->rect.cols / 2; xpos = COLS / 2 - w->rect.cols / 2;
/* set position */ /* set position */