diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-02-16 12:20:10 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-02-16 12:20:10 +0000 |
| commit | 010e12c42ac2a1a21886785f3c882c38eeebc66e (patch) | |
| tree | 24771ad9183aa85f7596b53d130ef4f5cbca7f7f /otk | |
| parent | 7a41f7730dfa7e5733720f98f89c5a5906f1e786 (diff) | |
only show() if the dialog is not already visible
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/messagedialog.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/otk/messagedialog.cc b/otk/messagedialog.cc index df004347..21618981 100644 --- a/otk/messagedialog.cc +++ b/otk/messagedialog.cc @@ -101,7 +101,8 @@ MessageDialog::~MessageDialog() const DialogButton& MessageDialog::run() { - show(); + if (!visible()) + show(); while (visible()) { dispatcher()->dispatchEvents(); @@ -118,11 +119,17 @@ void MessageDialog::show() _button_widgets.push_back(new DialogButtonWidget(_button_holder, this, *it)); + Rect r; + + if (parent()) + r = parent()->area(); + else + r = Rect(Point(0, 0), display->screenInfo(screen())->size()); + XSizeHints size; - size.flags = PMinSize; + size.flags = PMinSize | PPosition; size.min_width = minSize().width(); size.min_height = minSize().height(); - XSetWMNormalHints(**display, window(), &size); Size dest = area().size(); if (dest.width() < 200 || dest.height() < 100) { @@ -132,6 +139,12 @@ void MessageDialog::show() 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(); } |
