From b83f16cb17738c8086c4cc71340f8b6e6a3a2805 Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Thu, 10 May 2012 13:20:39 +0000 Subject: [PATCH] Small relayout check when body is visible. --- ede-notify-daemon/NotifyWindow.cpp | 18 +++++++++++++----- ede-notify-daemon/window.fl | 10 +++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ede-notify-daemon/NotifyWindow.cpp b/ede-notify-daemon/NotifyWindow.cpp index bf508a7..f5e55a5 100644 --- a/ede-notify-daemon/NotifyWindow.cpp +++ b/ede-notify-daemon/NotifyWindow.cpp @@ -51,11 +51,13 @@ NotifyWindow::NotifyWindow() : Fl_Window(DEFAULT_W, DEFAULT_H) { /* use flat box so text can be drawn correctly */ summary->box(FL_FLAT_BOX); summary->cursor_color(FL_BACKGROUND2_COLOR); + summary->value(0); - body = new Fl_Multiline_Output(65, 31, 185, 25); + body = new Fl_Multiline_Output(65, 35, 185, 25); /* use flat box so text can be drawn correctly */ body->box(FL_FLAT_BOX); body->cursor_color(FL_BACKGROUND2_COLOR); + body->value(0); end(); border(0); } @@ -78,8 +80,14 @@ void NotifyWindow::show(void) { } void NotifyWindow::resize(int X, int Y, int W, int H) { + /* + * do not call further if window is shown: different strategy is needed as every time + * window is re-configured, this will be called + */ + if(shown()) return; + /* resize summary if needed */ - if(summary->value()) { + if(summary->value() && summary->size() > 0) { int fw = 0, fh = 0; fl_font(summary->textfont(), summary->textsize()); fl_measure(summary->value(), fw, fh); @@ -92,7 +100,7 @@ void NotifyWindow::resize(int X, int Y, int W, int H) { closeb->position(closeb->x() + d, closeb->y()); /* resize body too */ - body->size(body->w() + d, body->h()); + if(body->visible()) body->size(body->w() + d, body->h()); W += d; /* this depends on window position */ @@ -104,7 +112,7 @@ void NotifyWindow::resize(int X, int Y, int W, int H) { summary->size(summary->w(), fh); /* move body down */ - body->position(body->x(), body->y() + d); + if(body->visible()) body->position(body->x(), body->y() + d); H += d; Y -= d; @@ -112,7 +120,7 @@ void NotifyWindow::resize(int X, int Y, int W, int H) { } /* resize body if needed */ - if(body->value()) { + if(body->value() && body->size() > 0) { int fw = 0, fh = 0; fl_font(body->textfont(), body->textsize()); fl_measure(body->value(), fw, fh); diff --git a/ede-notify-daemon/window.fl b/ede-notify-daemon/window.fl index d5d8f3e..fb121b9 100644 --- a/ede-notify-daemon/window.fl +++ b/ede-notify-daemon/window.fl @@ -4,8 +4,8 @@ header_name {.h} code_name {.cxx} Function {} {open } { - Fl_Window {} {open selected - xywh {1219 684 280 75} type Double color 7 visible + Fl_Window {} {open + xywh {1217 682 280 75} type Double color 7 visible } { Fl_Button {} { label x @@ -15,10 +15,10 @@ Function {} {open image {../../../../.icons/edeneu/32x32/status/dialog-information.png} xywh {10 10 48 48} align 20 } Fl_Output {} { - xywh {65 10 185 24} box NO_BOX labelsize 12 + xywh {65 10 185 25} box NO_BOX labelsize 12 } - Fl_Output {} { - xywh {65 31 185 24} box NO_BOX labelsize 12 + Fl_Output {} {selected + xywh {65 35 185 25} box NO_BOX labelsize 12 } } }