all repos — fluxbox @ 8143b86fece2d9be45113db8a1781231ac67c2a2

custom fork of the fluxbox windowmanager

improved code documentation
Mathias Gumz akira at fluxbox dot org
commit

8143b86fece2d9be45113db8a1781231ac67c2a2

parent

13b9ee09ee1a8d2423baa0f4f84f5509e389023a

2 files changed, 3 insertions(+), 14 deletions(-)

jump to
M src/FbTk/Color.ccsrc/FbTk/Color.cc

@@ -31,14 +31,6 @@ using std::cerr;

using std::endl; using std::string; -namespace { - -inline unsigned char maxValue(unsigned short colval) { - return colval == 65535 ? 0xFF : static_cast<unsigned char>(colval/0xFF); -} - -} - namespace FbTk { Color::Color():

@@ -96,9 +88,7 @@ else if (! XAllocColor(disp, colm, &color))

return false; setPixel(color.pixel); - setRGB(maxValue(color.red), - maxValue(color.green), - maxValue(color.blue)); + setRGB(color.red / 256, color.green / 256, color.blue / 256); setAllocated(true); m_screen = screen;

@@ -168,9 +158,7 @@ _FB_USES_NLS;

cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl; } else { free(); - setRGB(maxValue(color.red), - maxValue(color.green), - maxValue(color.blue)); + setRGB(color.red / 256, color.green / 256, color.blue / 256); setPixel(color.pixel); setAllocated(true); }
M src/FbTk/Color.hhsrc/FbTk/Color.hh

@@ -63,6 +63,7 @@ void setAllocated(bool a) { m_allocated = a; }

void setRGB(unsigned short red, unsigned short green, unsigned short blue); + // stored in [0 - 255] range unsigned short m_red, m_green, m_blue; unsigned long m_pixel; bool m_allocated;