diff options
Diffstat (limited to 'otk')
| -rw-r--r-- | otk/eventdispatcher.cc | 4 | ||||
| -rw-r--r-- | otk/rect.cc | 6 | ||||
| -rw-r--r-- | otk/rect.hh | 8 |
3 files changed, 16 insertions, 2 deletions
diff --git a/otk/eventdispatcher.cc b/otk/eventdispatcher.cc index 5be1c6b1..d2e1a96e 100644 --- a/otk/eventdispatcher.cc +++ b/otk/eventdispatcher.cc @@ -34,7 +34,7 @@ void OtkEventDispatcher::clearHandler(Window id) _map.erase(id); } -#include <stdio.h> +//#include <stdio.h> void OtkEventDispatcher::dispatchEvents(void) { XEvent e; @@ -44,7 +44,7 @@ void OtkEventDispatcher::dispatchEvents(void) while (XPending(OBDisplay::display)) { XNextEvent(OBDisplay::display, &e); -#ifdef DEBUG +#if defined(DEBUG) && 0 printf("Event %d window %lx\n", e.type, e.xany.window); #endif diff --git a/otk/rect.cc b/otk/rect.cc index 40d369e9..7ec5c2c4 100644 --- a/otk/rect.cc +++ b/otk/rect.cc @@ -136,6 +136,12 @@ bool Rect::contains(int x, int y) const } +bool Rect::contains(const Point &p) const +{ + return contains(p.x(), p.y()); +} + + bool Rect::contains(const Rect& a) const { return a._x1 >= _x1 && a._x2 <= _x2 && diff --git a/otk/rect.hh b/otk/rect.hh index 83c2b225..23ca0d12 100644 --- a/otk/rect.hh +++ b/otk/rect.hh @@ -213,6 +213,14 @@ public: @return true if the point is contained within this Rect; otherwise, false */ bool contains(int x, int y) const; + //! Determines if this Rect contains a point + /*! + The rectangle contains the point if it falls within the rectangle's + boundaries. + @param p The point to operate on + @return true if the point is contained within this Rect; otherwise, false + */ + bool contains(const Point &p) const; //! Determines if this Rect contains another Rect entirely /*! This rectangle contains the second rectangle if it is entirely within this |
