From 6d68ac2256dc212dc0f2dd8a15d013d6ce3fc4b8 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Fri, 15 Nov 2002 02:40:57 +0000 Subject: [PATCH] smarter expose. stop when the window is found --- otk/button.cc | 4 ++-- otk/button.hh | 2 +- otk/widget.cc | 7 +++++-- otk/widget.hh | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/otk/button.cc b/otk/button.cc index 9d6c43b1..150e32d9 100644 --- a/otk/button.cc +++ b/otk/button.cc @@ -65,10 +65,10 @@ void OtkButton::update(void) OtkFocusWidget::update(); } -void OtkButton::expose(const XExposeEvent &e) +bool OtkButton::expose(const XExposeEvent &e) { _dirty = true; - OtkFocusWidget::expose(e); + return OtkFocusWidget::expose(e); } } diff --git a/otk/button.hh b/otk/button.hh index a4b3a978..48a0f813 100644 --- a/otk/button.hh +++ b/otk/button.hh @@ -34,7 +34,7 @@ public: void release(void); virtual void update(void); - virtual void expose(const XExposeEvent &e); + virtual bool expose(const XExposeEvent &e); private: diff --git a/otk/widget.cc b/otk/widget.cc index aaec59b6..3ff484bc 100644 --- a/otk/widget.cc +++ b/otk/widget.cc @@ -390,16 +390,19 @@ void OtkWidget::removeChild(OtkWidget *child) _children.erase(it); } -void OtkWidget::expose(const XExposeEvent &e) +bool OtkWidget::expose(const XExposeEvent &e) { if (e.window == _window) { _dirty = true; update(); + return true; } else { OtkWidgetList::iterator it = _children.begin(), end = _children.end(); for (; it != end; ++it) - (*it)->expose(e); + if ((*it)->expose(e)) + return true; } + return false; } } diff --git a/otk/widget.hh b/otk/widget.hh index 21e2911a..ca65730c 100644 --- a/otk/widget.hh +++ b/otk/widget.hh @@ -27,7 +27,7 @@ public: virtual void update(void); - virtual void expose(const XExposeEvent &e); + virtual bool expose(const XExposeEvent &e); inline Window getWindow(void) const { return _window; } inline const OtkWidget *getParent(void) const { return _parent; } -- 2.39.2