make stuff draw on expose events
Dana Jansens danakj@orodu.net
5 files changed,
21 insertions(+),
4 deletions(-)
M
otk/otk_test.cc
→
otk/otk_test.cc
@@ -59,6 +59,8 @@ while (1) {
if (XPending(otk::OBDisplay::display)) { XEvent e; XNextEvent(otk::OBDisplay::display, &e); + if (e.type == Expose) + foo.expose(e.xexpose); } }
M
otk/widget.cc
→
otk/widget.cc
@@ -390,4 +390,16 @@ if (it != _children.end())
_children.erase(it); } +void OtkWidget::expose(const XExposeEvent &e) +{ + if (e.window == _window) { + _dirty = true; + update(); + } else { + OtkWidgetList::iterator it = _children.begin(), end = _children.end(); + for (; it != end; ++it) + (*it)->expose(e); + } +} + }
M
otk/widget.hh
→
otk/widget.hh
@@ -27,6 +27,8 @@ virtual ~OtkWidget();
virtual void update(void); + void expose(const XExposeEvent &e); + inline Window getWindow(void) const { return _window; } inline const OtkWidget *getParent(void) const { return _parent; } inline const OtkWidgetList &getChildren(void) const { return _children; }@@ -124,6 +126,7 @@
bool _fixed_width; bool _fixed_height; +protected: bool _dirty; };