_stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0),
_bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(parent->screen()),
_fixed_width(false), _fixed_height(false),
+ _event_mask(ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
+ ExposureMask | StructureNotifyMask),
_surface(0),
_event_dispatcher(parent->eventDispatcher())
{
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
_bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1),
_screen(style->screen()), _fixed_width(false), _fixed_height(false),
+ _event_mask(ButtonPressMask | ButtonReleaseMask | ButtonMotionMask |
+ ExposureMask | StructureNotifyMask),
_surface(0),
_event_dispatcher(event_dispatcher)
{
if (_visible)
hide();
+ if (_surface)
+ delete _surface;
+
_event_dispatcher->clearHandler(_window);
std::for_each(_children.begin(), _children.end(), PointerAssassin());
attrib_create.background_pixmap = None;
attrib_create.colormap = scr_info->colormap();
- attrib_create.event_mask = ButtonPressMask | ButtonReleaseMask |
- ButtonMotionMask | ExposureMask | StructureNotifyMask;
+ attrib_create.event_mask = _event_mask;
if (override_redirect) {
create_mask |= CWOverrideRedirect;
_ignore_config++;
}
+void Widget::setEventMask(long e)
+{
+ XSelectInput(**display, _window, e);
+ _event_mask = e;
+}
+
void Widget::setWidth(int w)
{
assert(w > 0);
void Widget::render(void)
{
- if (!_texture) return;
+ if (!_texture) {
+ XSetWindowBackgroundPixmap(**display, _window, ParentRelative);
+ return;
+ }
Surface *s = _surface; // save the current surface
XSetWindowBackgroundPixmap(**display, _window, _surface->pixmap());
- delete s; // delete the old surface *after* its pixmap isn't in use anymore
+ if (s)
+ delete s; // delete the old surface *after* its pixmap isn't in use anymore
}
void Widget::adjust(void)
(*str_it)->setHeight(str_height > _bevel_width ?
str_height - _bevel_width : _bevel_width);
}
+ if (stretchable.size() > 0)
+ height = _rect.height();
Widget *prev_widget = 0;
void Widget::update()
{
+ WidgetList::iterator it = _children.begin(), end = _children.end();
+ for (; it != end; ++it)
+ (*it)->update();
+
if (_dirty) {
adjust();
render();
XClearWindow(**display, _window);
}
- WidgetList::iterator it = _children.begin(), end = _children.end();
- for (; it != end; ++it)
- (*it)->update();
-
_dirty = false;
}