Commit 2ace397e authored by Javier Jardon's avatar Javier Jardon
Browse files

Remove deprecatedd code from GdkColor

https://bugzilla.gnome.org/show_bug.cgi?id=619649
parent a18f23c4
......@@ -3124,7 +3124,7 @@ like this:</para>
* displays. Therefore, this call is required so that GDK and X can
* give us the closest color available in the colormap
*/
gdk_color_alloc(gtk_widget_get_colormap(widget), color);
gdk_colormap_alloc_color(gtk_widget_get_colormap(widget), color, FALSE, TRUE);
/* set the foreground to our color */
gdk_gc_set_foreground(gc, color);
......
......@@ -365,27 +365,16 @@ gdk_pixbuf_get_from_image
GdkColor
GdkColormap
gdk_colormap_new
gdk_colormap_ref
gdk_colormap_unref
gdk_colormap_get_system
gdk_colormap_get_system_size
gdk_colormap_change
gdk_colormap_alloc_colors
gdk_colormap_alloc_color
gdk_colormap_free_colors
gdk_colormap_query_color
gdk_colormap_get_visual
gdk_colormap_get_screen
gdk_colors_store
gdk_color_copy
gdk_color_free
gdk_colors_alloc
gdk_colors_free
gdk_color_white
gdk_color_black
gdk_color_parse
gdk_color_alloc
gdk_color_change
gdk_color_equal
gdk_color_hash
gdk_color_to_string
......
......@@ -32,10 +32,7 @@ directly.
In previous revisions of this interface, a number
of functions that take a #GdkColormap parameter
were replaced with functions whose names began
with "gdk_colormap_". This process will probably
be extended somewhat in the future -
gdk_color_white(), gdk_color_black(), and
gdk_color_change() will probably become aliases.
with "gdk_colormap_".
</para>
<!-- ##### SECTION See_Also ##### -->
......@@ -78,23 +75,6 @@ The colormap structure contains the following public fields.
@Returns:
<!-- ##### FUNCTION gdk_colormap_ref ##### -->
<para>
</para>
@cmap:
@Returns:
<!-- ##### FUNCTION gdk_colormap_unref ##### -->
<para>
</para>
@cmap:
<!-- ##### FUNCTION gdk_colormap_get_system ##### -->
<para>
</para>
......@@ -103,22 +83,6 @@ The colormap structure contains the following public fields.
@Returns:
<!-- ##### FUNCTION gdk_colormap_get_system_size ##### -->
<para>
</para>
@void:
@Returns:
<!-- ##### FUNCTION gdk_colormap_change ##### -->
<para>
</para>
@colormap:
@ncolors:
<!-- ##### FUNCTION gdk_colormap_alloc_colors ##### -->
<para>
</para>
......@@ -179,15 +143,6 @@ The colormap structure contains the following public fields.
@Returns:
<!-- ##### FUNCTION gdk_colors_store ##### -->
<para>
</para>
@colormap:
@colors:
@ncolors:
<!-- ##### FUNCTION gdk_color_copy ##### -->
<para>
</para>
......@@ -203,47 +158,6 @@ The colormap structure contains the following public fields.
@color:
<!-- ##### FUNCTION gdk_colors_alloc ##### -->
<para>
</para>
@colormap:
@contiguous:
@planes:
@nplanes:
@pixels:
@npixels:
@Returns:
<!-- ##### FUNCTION gdk_colors_free ##### -->
<para>
</para>
@colormap:
@pixels:
@npixels:
@planes:
<!-- ##### FUNCTION gdk_color_white ##### -->
<para>
</para>
@colormap:
@color:
@Returns:
<!-- ##### FUNCTION gdk_color_black ##### -->
<para>
</para>
@colormap:
@color:
@Returns:
<!-- ##### FUNCTION gdk_color_parse ##### -->
<para>
</para>
......@@ -253,24 +167,6 @@ The colormap structure contains the following public fields.
@Returns:
<!-- ##### FUNCTION gdk_color_alloc ##### -->
<para>
</para>
@colormap:
@color:
@Returns:
<!-- ##### FUNCTION gdk_color_change ##### -->
<para>
</para>
@colormap:
@color:
@Returns:
<!-- ##### FUNCTION gdk_color_equal ##### -->
<para>
</para>
......
......@@ -218,45 +218,6 @@ gdk_screen_get_system_colormap (GdkScreen *screen)
return colormap;
}
gint
gdk_colormap_get_system_size (void)
{
GdkVisual *visual;
visual = gdk_visual_get_system ();
return visual->colormap_size;
}
void
gdk_colormap_change (GdkColormap *colormap,
gint ncolors)
{
g_message ("gdk_colormap_change() is deprecated and unimplemented");
}
gboolean
gdk_colors_alloc (GdkColormap *colormap,
gboolean contiguous,
gulong *planes,
gint nplanes,
gulong *pixels,
gint npixels)
{
/* g_message ("gdk_colors_alloc() is deprecated and unimplemented"); */
return TRUE; /* return TRUE here to make GdkRGB happy */
}
void
gdk_colors_free (GdkColormap *colormap,
gulong *in_pixels,
gint in_npixels,
gulong planes)
{
/* g_message ("gdk_colors_free() is deprecated and unimplemented"); */
}
void
gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,
......@@ -344,44 +305,6 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
return 0;
}
gboolean
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
{
GdkColormapPrivateDirectFB *private;
IDirectFBPalette *palette;
g_return_val_if_fail (GDK_IS_COLORMAP (colormap), FALSE);
g_return_val_if_fail (color != NULL, FALSE);
private = colormap->windowing_data;
if (!private)
return FALSE;
palette = private->palette;
if (!palette)
return FALSE;
if (color->pixel < 0 || color->pixel >= colormap->size)
return FALSE;
if (private->info[color->pixel].flags & GDK_COLOR_WRITEABLE)
{
DFBColor entry = { 0xFF,
color->red >> 8,
color->green >> 8,
color->blue >> 8 };
if (palette->SetEntries (palette, &entry, 1, color->pixel) != DFB_OK)
return FALSE;
colormap->colors[color->pixel] = *color;
return TRUE;
}
return FALSE;
}
void
gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
......
......@@ -354,12 +354,6 @@ gdk_cairo_region
#if IN_HEADER(__GDK_COLOR_H__)
#if IN_FILE(__GDK_COLOR_C__)
#ifndef GDK_DISABLE_DEPRECATED
gdk_colors_store
gdk_color_white
gdk_color_black
gdk_color_alloc
#endif
gdk_color_copy
gdk_color_equal
gdk_color_free
......@@ -368,10 +362,6 @@ gdk_color_hash
gdk_colormap_alloc_color
gdk_colormap_get_system
gdk_colormap_get_visual
#ifndef GDK_DISABLE_DEPRECATED
gdk_colormap_ref
gdk_colormap_unref
#endif
gdk_color_parse
gdk_color_to_string
#endif
......@@ -381,13 +371,6 @@ gdk_color_to_string
#if IN_FILE(__GDK_COLOR_X11_C__)
gdk_colormap_new
gdk_colormap_get_type G_GNUC_CONST
#ifndef GDK_DISABLE_DEPRECATED
gdk_colormap_change
gdk_colors_alloc
gdk_colors_free
gdk_colormap_get_system_size
gdk_color_change
#endif
gdk_colormap_alloc_colors
gdk_colormap_free_colors
gdk_colormap_query_color
......
......@@ -32,36 +32,6 @@
#include "gdkinternals.h"
#include "gdkalias.h"
/**
* gdk_colormap_ref:
* @cmap: a #GdkColormap
*
* Deprecated function; use g_object_ref() instead.
*
* Return value: the colormap
*
* Deprecated: 2.0: Use g_object_ref() instead.
**/
GdkColormap*
gdk_colormap_ref (GdkColormap *cmap)
{
return (GdkColormap *) g_object_ref (cmap);
}
/**
* gdk_colormap_unref:
* @cmap: a #GdkColormap
*
* Deprecated function; use g_object_unref() instead.
*
* Deprecated: 2.0: Use g_object_unref() instead.
**/
void
gdk_colormap_unref (GdkColormap *cmap)
{
g_object_unref (cmap);
}
/**
* gdk_colormap_get_visual:
......@@ -79,34 +49,6 @@ gdk_colormap_get_visual (GdkColormap *colormap)
return colormap->visual;
}
/**
* gdk_colors_store:
* @colormap: a #GdkColormap.
* @colors: the new color values.
* @ncolors: the number of colors to change.
*
* Changes the value of the first @ncolors colors in
* a private colormap. This function is obsolete and
* should not be used. See gdk_color_change().
**/
void
gdk_colors_store (GdkColormap *colormap,
GdkColor *colors,
gint ncolors)
{
gint i;
for (i = 0; i < ncolors; i++)
{
colormap->colors[i].pixel = colors[i].pixel;
colormap->colors[i].red = colors[i].red;
colormap->colors[i].green = colors[i].green;
colormap->colors[i].blue = colors[i].blue;
}
gdk_colormap_change (colormap, ncolors);
}
/**
* gdk_color_copy:
* @color: a #GdkColor.
......@@ -143,70 +85,6 @@ gdk_color_free (GdkColor *color)
g_slice_free (GdkColor, color);
}
/**
* gdk_color_white:
* @colormap: a #GdkColormap.
* @color: the location to store the color.
*
* Returns the white color for a given colormap. The resulting
* value has already allocated been allocated.
*
* Return value: %TRUE if the allocation succeeded.
**/
gboolean
gdk_color_white (GdkColormap *colormap,
GdkColor *color)
{
gint return_val;
g_return_val_if_fail (colormap != NULL, FALSE);
if (color)
{
color->red = 65535;
color->green = 65535;
color->blue = 65535;
return_val = gdk_colormap_alloc_color (colormap, color, FALSE, TRUE);
}
else
return_val = FALSE;
return return_val;
}
/**
* gdk_color_black:
* @colormap: a #GdkColormap.
* @color: the location to store the color.
*
* Returns the black color for a given colormap. The resulting
* value has already been allocated.
*
* Return value: %TRUE if the allocation succeeded.
**/
gboolean
gdk_color_black (GdkColormap *colormap,
GdkColor *color)
{
gint return_val;
g_return_val_if_fail (colormap != NULL, FALSE);
if (color)
{
color->red = 0;
color->green = 0;
color->blue = 0;
return_val = gdk_colormap_alloc_color (colormap, color, FALSE, TRUE);
}
else
return_val = FALSE;
return return_val;
}
/********************
* Color allocation *
********************/
......@@ -217,14 +95,13 @@ gdk_color_black (GdkColormap *colormap,
* @color: the color to allocate. On return the
* <structfield>pixel</structfield> field will be
* filled in if allocation succeeds.
* @writeable: If %TRUE, the color is allocated writeable
* (their values can later be changed using gdk_color_change()).
* Writeable colors cannot be shared between applications.
* @writeable: this parameter has no effect, and it's here for mere
* compatibility.
* @best_match: If %TRUE, GDK will attempt to do matching against
* existing colors if the color cannot be allocated as requested.
*
* Allocates a single color from a colormap.
*
*
* Return value: %TRUE if the allocation succeeded.
**/
gboolean
......@@ -241,29 +118,6 @@ gdk_colormap_alloc_color (GdkColormap *colormap,
return success;
}
/**
* gdk_color_alloc:
* @colormap: a #GdkColormap.
* @color: The color to allocate. On return, the
* <structfield>pixel</structfield> field will be filled in.
*
* Allocates a single color from a colormap.
*
* Return value: %TRUE if the allocation succeeded.
*
* Deprecated: 2.2: Use gdk_colormap_alloc_color() instead.
**/
gboolean
gdk_color_alloc (GdkColormap *colormap,
GdkColor *color)
{
gboolean success;
gdk_colormap_alloc_colors (colormap, color, 1, FALSE, TRUE, &success);
return success;
}
/**
* gdk_color_hash:
* @colora: a #GdkColor.
......
......@@ -91,27 +91,12 @@ GType gdk_colormap_get_type (void) G_GNUC_CONST;
GdkColormap* gdk_colormap_new (GdkVisual *visual,
gboolean allocate);
#ifndef GDK_DISABLE_DEPRECATED
GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
void gdk_colormap_unref (GdkColormap *cmap);
#endif
#ifndef GDK_MULTIHEAD_SAFE
GdkColormap* gdk_colormap_get_system (void);
#endif
GdkScreen *gdk_colormap_get_screen (GdkColormap *cmap);
#ifndef GDK_DISABLE_DEPRECATED
gint gdk_colormap_get_system_size (void);
#endif
#if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
/* Used by gdk_colors_store () */
void gdk_colormap_change (GdkColormap *colormap,
gint ncolors);
#endif
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
gint n_colors,
......@@ -142,34 +127,6 @@ gchar * gdk_color_to_string (const GdkColor *color);
GType gdk_color_get_type (void) G_GNUC_CONST;
/* The following functions are deprecated */
#ifndef GDK_DISABLE_DEPRECATED
void gdk_colors_store (GdkColormap *colormap,
GdkColor *colors,
gint ncolors);
gint gdk_color_white (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_black (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_alloc (GdkColormap *colormap,
GdkColor *color);
gint gdk_color_change (GdkColormap *colormap,
GdkColor *color);
#endif /* GDK_DISABLE_DEPRECATED */
#if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
/* Used by gdk_rgb_try_colormap () */
gint gdk_colors_alloc (GdkColormap *colormap,
gboolean contiguous,
gulong *planes,
gint nplanes,
gulong *pixels,
gint npixels);
void gdk_colors_free (GdkColormap *colormap,
gulong *pixels,
gint npixels,
gulong planes);
#endif /* !GDK_DISABLE_DEPRECATED || GDK_COMPILATION */
G_END_DECLS
......
......@@ -99,39 +99,6 @@ gdk_screen_get_rgba_colormap (GdkScreen *screen)
return colormap;
}
gint
gdk_colormap_get_system_size (void)
{
/* FIXME: Implement */
return 0;
}
void
gdk_colormap_change (GdkColormap *colormap,
gint ncolors)
{
/* FIXME: Implement */
}
gboolean
gdk_colors_alloc (GdkColormap *colormap,
gboolean contiguous,
gulong *planes,
gint nplanes,
gulong *pixels,
gint npixels)
{
return TRUE;
}
void
gdk_colors_free (GdkColormap *colormap,
gulong *pixels,
gint npixels,
gulong planes)
{
}
void
gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,
......@@ -213,14 +180,3 @@ _gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
else
*alpha = 1.0;
}
gboolean
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
{
if (color->pixel < 0 || color->pixel >= colormap->size)
return FALSE;
return TRUE;
}
......@@ -195,8 +195,6 @@ test_colourmaps (void)
static void
test_colours (void)
{
ASSERT (gdk_color_white (system_colourmap, &white));
ASSERT (gdk_color_black (system_colourmap, &black));
red.red = 65535;
red.green = red.blue = 0;
TEST (gdk_colormap_alloc_color (system_colourmap, &red, FALSE, TRUE));
......
......@@ -570,9 +570,6 @@ gdk_colormap_new (GdkVisual *visual,
if (private_cmap)
{
sync_colors (colormap);
#if 0 /* XXX is this needed or not? Seems redundant */
gdk_colormap_change (colormap, colormap->size);
#endif
}
break;
......@@ -640,82 +637,7 @@ gdk_screen_get_system_colormap (GdkScreen *screen)
return colormap;
}
gint