summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2023-12-16 14:45:40 +0100
committerMatthias Melcher <github@matthiasm.com>2023-12-16 14:45:40 +0100
commitf7eb21d92e841410c32ea5b56399545dfe6a0583 (patch)
tree05bdee92a529eb7630b148bdf516bbe3d20e1bf3
parent046bf23a5d7290861df1e020babfa2e1535a0389 (diff)
Fixes fl_message_position for widgets and subwindows
- https://groups.google.com/d/msgid/fltkcoredev/902a753e-7430-4302-b384-c30c7d45e3bfn%40googlegroups.com.
-rw-r--r--src/Fl_Message.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Fl_Message.h b/src/Fl_Message.h
index 4b0581a8c..6fe09e127 100644
--- a/src/Fl_Message.h
+++ b/src/Fl_Message.h
@@ -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;
}