diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H index 5f5c9a2d6..bd42506b0 100644 --- a/FL/Fl_Widget.H +++ b/FL/Fl_Widget.H @@ -921,6 +921,7 @@ public: Fl_Window* window() const ; Fl_Window* top_window() const; + Fl_Window* top_window_offset(int& xoff, int& yoff) const; /** Returns an Fl_Group pointer if this widget is an Fl_Group. diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H index bbd1f573f..d6997e601 100644 --- a/FL/Fl_Window.H +++ b/FL/Fl_Window.H @@ -120,7 +120,6 @@ protected: \see force_position(int) */ int force_position() const { return ((flags() & FORCE_POSITION)?1:0); } - Fl_Window* top_window_offset(int& xoff, int& yoff) const; public: diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index f76615925..a3e0200b6 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -106,6 +106,22 @@ Fl_Window *Fl_Widget::top_window() const { return const_cast(w)->as_window(); // return if window, or NULL if not } +/** + Finds the x/y offset of the current window relative to the top-level window. + \param[out] xoff,yoff Returns the x/y offset + \returns the top-level window +*/ +Fl_Window* Fl_Widget::top_window_offset(int& xoff, int& yoff) const { + xoff = yoff = 0; + const Fl_Window *win = (const Fl_Window*)this; + while (win && win->window()) { + xoff += win->x(); // accumulate offsets + yoff += win->y(); + win = win->window(); // walk up window hierarchy + } + return (Fl_Window*)win; +} + /** Gets the x position of the window on the screen */ int Fl_Window::x_root() const { Fl_Window *p = window(); @@ -299,22 +315,6 @@ void Fl_Window::icon(const void * ic) { icon_ = ic; } -/** - Finds the x/y offset of the current window relative to the top-level window. - \param[out] xoff,yoff Returns the x/y offset - \returns the top-level window -*/ -Fl_Window* Fl_Window::top_window_offset(int& xoff, int& yoff) const { - xoff = yoff = 0; - const Fl_Window *win = (const Fl_Window*)this; - while (win && win->window()) { - xoff += win->x(); // accumulate offsets - yoff += win->y(); - win = win->window(); // walk up window hierarchy - } - return (Fl_Window*)win; -} - // // End of "$Id$". //