we are using the GTK port of wxWindows on Solaris and Linux. We observed
that our application uses different colours on differents machines,
especially on 8-Bit-Grafik machines.
After digging a bit in the wxWindows code i found (in
src/gtk/colour.cpp) that wxGTK on 8-Bit-Grafic displays searches only
the already existing colortable, but do not allocate a new color if the
color is not already existing. For a lot of cases there are still colors
available and thus a new color could be allocated.
I've changed the file src/gtk/colour.cpp, more exactly the
wxColour::CalcPixel method and the wxColourRefData::FreeColour method to
allocate a new color and free it again later. I've tested it a bit on
Solaris 8 and 24 Bit grafic machines and on Linux and it seems to work.
Issue migrated from trac ticket # 96
component: wxGTK | priority: normal
2000-12-14 10:11:23: benndorf created the issue
we are using the GTK port of wxWindows on Solaris and Linux. We observed that our application uses different colours on differents machines, especially on 8-Bit-Grafik machines.
After digging a bit in the wxWindows code i found (in src/gtk/colour.cpp) that wxGTK on 8-Bit-Grafic displays searches only the already existing colortable, but do not allocate a new color if the color is not already existing. For a lot of cases there are still colors available and thus a new color could be allocated.
I've changed the file src/gtk/colour.cpp, more exactly the wxColour::CalcPixel method and the wxColourRefData::FreeColour method to allocate a new color and free it again later. I've tested it a bit on Solaris 8 and 24 Bit grafic machines and on Linux and it seems to work.
Best regards
Kai
My changes:
NEW: void wxColourRefData::FreeColour() { if( m_colormap ) { GdkColormapPrivate private_colormap = (GdkColormapPrivate) m_colormap; if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) { gdk_colormap_free_colors( m_colormap, &m_color, 1 ); } } } OLD: void wxColourRefData::FreeColour() { // if (m_hasPixel) gdk_colors_free( m_colormap, &m_color, 1, 0 ); }
NEW: void wxColour::CalcPixel( GdkColormap *cmap ) { if (!Ok()) return;
return;
); } else { M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color ); }
} OLD: void wxColour::CalcPixel( GdkColormap *cmap ) { if (!Ok()) return;
return;
&M_COLDATA->m_color ); }
}
--
Dipl.-Inf. Kai Benndorf mailto:benndorf@pb.izm.fhg.de Fraunhofer Gesellschaft URL:http://www.pb.izm.fhg.de Institut Zuverlässigkeit und Mikrointegration PHONE: (++49) 5251 60-6165 Fürstenallee 11 HOME: (++49) 5261 14465 33102 Paderborn FAX: (++49) 5251 60-6155 Germany