]> Dogcows Code - chaz/openbox/blobdiff - otk/widget.cc
enter/leave actions work!
[chaz/openbox] / otk / widget.cc
index 0e5eaf15748c5c2a6b43c9538ff2477ded81be53..e95848a6577e4e6cb4b9b2771a2851994229f83b 100644 (file)
@@ -1,3 +1,9 @@
+// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
+
+#ifdef    HAVE_CONFIG_H
+#  include "../config.h"
+#endif // HAVE_CONFIG_H
+
 #include "widget.hh"
 #include "display.hh"
 #include "assassin.hh"
@@ -49,6 +55,8 @@ OtkWidget::~OtkWidget()
   if (_visible)
     hide();
 
+  _event_dispatcher->clearHandler(_window);
+
   std::for_each(_children.begin(), _children.end(), PointerAssassin());
 
   if (_parent)
@@ -141,7 +149,7 @@ void OtkWidget::setGeometry(int x, int y, int width, int height)
   _ignore_config++;
 }
 
-void OtkWidget::show(void)
+void OtkWidget::show(bool recursive)
 {
   if (_visible)
     return;
@@ -150,23 +158,27 @@ void OtkWidget::show(void)
   if (_dirty)
     update();
 
-  OtkWidgetList::iterator it = _children.begin(), end = _children.end();
-  for (; it != end; ++it)
-    (*it)->show();
+  if (recursive) {
+    OtkWidgetList::iterator it = _children.begin(), end = _children.end();
+    for (; it != end; ++it)
+      (*it)->show();
+  }
 
   XMapWindow(otk::OBDisplay::display, _window);
   _visible = true;
 }
 
-void OtkWidget::hide(void)
+void OtkWidget::hide(bool recursive)
 {
   if (! _visible)
     return;
 
-  OtkWidgetList::iterator it = _children.begin(), end = _children.end();
-  for (; it != end; ++it)
-    (*it)->hide();
-
+  if (recursive) {
+    OtkWidgetList::iterator it = _children.begin(), end = _children.end();
+    for (; it != end; ++it)
+      (*it)->hide();
+  }
+  
   XUnmapWindow(otk::OBDisplay::display, _window);
   _visible = false;
 }
@@ -221,6 +233,8 @@ void OtkWidget::ungrabKeyboard(void)
 
 void OtkWidget::render(void)
 {
+  if (!_texture) return;
+  
   _bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap);
 
   if (_bg_pixmap)
@@ -359,6 +373,7 @@ void OtkWidget::adjustVert(void)
 void OtkWidget::update(void)
 {
   if (_dirty) {
+    if (! _unmanaged)
     adjust();
     render();
     XClearWindow(OBDisplay::display, _window);
This page took 0.021314 seconds and 4 git commands to generate.