]> Dogcows Code - chaz/openbox/commitdiff
mad optimizations
authorDana Jansens <danakj@orodu.net>
Sat, 8 Feb 2003 08:59:24 +0000 (08:59 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 8 Feb 2003 08:59:24 +0000 (08:59 +0000)
otk/button.cc
otk/label.cc
otk/widget.cc
otk/widget.hh
scripts/motion.py
scripts/stackedcycle.py

index 1e128784f91aa4811a2efb3b3956cbce03c58e87..c0f48100056d0648f9e1496640ed60a8f14485b0 100644 (file)
@@ -12,7 +12,6 @@ Button::Button(Widget *parent)
   : Label(parent),
     _pressed(false)
 {
-  setHighlighted(false);
   setHorizontalJustify(RenderStyle::CenterJustify);
   setVerticalJustify(RenderStyle::CenterJustify);
   styleChanged(*RenderStyle::style(screen()));
@@ -70,7 +69,7 @@ void Button::styleChanged(const RenderStyle &style)
       _texture = style.buttonUnpressUnfocusBackground();
     _forecolor = style.buttonUnfocusColor();
   }
-  Widget::styleChanged(style);
+  refresh();
 }
 
 }
index c56f91f8022aebfbc7920e48d76b3c3a440f187a..16fa25a0b674f249c460091676a258b585b45437 100644 (file)
@@ -17,7 +17,7 @@ Label::Label(Widget *parent)
     _text(""),
     _justify_horz(RenderStyle::LeftTopJustify),
     _justify_vert(RenderStyle::LeftTopJustify),
-    _highlight(true)
+    _highlight(false)
 {
   styleChanged(*RenderStyle::style(screen()));
 }
@@ -92,9 +92,10 @@ void Label::styleChanged(const RenderStyle &style)
     _texture = style.labelUnfocusBackground();
     _forecolor = style.textUnfocusColor();
   }
-  _font = style.labelFont();
-  Widget::styleChanged(style);
-  calcDefaultSizes();
+  if (_font != style.labelFont()) {
+    _font = style.labelFont();
+    calcDefaultSizes();
+  }
 }
 
 void Label::renderForeground(Surface &surface)
index 612a252d259ad117ce5ffb30799f72762781e212..8ab57708f276981e9907f101ca9fa43087b7f1df 100644 (file)
@@ -61,7 +61,7 @@ Widget::Widget(Widget *parent, Direction direction, int bevel)
   assert(parent);
   createWindow(false);
   parent->addChild(this);
-  parent->layout();
+  if (parent->visible()) parent->layout();
   _dispatcher->registerHandler(_window, this);
 }
 
@@ -80,8 +80,9 @@ void Widget::show(bool children)
 {
   if (children) {
     std::list<Widget*>::iterator it , end = _children.end();
-    for (it = _children.begin(); it != end; ++it)
+    for (it = _children.begin(); it != end; ++it) {
       (*it)->show(true);
+    }
   }
   if (!_visible) {
     _visible = true;
@@ -107,6 +108,7 @@ void Widget::setEventMask(long e)
 
 void Widget::update()
 {
+  if (!_visible) return;
   _dirty = true;
   if (parent())
     parent()->layout(); // relay-out us and our siblings
@@ -224,6 +226,7 @@ void Widget::setBevel(int b)
 
 void Widget::layout()
 {
+  if (_children.empty() || !_visible) return;
   if (_direction == Horizontal)
     layoutHorz();
   else
@@ -470,6 +473,9 @@ void Widget::configureHandler(const XConfigureEvent &e)
   if (_ignore_config) {
     _ignore_config--;
   } else {
+    // only interested in these for top level windows
+    if (_parent) return;
+    
     XEvent ev;
     ev.xconfigure.width = e.width;
     ev.xconfigure.height = e.height;
index 2e4de47e1adb503e929f852ea82c18060eefdea6..5c366503ffc866e0071b971581d552f51ebe8b29 100644 (file)
@@ -77,7 +77,7 @@ public:
 
   virtual void exposeHandler(const XExposeEvent &e);
   virtual void configureHandler(const XConfigureEvent &e);
-  virtual void styleChanged(const RenderStyle &) {calcDefaultSizes();update();}
+  virtual void styleChanged(const RenderStyle &) {}
 
 protected:
   virtual void addChild(Widget *w) { assert(w); _children.push_back(w); }
index 649f07ba41996734956b50dcd9d68495eb3a9a40..2ed07863fb9bc28580db26dc9beab7f9ef12545c 100644 (file)
@@ -149,9 +149,9 @@ def _do_move():
         _poplabel.setText(text)
         scsize = otk.display.screenInfo(_screen).size()
         size = _poplabel.minSize()
-        _popwidget.resize(_poplabel.minSize())
-        _popwidget.move(otk.Point((scsize.width() - size.width()) / 2,
-                                  (scsize.height() - size.height()) / 2))
+        _popwidget.moveresize(otk.Rect((scsize.width() - size.width()) / 2,
+                                       (scsize.height() - size.height()) / 2,
+                                       size.width(), size.height()))
         _popwidget.show(1)
 
 def _move(data):
@@ -235,9 +235,9 @@ def _do_resize():
         _poplabel.setText(text)
         scsize = otk.display.screenInfo(_screen).size()
         size = _poplabel.minSize()
-        _popwidget.resize(_poplabel.minSize())
-        _popwidget.move(otk.Point((scsize.width() - size.width()) / 2,
-                                  (scsize.height() - size.height()) / 2))
+        _popwidget.moveresize(otk.Rect((scsize.width() - size.width()) / 2,
+                                       (scsize.height() - size.height()) / 2,
+                                       size.width(), size.height()))
         _popwidget.show(1)
 
 def _resize(data):
index 43507de389575e4181cc2255efb67723de67a604..59dbc98e421265c961d79e453bac88e937083fa5 100644 (file)
@@ -113,10 +113,6 @@ class _cycledata:
             if current and c.window() == current.window():
                 self.menupos = i
                 w.setHighlighted(1)
-                pass
-            else:
-                w.setHighlighted(0)
-                pass
             self.menuwidgets.append(w)
 
             if c.iconic(): t = c.iconTitle()
@@ -147,9 +143,9 @@ class _cycledata:
         # show or hide the list and its child widgets
         if len(self.clients) > 1:
             size = self.screeninfo.size()
-            self.widget.resize(otk.Size(width, height))
-            self.widget.move(otk.Point((size.width() - width) / 2,
-                                       (size.height() - height) / 2))
+            self.widget.moveresize(otk.Rect((size.width() - width) / 2,
+                                            (size.height() - height) / 2,
+                                            width, height))
             self.widget.show(1)
 
     def activatetarget(self, final):
This page took 0.036066 seconds and 4 git commands to generate.