summaryrefslogtreecommitdiff
path: root/otk/widget.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-11-15 03:10:34 +0000
committerDana Jansens <danakj@orodu.net>2002-11-15 03:10:34 +0000
commit0856b11de843db30b5053c8cb7d9c84eae262852 (patch)
tree92d22b33c71a3d3e6f18e8bf167d826f8dff3739 /otk/widget.cc
parentd97db164304972445e14c6702b76af0259e3d3be (diff)
resizes
Diffstat (limited to 'otk/widget.cc')
-rw-r--r--otk/widget.cc28
1 files changed, 24 insertions, 4 deletions
diff --git a/otk/widget.cc b/otk/widget.cc
index 3ff484bc..9d8c37a0 100644
--- a/otk/widget.cc
+++ b/otk/widget.cc
@@ -11,6 +11,7 @@ namespace otk {
OtkWidget::OtkWidget(OtkWidget *parent, Direction direction)
: _parent(parent), _style(parent->getStyle()), _direction(direction),
_cursor(parent->getCursor()), _bevel_width(parent->getBevelWidth()),
+ _ignore_config(0),
_visible(false), _focused(false), _grabbed_mouse(false),
_grabbed_keyboard(false), _stretchable_vert(false),
_stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0),
@@ -24,7 +25,7 @@ OtkWidget::OtkWidget(OtkWidget *parent, Direction direction)
OtkWidget::OtkWidget(Style *style, Direction direction,
Cursor cursor, int bevel_width)
: _parent(0), _style(style), _direction(direction), _cursor(cursor),
- _bevel_width(bevel_width), _visible(false),
+ _bevel_width(bevel_width), _ignore_config(0), _visible(false),
_focused(false), _grabbed_mouse(false), _grabbed_keyboard(false),
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
_bg_pixmap(0), _bg_pixel(0), _screen(style->getScreen()),
@@ -124,6 +125,7 @@ void OtkWidget::setGeometry(int x, int y, int width, int height)
{
_rect = Rect(x, y, width, height);
_dirty = true;
+ _ignore_config++;
XMoveResizeWindow(otk::OBDisplay::display, _window, x, y, width, height);
}
@@ -208,11 +210,9 @@ void OtkWidget::ungrabKeyboard(void)
void OtkWidget::render(void)
{
- Pixmap old = _bg_pixmap;
-
_bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap);
- if (_bg_pixmap && _bg_pixmap != old)
+ if (_bg_pixmap)
XSetWindowBackgroundPixmap(otk::OBDisplay::display, _window, _bg_pixmap);
else {
unsigned int pix = _texture->color().pixel();
@@ -405,4 +405,24 @@ bool OtkWidget::expose(const XExposeEvent &e)
return false;
}
+bool OtkWidget::configure(const XConfigureEvent &e)
+{
+ if (e.window == _window) {
+ if (_ignore_config) {
+ _ignore_config--;
+ } else {
+ _dirty = true;
+ _rect.setRect(e.x, e.y, e.width, e.height);
+ update();
+ }
+ return true;
+ } else {
+ OtkWidgetList::iterator it = _children.begin(), end = _children.end();
+ for (; it != end; ++it)
+ if ((*it)->configure(e))
+ return true;
+ }
+ return false;
+}
+
}