From: Dana Jansens Date: Wed, 5 Feb 2003 05:06:33 +0000 (+0000) Subject: add an adjustable event mask X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=8df1670bc27fd12e2dc9808e68fcd4efc7558b4d;p=chaz%2Fopenbox add an adjustable event mask --- diff --git a/otk/widget.cc b/otk/widget.cc index c09ac486..67535024 100644 --- a/otk/widget.cc +++ b/otk/widget.cc @@ -25,6 +25,8 @@ Widget::Widget(Widget *parent, Direction direction) _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()) { @@ -45,6 +47,8 @@ Widget::Widget(EventDispatcher *event_dispatcher, RenderStyle *style, _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) { @@ -84,8 +88,7 @@ void Widget::create(bool override_redirect) 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; @@ -104,6 +107,12 @@ void Widget::create(bool override_redirect) _ignore_config++; } +void Widget::setEventMask(long e) +{ + XSelectInput(**display, _window, e); + _event_mask = e; +} + void Widget::setWidth(int w) { assert(w > 0); @@ -266,7 +275,10 @@ void Widget::ungrabKeyboard(void) void Widget::render(void) { - if (!_texture) return; + if (!_texture) { + XSetWindowBackgroundPixmap(**display, _window, ParentRelative); + return; + } Surface *s = _surface; // save the current surface @@ -381,6 +393,8 @@ void Widget::adjustVert(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; diff --git a/otk/widget.hh b/otk/widget.hh index e2e477df..3427e681 100644 --- a/otk/widget.hh +++ b/otk/widget.hh @@ -118,6 +118,9 @@ public: inline RenderStyle *style(void) const { return _style; } virtual void setStyle(RenderStyle *style); + inline long eventMask(void) const { return _event_mask; } + void setEventMask(long e); + inline EventDispatcher *eventDispatcher(void) { return _event_dispatcher; } void setEventDispatcher(EventDispatcher *disp); @@ -167,6 +170,8 @@ protected: bool _fixed_width; bool _fixed_height; + long _event_mask; + Surface *_surface; EventDispatcher *_event_dispatcher;