Fixes fl_message_position for widgets and subwindows

-  https://groups.google.com/d/msgid/fltkcoredev/902a753e-7430-4302-b384-c30c7d45e3bfn%40googlegroups.com.
This commit is contained in:
Matthias Melcher 2023-12-16 14:45:40 +01:00
parent 046bf23a5d
commit f7eb21d92e

View File

@ -115,8 +115,14 @@ public:
/** Implements fl_message_position(Fl_Widget *widget). */
static void message_position(Fl_Widget *widget) {
form_x_ = widget->x() + widget->w() / 2;
form_y_ = widget->y() + widget->h() / 2;
int xo, yo;
Fl_Window *win = widget->top_window_offset(xo, yo);
form_x_ = xo + widget->w() / 2;
form_y_ = yo + widget->h() / 2;
if (win) {
form_x_ += win->x();
form_y_ += win->y();
}
form_position_ = 2;
}