]> Dogcows Code - chaz/openbox/commitdiff
support the button pressed resources better
authorDana Jansens <danakj@orodu.net>
Thu, 26 Dec 2002 17:22:53 +0000 (17:22 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 26 Dec 2002 17:22:53 +0000 (17:22 +0000)
otk/eventdispatcher.cc
otk/otk_wrap.cc
otk/style.cc
otk/style.hh
otk/widget.cc
otk/widget.hh

index 4a70c8576ffc4b8a4175a3b148faf382574285b7..c80f3857a41a77ab7fd9ccb5f5571d2d894def74 100644 (file)
@@ -78,8 +78,10 @@ void OtkEventDispatcher::dispatchEvents(void)
       // any other types are not ones we're interested in
       if (e.xfocus.detail == NotifyNonlinear) {
         if (e.xfocus.window != focus) {
-          unfocus = focus;
+          if (focus)
+            unfocus = focus;
           focus = e.xfocus.window;
+          printf("FocusIn focus=%lx unfocus=%lx\n", focus, unfocus);
         }
       }
     } else if (e.type == FocusOut) {
@@ -88,6 +90,7 @@ void OtkEventDispatcher::dispatchEvents(void)
         if (e.xfocus.window == focus) {
           unfocus = focus;
           focus = None;
+          printf("FocusIn focus=%lx unfocus=%lx\n", focus, unfocus);
         }
       }
     } else {
index a16eb87516dc5d2a1e73242ab2a3a39f9c4b4083..c62d247175206f0f31fd9f12afa5577599ecab15 100644 (file)
@@ -3205,22 +3205,6 @@ static PyObject *_wrap_OtkWidget_setEventDispatcher(PyObject *self, PyObject *ar
 }
 
 
-static PyObject *_wrap_OtkWidget_unmanaged(PyObject *self, PyObject *args) {
-    PyObject *resultobj;
-    otk::OtkWidget *arg1 = (otk::OtkWidget *) 0 ;
-    PyObject * obj0  = 0 ;
-    
-    if(!PyArg_ParseTuple(args,(char *)"O:OtkWidget_unmanaged",&obj0)) goto fail;
-    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__OtkWidget,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    (arg1)->unmanaged();
-    
-    Py_INCREF(Py_None); resultobj = Py_None;
-    return resultobj;
-    fail:
-    return NULL;
-}
-
-
 static PyObject * OtkWidget_swigregister(PyObject *self, PyObject *args) {
     PyObject *obj;
     if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL;
@@ -10049,42 +10033,6 @@ static PyObject *_wrap_Style_b_unfocus_get(PyObject *self, PyObject *args) {
 }
 
 
-static PyObject *_wrap_Style_b_pressed_set(PyObject *self, PyObject *args) {
-    PyObject *resultobj;
-    otk::Style *arg1 = (otk::Style *) 0 ;
-    otk::BTexture *arg2 = (otk::BTexture *) 0 ;
-    PyObject * obj0  = 0 ;
-    PyObject * obj1  = 0 ;
-    
-    if(!PyArg_ParseTuple(args,(char *)"OO:Style_b_pressed_set",&obj0,&obj1)) goto fail;
-    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Style,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_otk__BTexture,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    if (arg1) (arg1)->b_pressed = *arg2;
-    
-    Py_INCREF(Py_None); resultobj = Py_None;
-    return resultobj;
-    fail:
-    return NULL;
-}
-
-
-static PyObject *_wrap_Style_b_pressed_get(PyObject *self, PyObject *args) {
-    PyObject *resultobj;
-    otk::Style *arg1 = (otk::Style *) 0 ;
-    otk::BTexture *result;
-    PyObject * obj0  = 0 ;
-    
-    if(!PyArg_ParseTuple(args,(char *)"O:Style_b_pressed_get",&obj0)) goto fail;
-    if ((SWIG_ConvertPtr(obj0,(void **) &arg1, SWIGTYPE_p_otk__Style,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail;
-    result = (otk::BTexture *)& ((arg1)->b_pressed);
-    
-    resultobj = SWIG_NewPointerObj((void *) result, SWIGTYPE_p_otk__BTexture, 0);
-    return resultobj;
-    fail:
-    return NULL;
-}
-
-
 static PyObject *_wrap_Style_b_pressed_focus_set(PyObject *self, PyObject *args) {
     PyObject *resultobj;
     otk::Style *arg1 = (otk::Style *) 0 ;
@@ -12832,7 +12780,6 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"OtkWidget_setStyle", _wrap_OtkWidget_setStyle, METH_VARARGS },
         { (char *)"OtkWidget_eventDispatcher", _wrap_OtkWidget_eventDispatcher, METH_VARARGS },
         { (char *)"OtkWidget_setEventDispatcher", _wrap_OtkWidget_setEventDispatcher, METH_VARARGS },
-        { (char *)"OtkWidget_unmanaged", _wrap_OtkWidget_unmanaged, METH_VARARGS },
         { (char *)"OtkWidget_swigregister", OtkWidget_swigregister, METH_VARARGS },
         { (char *)"new_OtkFocusWidget", _wrap_new_OtkFocusWidget, METH_VARARGS },
         { (char *)"delete_OtkFocusWidget", _wrap_delete_OtkFocusWidget, METH_VARARGS },
@@ -13089,8 +13036,6 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Style_b_focus_get", _wrap_Style_b_focus_get, METH_VARARGS },
         { (char *)"Style_b_unfocus_set", _wrap_Style_b_unfocus_set, METH_VARARGS },
         { (char *)"Style_b_unfocus_get", _wrap_Style_b_unfocus_get, METH_VARARGS },
-        { (char *)"Style_b_pressed_set", _wrap_Style_b_pressed_set, METH_VARARGS },
-        { (char *)"Style_b_pressed_get", _wrap_Style_b_pressed_get, METH_VARARGS },
         { (char *)"Style_b_pressed_focus_set", _wrap_Style_b_pressed_focus_set, METH_VARARGS },
         { (char *)"Style_b_pressed_focus_get", _wrap_Style_b_pressed_focus_get, METH_VARARGS },
         { (char *)"Style_b_pressed_unfocus_set", _wrap_Style_b_pressed_unfocus_set, METH_VARARGS },
index 5aeef434a249532cc35ef213d08a44d034189249..fcc0ff2e8b6ac326f3d5092a5d2c069726e50c19 100644 (file)
@@ -66,13 +66,21 @@ void Style::load(const Configuration &style) {
 
   b_focus = readDatabaseTexture("window.button.focus", "white", style);
   b_unfocus = readDatabaseTexture("window.button.unfocus", "black", style);
-  b_pressed = readDatabaseTexture("window.button.pressed", "black", style);
 
   //if neither of these can be found, we will use the previous resource
   b_pressed_focus = readDatabaseTexture("window.button.pressed.focus",
                                         "black", style, true);
+  if (b_pressed_focus.texture() == BTexture::NoTexture) {
+    b_pressed_focus = readDatabaseTexture("window.button.pressed", "black",
+                                          style);
+  }
+    
   b_pressed_unfocus = readDatabaseTexture("window.button.pressed.unfocus",
                                           "black", style, true);
+  if (b_pressed_unfocus.texture() == BTexture::NoTexture) {
+    b_pressed_unfocus = readDatabaseTexture("window.button.pressed", "black",
+                                            style);
+  }
 
   if (close_button.mask != None)
     XFreePixmap(OBDisplay::display, close_button.mask);
index 95f9b4876cf0bddd6662ef4586d5e75ce596bdcc..d3b5903e94222f3639459d45541a94e4a8fc4b5f 100644 (file)
@@ -47,7 +47,7 @@ public:
     l_focus, l_unfocus,
     h_focus, h_unfocus,
     b_focus, b_unfocus,
-    b_pressed, b_pressed_focus, b_pressed_unfocus,
+    b_pressed_focus, b_pressed_unfocus,
     g_focus, g_unfocus;
 
   PixmapMask close_button, max_button, icon_button, stick_button;
@@ -103,7 +103,7 @@ public:
   inline BTexture *getButtonUnfocus(void) { return &b_unfocus; }
 
   inline BTexture *getButtonPressedFocus(void)
-  { return &b_pressed; }
+  { return &b_pressed_focus; }
   inline BTexture *getButtonPressedUnfocus(void)
   { return &b_pressed_unfocus; }
 
index e085bc9fa79579190199255e6113dad851cd25ce..9cc822aea8683ff98b41fdd606d8eca6d194ccbf 100644 (file)
@@ -248,6 +248,8 @@ void OtkWidget::render(void)
 {
   if (!_texture) return;
 
+  printf("rendering %lx\n", _texture);
+
   _bg_pixmap = _texture->render(_rect.width(), _rect.height(), _bg_pixmap);
 
   if (_bg_pixmap)
@@ -386,8 +388,8 @@ void OtkWidget::adjustVert(void)
 void OtkWidget::update(void)
 {
   if (_dirty) {
-    if (!_unmanaged)
-      adjust();
+    printf("widget dirty, redrawing\n");
+    adjust();
     render();
     XClearWindow(OBDisplay::display, _window);
   }
index fd14e57b1c0e0039e08009d1525742cd622e5c86..7c508fcdf445626c71c494b641a7ae3fea3433e6 100644 (file)
@@ -120,8 +120,6 @@ public:
   { return _event_dispatcher; }
   void setEventDispatcher(otk::OtkEventDispatcher *disp);
 
-  void unmanaged(void) { _unmanaged = true; }
-
 protected:
   
   bool _dirty;
@@ -166,8 +164,6 @@ protected:
   bool _fixed_width;
   bool _fixed_height;
 
-  bool _unmanaged;
-
   OtkEventDispatcher *_event_dispatcher;
 };
 
This page took 0.038386 seconds and 4 git commands to generate.