]> Dogcows Code - chaz/openbox/commitdiff
make stuff draw on expose events
authorDana Jansens <danakj@orodu.net>
Fri, 15 Nov 2002 02:30:14 +0000 (02:30 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 15 Nov 2002 02:30:14 +0000 (02:30 +0000)
otk/button.cc
otk/button.hh
otk/otk_test.cc
otk/widget.cc
otk/widget.hh

index 98d5780504d8335eaecb40558dca4170c0fecf64..18838e878019bcc7db8ebfef626168acd84cc46a 100644 (file)
@@ -57,12 +57,12 @@ void OtkButton::update(void)
 
     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();
 }
 
 }
index 55a2389c5f4a7e84ec7a9a1a1888e87e2d15f337..6908322e608c1dcd601805b781fed70a4f0de97c 100644 (file)
@@ -40,7 +40,7 @@ private:
   std::string _text;
   //OtkPixmap _pixmap;
   bool _pressed;
-  bool _dirty;
+//  bool _dirty;
 
   BTexture *_pressed_focus_tx;
   BTexture *_pressed_unfocus_tx;
index 3c182b045b4d7a143065f0d5f4dff3ef1edd8ef9..f36fcf99adda0204879596ac236e95e8fab84fde 100644 (file)
@@ -59,6 +59,8 @@ int main(void) {
     if (XPending(otk::OBDisplay::display)) {
       XEvent e;
       XNextEvent(otk::OBDisplay::display, &e);
+      if (e.type == Expose)
+        foo.expose(e.xexpose);
     } 
   }
 
index ea90a32fcdd7ccaac9811cbfe0d27edf959d95b5..aaec59b60ec35044e9623c596226d8c0b50b0d92 100644 (file)
@@ -390,4 +390,16 @@ void OtkWidget::removeChild(OtkWidget *child)
     _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);
+  }
+}
+
 }
index 85eefe79de3a028e73d84b5548108f6859b0895d..1651a507451db098978b98ccb1df593d14063621 100644 (file)
@@ -27,6 +27,8 @@ public:
 
   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 @@ private:
   bool _fixed_width;
   bool _fixed_height;
 
+protected:
   bool _dirty;
 };
 
This page took 0.028186 seconds and 4 git commands to generate.