From ab88f2b442b6aafe33c8e87010f883548a718f54 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 9 Aug 2011 11:37:41 +0400 Subject: [PATCH] Nice location of red (warning and error) dialogs. Now warning/error dialog overlaps the previous status dialog. Signed-off-by: Andrew Borodin --- lib/widget/wtools.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/widget/wtools.c b/lib/widget/wtools.c index 1b8bebe35..9e9eff91d 100644 --- a/lib/widget/wtools.c +++ b/lib/widget/wtools.c @@ -67,8 +67,33 @@ default_query_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, { case DLG_RESIZE: { - int xpos = COLS / 2 - h->cols / 2; - int ypos = LINES / 3 - (h->lines - 3) / 2; + Dlg_head *prev_dlg = NULL; + int ypos, xpos; + + /* get dialog under h */ + if (top_dlg != NULL) + { + if (top_dlg->data != (void *) h) + prev_dlg = (Dlg_head *) top_dlg->data; + else + { + GList *p; + + /* Top dialog is current if it is visible. + Get previous dialog in stack */ + p = g_list_next (top_dlg); + if (p != NULL) + prev_dlg = (Dlg_head *) p->data; + } + } + + /* if previous dialog is not fullscreen'd -- overlap it */ + if (prev_dlg == NULL || prev_dlg->fullscreen) + ypos = LINES / 3 - (h->lines - 3) / 2; + else + ypos = prev_dlg->y + 2; + + xpos = COLS / 2 - h->cols / 2; /* set position */ dlg_set_position (h, ypos, xpos, ypos + h->lines, xpos + h->cols); -- 2.11.4.GIT