all repos — fluxbox @ 3e0d0de6d9de39981ea0fd624a3d506f20670cb3

custom fork of the fluxbox windowmanager

removed assignment operator
fluxgen fluxgen
commit

3e0d0de6d9de39981ea0fd624a3d506f20670cb3

parent

14d355e65826398ac3cb5ac1f1d97bfbeceabe27

2 files changed, 20 insertions(+), 7 deletions(-)

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

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Color.cc,v 1.2 2002/09/14 13:49:51 fluxgen Exp $ +// $Id: Color.cc,v 1.3 2002/09/20 13:02:39 fluxgen Exp $ #include "Color.hh"

@@ -57,7 +57,8 @@ allocate(red, green, blue, screen);

} Color::Color(const char *color_string, int screen): -m_allocated(false) { +m_allocated(false), +m_screen(screen) { setFromString(color_string, screen); }

@@ -94,10 +95,16 @@

return true; } +/* Color &Color::Color::operator = (const Color &col_copy) { + // check for aliasing + if (this == &col_copy) + return *this; + copy(col_copy); return *this; } +*/ void Color::free() { if (isAllocated()) {

@@ -113,9 +120,11 @@

void Color::copy(const Color &col_copy) { if (!col_copy.isAllocated()) { free(); + setRGB(col_copy.red(), col_copy.green(), col_copy.blue()); + setPixel(col_copy.pixel()); return; } - + free(); allocate(col_copy.red(),

@@ -131,8 +140,9 @@ Display *disp = BaseDisplay::getXDisplay();

XColor color; // fill xcolor structure color.red = red; + color.green = green; color.blue = blue; - color.green = green; + if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) { cerr<<"FbTk::Color: Allocation error."<<endl;

@@ -143,6 +153,8 @@ maxValue(color.blue));

setPixel(color.pixel); setAllocated(true); } + + m_screen = screen; } void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) {

@@ -150,4 +162,5 @@ m_red = red;

m_green = green; m_blue = blue; } + };
M src/Color.hhsrc/Color.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Color.hh,v 1.2 2002/09/14 13:49:09 fluxgen Exp $ +// $Id: Color.hh,v 1.3 2002/09/20 13:02:40 fluxgen Exp $ #ifndef FBTK_COLOR_HH #define FBTK_COLOR_HH

@@ -45,8 +45,8 @@

bool setFromString(const char *color_string, int screen); /// TODO don't like this void setPixel(unsigned long pixel) { m_pixel = pixel; } - - Color &operator = (const Color &col_copy); + // TODO + //Color &operator = (const Color &col_copy); bool isAllocated() const { return m_allocated; } unsigned char red() const { return m_red; }