summaryrefslogtreecommitdiff
path: root/src/Fl_Window.cxx
diff options
context:
space:
mode:
authorGreg Ercolano <erco@seriss.com>2013-04-12 16:46:35 +0000
committerGreg Ercolano <erco@seriss.com>2013-04-12 16:46:35 +0000
commitf04ff44f8c24a8ab6c774c811ee7a707ecca3552 (patch)
tree8a55c1bb0c68168e4570d7202501218b3dc8f813 /src/Fl_Window.cxx
parent55af432c2cede29f0a1339ad7c5d3f2396a94914 (diff)
Small fixes to new top_window_offset() method as per discussion in STR #2948.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9875 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Window.cxx')
-rw-r--r--src/Fl_Window.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index a3e0200b6..b9860976a 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -107,19 +107,19 @@ Fl_Window *Fl_Widget::top_window() const {
}
/**
- Finds the x/y offset of the current window relative to the top-level window.
+ Finds the x/y offset of the current widget relative to the top-level window.
\param[out] xoff,yoff Returns the x/y offset
- \returns the top-level window
+ \returns the top-level window (or NULL for a widget that's not in any 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
+ const Fl_Widget *w = this;
+ while (w && w->window()) {
+ xoff += w->x(); // accumulate offsets
+ yoff += w->y();
+ w = w->window(); // walk up window hierarchy
}
- return (Fl_Window*)win;
+ return ((Fl_Widget*)w)->as_window();
}
/** Gets the x position of the window on the screen */