On 03.09.2010, at 08:58, mark olesen wrote:
> The problem I am trying to overcome is the flurry FLTK messages that call a
> resize() method -- it is a flurry of superfluous events. It does not make
> sense to go through a bunch of code when in fact only the position changed
> was an x or y coordinate. To me there is still something amiss.
Well, I don't know what resize messages you are getting, but
something in your code looks wrong to me anyway.
First of all, what is the do..while loop good for? It doesn't
make any sense to me. Once you call Fl_Widget::resize() you
can be sure that all your x/y/w/h values are set as you
expected. There *may* be more (X11) resize messages later,
but this doesn't happen during your do..while loop. But
that's only a minor cosmetic issue. See code below...
The real problem is probably that you don't call
Fl_Widget::resize() at all, if w() and h() didn't change.
This would technically result in *rejecting* the request.
However, since your widget is derived from Fl_Double_window,
the window manager does not necessarily honor your request
to reject the (reposition) event and can probably send
another message. This behavior can also depend on the
window manager used.
That said, maybe this modified code *might* help to reduce
some of the messages:
/*virtual*/ void
kvc_app::resize(
int const i_x_pos,
int const i_y_pos,
int const i_x_len,
int const i_y_len)
{
int l_x_pos;
int l_y_pos;
int l_x_len;
int l_y_len;
int size_changed = ((i_x_len != w()) || (i_y_len != h());
Fl_Widget::resize(i_x_pos, i_y_pos, i_x_len, i_y_len);
if (!size_changed) return;
[... code to lay out your widgets here ...]
// remove "}while(0);"
return;
}
Note that there will probably always be lots of WM resize
and/or reposition messages if you enable drawing/showing
the window contents during window dragging and resizing,
but that's intended behavior.
Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk