- texture = &(screen->getWindowStyle()->b_pressed);
- frame.pbutton = texture->render(frame.button_w, frame.button_w,
- frame.pbutton);
- if (! frame.pbutton)
- frame.pbutton_pixel = texture->color().pixel();
+ unsigned char needsPressed = 0;
+
+ texture = &(screen->getWindowStyle()->b_pressed_focus);
+
+ if (texture->texture() != BTexture::NoTexture) {
+ frame.pfbutton = texture->render(frame.button_w, frame.button_w,
+ frame.pfbutton);
+ if (! frame.pfbutton)
+ frame.pfbutton_pixel = texture->color().pixel();
+ } else {
+ needsPressed = 0x1;
+ }
+
+ texture = &(screen->getWindowStyle()->b_pressed_unfocus);
+
+ if (texture->texture() != BTexture::NoTexture) {
+ frame.pubutton = texture->render(frame.button_w, frame.button_w,
+ frame.pubutton);
+ if (! frame.pubutton)
+ frame.pubutton = texture->color().pixel();
+ } else {
+ needsPressed |= 0x2;
+ }
+
+ // if we either pressed unfocused, or pressed focused were undefined,
+ // make them inherit from the old resource. It's a hack for sure, but
+ // it allows for some backwards and forwards compatibility.
+ if (needsPressed) {
+ texture = &(screen->getWindowStyle()->b_pressed);
+
+ if (needsPressed & 0x1) {
+ frame.pfbutton = texture->render(frame.button_w, frame.button_w,
+ frame.pfbutton);
+ if (! frame.pfbutton)
+ frame.pfbutton_pixel = texture->color().pixel();
+ }
+ if (needsPressed & 0x2) {
+ frame.pubutton = texture->render(frame.button_w, frame.button_w,
+ frame.pubutton);
+ if (! frame.pubutton)
+ frame.pubutton = texture->color().pixel();
+ }
+
+ }