all repos — openbox @ b3822fcfb19bfdcf775fbc6ff2f89a817d16cb4c

openbox fork - make it a bit more like ryudo

make stuff draw on expose events
Dana Jansens danakj@orodu.net
commit

b3822fcfb19bfdcf775fbc6ff2f89a817d16cb4c

parent

ed4696f6910047ae596a874ef3f1f85b5390aadb

5 files changed, 21 insertions(+), 4 deletions(-)

jump to
M otk/button.ccotk/button.cc

@@ -57,12 +57,12 @@ unsigned int bevel = getStyle()->getBevelWidth();

OtkFocusWidget::resize(ft.measureString(_text) + bevel * 2, ft.height() + bevel * 2); - ft.drawString(getWindow(), bevel, bevel, *text_color, _text); OtkFocusWidget::update(); - } - _dirty = false; + ft.drawString(getWindow(), bevel, bevel, *text_color, _text); + } else + OtkFocusWidget::update(); } }
M otk/button.hhotk/button.hh

@@ -40,7 +40,7 @@

std::string _text; //OtkPixmap _pixmap; bool _pressed; - bool _dirty; +// bool _dirty; BTexture *_pressed_focus_tx; BTexture *_pressed_unfocus_tx;
M otk/otk_test.ccotk/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.ccotk/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.hhotk/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; };