smarter expose. stop when the window is found

This commit is contained in:
Dana Jansens 2002-11-15 02:40:57 +00:00
parent b7dba88a0a
commit 6d68ac2256
4 changed files with 9 additions and 6 deletions

View file

@ -65,10 +65,10 @@ void OtkButton::update(void)
OtkFocusWidget::update(); OtkFocusWidget::update();
} }
void OtkButton::expose(const XExposeEvent &e) bool OtkButton::expose(const XExposeEvent &e)
{ {
_dirty = true; _dirty = true;
OtkFocusWidget::expose(e); return OtkFocusWidget::expose(e);
} }
} }

View file

@ -34,7 +34,7 @@ public:
void release(void); void release(void);
virtual void update(void); virtual void update(void);
virtual void expose(const XExposeEvent &e); virtual bool expose(const XExposeEvent &e);
private: private:

View file

@ -390,16 +390,19 @@ void OtkWidget::removeChild(OtkWidget *child)
_children.erase(it); _children.erase(it);
} }
void OtkWidget::expose(const XExposeEvent &e) bool OtkWidget::expose(const XExposeEvent &e)
{ {
if (e.window == _window) { if (e.window == _window) {
_dirty = true; _dirty = true;
update(); update();
return true;
} else { } else {
OtkWidgetList::iterator it = _children.begin(), end = _children.end(); OtkWidgetList::iterator it = _children.begin(), end = _children.end();
for (; it != end; ++it) for (; it != end; ++it)
(*it)->expose(e); if ((*it)->expose(e))
return true;
} }
return false;
} }
} }

View file

@ -27,7 +27,7 @@ public:
virtual void update(void); virtual void update(void);
virtual void expose(const XExposeEvent &e); virtual bool expose(const XExposeEvent &e);
inline Window getWindow(void) const { return _window; } inline Window getWindow(void) const { return _window; }
inline const OtkWidget *getParent(void) const { return _parent; } inline const OtkWidget *getParent(void) const { return _parent; }