only show() if the dialog is not already visible
This commit is contained in:
parent
7a41f7730d
commit
010e12c42a
1 changed files with 16 additions and 3 deletions
|
@ -101,6 +101,7 @@ MessageDialog::~MessageDialog()
|
||||||
|
|
||||||
const DialogButton& MessageDialog::run()
|
const DialogButton& MessageDialog::run()
|
||||||
{
|
{
|
||||||
|
if (!visible())
|
||||||
show();
|
show();
|
||||||
|
|
||||||
while (visible()) {
|
while (visible()) {
|
||||||
|
@ -118,11 +119,17 @@ void MessageDialog::show()
|
||||||
_button_widgets.push_back(new DialogButtonWidget(_button_holder,
|
_button_widgets.push_back(new DialogButtonWidget(_button_holder,
|
||||||
this, *it));
|
this, *it));
|
||||||
|
|
||||||
|
Rect r;
|
||||||
|
|
||||||
|
if (parent())
|
||||||
|
r = parent()->area();
|
||||||
|
else
|
||||||
|
r = Rect(Point(0, 0), display->screenInfo(screen())->size());
|
||||||
|
|
||||||
XSizeHints size;
|
XSizeHints size;
|
||||||
size.flags = PMinSize;
|
size.flags = PMinSize | PPosition;
|
||||||
size.min_width = minSize().width();
|
size.min_width = minSize().width();
|
||||||
size.min_height = minSize().height();
|
size.min_height = minSize().height();
|
||||||
XSetWMNormalHints(**display, window(), &size);
|
|
||||||
|
|
||||||
Size dest = area().size();
|
Size dest = area().size();
|
||||||
if (dest.width() < 200 || dest.height() < 100) {
|
if (dest.width() < 200 || dest.height() < 100) {
|
||||||
|
@ -132,6 +139,12 @@ void MessageDialog::show()
|
||||||
resize(dest);
|
resize(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// center it above its parent
|
||||||
|
move(Point(r.x() + (r.width() - dest.width()) / 2,
|
||||||
|
r.y() + (r.height() - dest.height()) / 2));
|
||||||
|
|
||||||
|
XSetWMNormalHints(**display, window(), &size);
|
||||||
|
|
||||||
Widget::show();
|
Widget::show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue