aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-08-26 16:37:48 (GMT)
committerrathnor <rathnor>2004-08-26 16:37:48 (GMT)
commit0f83e449727a16c178b47262f170e879a22c0981 (patch)
treed167b77a07b99c931402d699ad6b1f2c90bed757
parent346a6598a62350c5d234e3177de9e6c6c1963475 (diff)
downloadfluxbox_pavel-0f83e449727a16c178b47262f170e879a22c0981.zip
fluxbox_pavel-0f83e449727a16c178b47262f170e879a22c0981.tar.bz2
fix rendering of bevels for textures with solid textures
-rw-r--r--ChangeLog2
-rw-r--r--src/FbTk/Texture.cc43
-rw-r--r--src/FbTk/Texture.hh4
-rw-r--r--src/FbTk/ThemeItems.hh8
4 files changed, 53 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 117e7b2..1139bfa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.10: 2Changes for 0.9.10:
3*04/08/26: 3*04/08/26:
4 * Fix bevel on solid colour textures (Simon)
5 FbTk/Texture.hh/cc FbTk/ThemeItems.hh
4 * Make arrow in toolbar buttons scalable size (Simon) 6 * Make arrow in toolbar buttons scalable size (Simon)
5 - new theme item: toolbar.button.scale: <number> 7 - new theme item: toolbar.button.scale: <number>
6 The number is a scale factor, which is divided into 100 to give 8 The number is a scale factor, which is divided into 100 to give
diff --git a/src/FbTk/Texture.cc b/src/FbTk/Texture.cc
index 41314ce..dbf9cf5 100644
--- a/src/FbTk/Texture.cc
+++ b/src/FbTk/Texture.cc
@@ -22,10 +22,12 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Texture.cc,v 1.8 2004/01/11 21:04:21 fluxgen Exp $ 25// $Id: Texture.cc,v 1.9 2004/08/26 16:37:48 rathnor Exp $
26 26
27#include "App.hh"
27#include "Texture.hh" 28#include "Texture.hh"
28 29
30#include <X11/Xlib.h>
29#include <cstring> 31#include <cstring>
30#include <cctype> 32#include <cctype>
31 33
@@ -100,4 +102,43 @@ void Texture::setFromString(const char * const texture_str) {
100 delete [] ts; 102 delete [] ts;
101} 103}
102 104
105void Texture::calcHiLoColors(int screen_num) {
106 Display *disp = FbTk::App::instance()->display();
107 XColor xcol;
108 Colormap colm = DefaultColormap(disp, screen_num);
109
110 xcol.red = (unsigned int) (m_color.red() +
111 (m_color.red() >> 1));
112 if (xcol.red >= 0xff) xcol.red = 0xffff;
113 else xcol.red *= 0xff;
114 xcol.green = (unsigned int) (m_color.green() +
115 (m_color.green() >> 1));
116 if (xcol.green >= 0xff) xcol.green = 0xffff;
117 else xcol.green *= 0xff;
118 xcol.blue = (unsigned int) (m_color.blue() +
119 (m_color.blue() >> 1));
120 if (xcol.blue >= 0xff) xcol.blue = 0xffff;
121 else xcol.blue *= 0xff;
122
123 if (! XAllocColor(disp, colm, &xcol))
124 xcol.pixel = 0;
125
126 m_hicolor.setPixel(xcol.pixel);
127
128 xcol.red =
129 (unsigned int) ((m_color.red() >> 2) +
130 (m_color.red() >> 1)) * 0xff;
131 xcol.green =
132 (unsigned int) ((m_color.green() >> 2) +
133 (m_color.green() >> 1)) * 0xff;
134 xcol.blue =
135 (unsigned int) ((m_color.blue() >> 2) +
136 (m_color.blue() >> 1)) * 0xff;
137
138 if (! XAllocColor(disp, colm, &xcol))
139 xcol.pixel = 0;
140
141 m_locolor.setPixel(xcol.pixel);
142}
143
103}; // end namespace FbTk 144}; // end namespace FbTk
diff --git a/src/FbTk/Texture.hh b/src/FbTk/Texture.hh
index 336086a..1ee3e79 100644
--- a/src/FbTk/Texture.hh
+++ b/src/FbTk/Texture.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Texture.hh,v 1.6 2003/12/16 17:06:52 fluxgen Exp $ 25// $Id: Texture.hh,v 1.7 2004/08/26 16:37:48 rathnor Exp $
26 26
27#ifndef FBTK_TEXTURE_HH 27#ifndef FBTK_TEXTURE_HH
28#define FBTK_TEXTURE_HH 28#define FBTK_TEXTURE_HH
@@ -83,6 +83,8 @@ public:
83 83
84 FbPixmap &pixmap() { return m_pixmap; } 84 FbPixmap &pixmap() { return m_pixmap; }
85 85
86 void calcHiLoColors(int screen_num);
87
86 const Color &color() const { return m_color; } 88 const Color &color() const { return m_color; }
87 const Color &colorTo() const { return m_color_to; } 89 const Color &colorTo() const { return m_color_to; }
88 const Color &hiColor() const { return m_hicolor; } 90 const Color &hiColor() const { return m_hicolor; }
diff --git a/src/FbTk/ThemeItems.hh b/src/FbTk/ThemeItems.hh
index 57a5f11..f17cba6 100644
--- a/src/FbTk/ThemeItems.hh
+++ b/src/FbTk/ThemeItems.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: ThemeItems.hh,v 1.6 2004/04/26 15:04:37 rathnor Exp $ 22// $Id: ThemeItems.hh,v 1.7 2004/08/26 16:37:48 rathnor Exp $
23 23
24/// @file implements common theme items 24/// @file implements common theme items
25 25
@@ -128,7 +128,11 @@ void ThemeItem<FbTk::Texture>::load(const std::string *o_name, const std::string
128 if (!m_value.colorTo().setFromString(colorto_name.c_str(), 128 if (!m_value.colorTo().setFromString(colorto_name.c_str(),
129 m_tm.screenNum())) 129 m_tm.screenNum()))
130 m_value.colorTo().setFromString("white", m_tm.screenNum()); 130 m_value.colorTo().setFromString("white", m_tm.screenNum());
131 131
132
133 if ((m_value.type() & FbTk::Texture::SOLID) != 0 && (m_value.type() & FbTk::Texture::FLAT) == 0)
134 m_value.calcHiLoColors(m_tm.screenNum());
135
132 StringUtil::removeFirstWhitespace(pixmap_name); 136 StringUtil::removeFirstWhitespace(pixmap_name);
133 StringUtil::removeTrailingWhitespace(pixmap_name); 137 StringUtil::removeTrailingWhitespace(pixmap_name);
134 if (pixmap_name.empty()) { 138 if (pixmap_name.empty()) {