]> Dogcows Code - chaz/openbox/commitdiff
add an adjustable event mask
authorDana Jansens <danakj@orodu.net>
Wed, 5 Feb 2003 05:06:33 +0000 (05:06 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 5 Feb 2003 05:06:33 +0000 (05:06 +0000)
otk/widget.cc
otk/widget.hh

index c09ac4862566e8c8f93d0f4634ff6e7e33a15065..67535024721932b2a64a604196a295813c867242 100644 (file)
@@ -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;
 
index e2e477dfdb17cf46162c97446263c1d80945fa3b..3427e6814942d5a6ee8092ddb973f29fdb5d55db 100644 (file)
@@ -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;
This page took 0.026333 seconds and 4 git commands to generate.