Commit e624656c authored by Benjamin Otte's avatar Benjamin Otte
Browse files

API: Remove GdkColormap

parent 94f809d4
......@@ -244,16 +244,9 @@ gdk_pixbuf_get_from_surface
</SECTION>
<SECTION>
<TITLE>Colormaps and Colors</TITLE>
<TITLE>Colors</TITLE>
<FILE>colors</FILE>
GdkColor
GdkColormap
gdk_colormap_new
gdk_colormap_alloc_colors
gdk_colormap_alloc_color
gdk_colormap_free_colors
gdk_colormap_get_visual
gdk_colormap_get_screen
gdk_color_copy
gdk_color_free
gdk_color_parse
......@@ -262,18 +255,8 @@ gdk_color_hash
gdk_color_to_string
<SUBSECTION Standard>
GDK_COLORMAP
GDK_COLORMAP_GET_CLASS
GDK_TYPE_COLORMAP
GDK_IS_COLORMAP
GDK_COLORMAP_CLASS
GDK_IS_COLORMAP_CLASS
GDK_TYPE_COLOR
<SUBSECTION Private>
GdkColormapClass
gdk_colormap_get_type
gdk_color_get_type
</SECTION>
<SECTION>
......@@ -1000,9 +983,6 @@ gdk_x11_screen_lookup_visual
gdk_x11_window_set_user_time
gdk_x11_window_move_to_current_desktop
gdk_x11_display_get_user_time
gdk_x11_colormap_foreign_new
gdk_x11_colormap_get_xcolormap
gdk_x11_colormap_get_xdisplay
gdk_x11_cursor_get_xcursor
gdk_x11_cursor_get_xdisplay
gdk_x11_display_broadcast_startup_message
......
......@@ -187,7 +187,6 @@ x11_introspection_files = \
x11/checksettings.c \
x11/gdkapplaunchcontext-x11.c \
x11/gdkasync.c \
x11/gdkcolor-x11.c \
x11/gdkcursor-x11.c \
x11/gdkdevice-core.c \
x11/gdkdevicemanager-core.c \
......
......@@ -304,23 +304,11 @@ gdk_color_equal
gdk_color_free
gdk_color_get_type G_GNUC_CONST
gdk_color_hash
gdk_colormap_alloc_color
gdk_colormap_get_visual
gdk_color_parse
gdk_color_to_string
#endif
#endif
#if IN_HEADER(__GDK_COLOR_H__)
#if IN_FILE(__GDK_COLOR_X11_C__)
gdk_colormap_new
gdk_colormap_get_type G_GNUC_CONST
gdk_colormap_alloc_colors
gdk_colormap_free_colors
gdk_colormap_get_screen
#endif
#endif
#if IN_HEADER(__GDK_CURSOR_H__)
#if IN_FILE(__GDK_CURSOR_C__)
gdk_cursor_get_type G_GNUC_CONST
......
......@@ -32,22 +32,6 @@
#include "gdkinternals.h"
/**
* gdk_colormap_get_visual:
* @colormap: a #GdkColormap.
*
* Returns the visual for which a given colormap was created.
*
* Return value: the visual of the colormap.
**/
GdkVisual *
gdk_colormap_get_visual (GdkColormap *colormap)
{
g_return_val_if_fail (GDK_IS_COLORMAP (colormap), NULL);
return colormap->visual;
}
/**
* gdk_color_copy:
* @color: a #GdkColor.
......@@ -84,39 +68,6 @@ gdk_color_free (GdkColor *color)
g_slice_free (GdkColor, color);
}
/********************
* Color allocation *
********************/
/**
* gdk_colormap_alloc_color:
* @colormap: a #GdkColormap.
* @color: the color to allocate. On return the
* <structfield>pixel</structfield> field will be
* filled in if allocation succeeds.
* @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
gdk_colormap_alloc_color (GdkColormap *colormap,
GdkColor *color,
gboolean writeable,
gboolean best_match)
{
gboolean success;
gdk_colormap_alloc_colors (colormap, color, 1, writeable, best_match,
&success);
return success;
}
/**
* gdk_color_hash:
* @colora: a #GdkColor.
......@@ -168,15 +119,13 @@ G_DEFINE_BOXED_TYPE (GdkColor, gdk_color,
* Parses a textual specification of a color and fill in the
* <structfield>red</structfield>, <structfield>green</structfield>,
* and <structfield>blue</structfield> fields of a #GdkColor
* structure. The color is <emphasis>not</emphasis> allocated, you
* must call gdk_colormap_alloc_color() yourself. The string can
* either one of a large set of standard names. (Taken from the X11
* <filename>rgb.txt</filename> file), or it can be a hex value in the
* form '&num;rgb' '&num;rrggbb' '&num;rrrgggbbb' or
* '&num;rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the
* red, green, and blue components of the color, respectively. (White
* in the four forms is '&num;fff' '&num;ffffff' '&num;fffffffff' and
* '&num;ffffffffffff')
* structure. The string can either one of a large set of standard
* names. (Taken from the X11 <filename>rgb.txt</filename> file), or
* it can be a hex value in the form '&num;rgb' '&num;rrggbb'
* '&num;rrrgggbbb' or '&num;rrrrggggbbbb' where 'r', 'g' and 'b' are
* hex digits of the red, green, and blue components of the color,
* respectively. (White in the four forms is '&num;fff' '&num;ffffff'
* '&num;fffffffff' and '&num;ffffffffffff')
*
* Return value: %TRUE if the parsing succeeded.
**/
......
......@@ -38,10 +38,7 @@ G_BEGIN_DECLS
/* The color type.
* A color consists of red, green and blue values in the
* range 0-65535 and a pixel value. The pixel value is highly
* dependent on the depth and colormap which this color will
* be used to draw into. Therefore, sharing colors between
* colormaps is a bad idea.
* range 0-65535 and a pixel value. The pixel value is unused.
*/
struct _GdkColor
{
......@@ -51,64 +48,8 @@ struct _GdkColor
guint16 blue;
};
/* The colormap type.
*/
typedef struct _GdkColormapClass GdkColormapClass;
#define GDK_TYPE_COLORMAP (gdk_colormap_get_type ())
#define GDK_COLORMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_COLORMAP, GdkColormap))
#define GDK_COLORMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_COLORMAP, GdkColormapClass))
#define GDK_IS_COLORMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_COLORMAP))
#define GDK_IS_COLORMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_COLORMAP))
#define GDK_COLORMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_COLORMAP, GdkColormapClass))
#define GDK_TYPE_COLOR (gdk_color_get_type ())
struct _GdkColormap
{
/*< private >*/
GObject parent_instance;
/*< public >*/
gint GSEAL (size);
GdkColor *GSEAL (colors);
/*< private >*/
GdkVisual *GSEAL (visual);
gpointer GSEAL (windowing_data);
};
struct _GdkColormapClass
{
GObjectClass parent_class;
};
GType gdk_colormap_get_type (void) G_GNUC_CONST;
GdkColormap* gdk_colormap_new (GdkVisual *visual,
gboolean allocate);
GdkScreen *gdk_colormap_get_screen (GdkColormap *cmap);
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
gint n_colors,
gboolean writeable,
gboolean best_match,
gboolean *success);
gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
GdkColor *color,
gboolean writeable,
gboolean best_match);
void gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,
gint n_colors);
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
GdkColor *gdk_color_copy (const GdkColor *color);
void gdk_color_free (GdkColor *color);
gboolean gdk_color_parse (const gchar *spec,
......
......@@ -90,7 +90,6 @@ typedef guint32 GdkNativeWindow;
/* Forward declarations of commonly used types
*/
typedef struct _GdkColor GdkColor;
typedef struct _GdkColormap GdkColormap;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkVisual GdkVisual;
......
......@@ -22,7 +22,6 @@ libgdk_quartz_la_SOURCES = \
GdkQuartzWindow.c \
GdkQuartzWindow.h \
gdkapplaunchcontext-quartz.c \
gdkcolor-quartz.c \
gdkcursor-quartz.c \
gdkdevice-core.c \
gdkdevicemanager-core.c \
......
/* gdkcolor-quartz.c
*
* Copyright (C) 2005 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "gdkcolor.h"
#include "gdkprivate-quartz.h"
GType
gdk_colormap_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
const GTypeInfo object_info =
{
sizeof (GdkColormapClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) NULL,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkColormap),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkColormap",
&object_info,
0);
}
return object_type;
}
GdkColormap *
gdk_colormap_new (GdkVisual *visual,
gint private_cmap)
{
g_return_val_if_fail (visual != NULL, NULL);
/* FIXME: Implement */
return NULL;
}
void
gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,
gint n_colors)
{
/* This function shouldn't do anything since colors are never allocated. */
}
gint
gdk_colormap_alloc_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors,
gboolean writeable,
gboolean best_match,
gboolean *success)
{
int i;
int alpha;
g_return_val_if_fail (GDK_IS_COLORMAP (colormap), ncolors);
g_return_val_if_fail (colors != NULL, ncolors);
g_return_val_if_fail (success != NULL, ncolors);
if (gdk_colormap_get_visual (colormap)->depth == 32)
alpha = 0xff;
else
alpha = 0;
for (i = 0; i < ncolors; i++)
{
colors[i].pixel = alpha << 24 |
((colors[i].red >> 8) & 0xff) << 16 |
((colors[i].green >> 8) & 0xff) << 8 |
((colors[i].blue >> 8) & 0xff);
}
*success = TRUE;
return 0;
}
GdkScreen*
gdk_colormap_get_screen (GdkColormap *cmap)
{
g_return_val_if_fail (cmap != NULL, NULL);
return gdk_screen_get_default ();
}
......@@ -27,7 +27,6 @@ EXTRA_DIST += \
libgdk_win32_la_SOURCES = \
xcursors.h \
gdkapplaunchcontext-win32.c \
gdkcolor-win32.c \
gdkcursor-win32.c \
gdkdevicemanager-win32.c \
gdkdevicemanager-win32.h \
......
This diff is collapsed.
......@@ -179,9 +179,6 @@ void gdk_win32_handle_table_insert (HANDLE *handle,
gpointer data);
void gdk_win32_handle_table_remove (HANDLE handle);
COLORREF _gdk_win32_colormap_color (GdkColormap *colormap,
gulong pixel);
HRGN _gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region,
gint x_origin,
gint y_origin);
......
......@@ -32,7 +32,6 @@ all: \
gdk_win32_OBJECTS = \
gdkapplaunchcontext-win32.obj \
gdkcolor-win32.obj \
gdkcursor-win32.obj \
gdkdnd-win32.obj \
gdkdisplay-win32.obj \
......
......@@ -21,7 +21,6 @@ libgdk_x11_la_SOURCES = \
gdkapplaunchcontext-x11.c \
gdkasync.c \
gdkasync.h \
gdkcolor-x11.c \
gdkcursor-x11.c \
gdkdevice-core.h \
gdkdevice-core.c \
......
This diff is collapsed.
......@@ -295,8 +295,6 @@ gdk_screen_x11_finalize (GObject *object)
g_free (screen_x11->window_manager_name);
g_hash_table_destroy (screen_x11->colormap_hash);
deinit_multihead (GDK_SCREEN (object));
G_OBJECT_CLASS (_gdk_screen_x11_parent_class)->finalize (object);
......
......@@ -78,7 +78,6 @@ struct _GdkScreenX11
GdkVisualType available_types[6];
gint navailable_types;
GHashTable *visual_hash;
GHashTable *colormap_hash;
GdkVisual *rgba_visual;
/* X settings */
......
......@@ -37,8 +37,6 @@ G_BEGIN_DECLS
Display *gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable);
XID gdk_x11_drawable_get_xid (GdkDrawable *drawable);
GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window);
Display *gdk_x11_colormap_get_xdisplay (GdkColormap *colormap);
Colormap gdk_x11_colormap_get_xcolormap (GdkColormap *colormap);
Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
Display *gdk_x11_display_get_xdisplay (GdkDisplay *display);
......@@ -57,8 +55,6 @@ Display *gdk_x11_get_default_xdisplay (void);
gint gdk_x11_get_default_screen (void);
#endif
#define GDK_COLORMAP_XDISPLAY(cmap) (gdk_x11_colormap_get_xdisplay (cmap))
#define GDK_COLORMAP_XCOLORMAP(cmap) (gdk_x11_colormap_get_xcolormap (cmap))
#define GDK_CURSOR_XDISPLAY(cursor) (gdk_x11_cursor_get_xdisplay (cursor))
#define GDK_CURSOR_XCURSOR(cursor) (gdk_x11_cursor_get_xcursor (cursor))
......@@ -105,9 +101,6 @@ GdkVisual* gdk_x11_screen_lookup_visual (GdkScreen *screen,
GdkVisual* gdkx_visual_get (VisualID xvisualid);
#endif
GdkColormap *gdk_x11_colormap_foreign_new (GdkVisual *visual,
Colormap xcolormap);
/* Return the Gdk* for a particular XID */
gpointer gdk_xid_table_lookup_for_display (GdkDisplay *display,
XID xid);
......
......@@ -84,8 +84,6 @@ test_type (gconstpointer data)
if (g_type_is_a (type, GTK_TYPE_SETTINGS))
instance = g_object_ref (gtk_settings_get_default ());
else if (g_type_is_a (type, GDK_TYPE_COLORMAP))
instance = g_object_ref (gdk_colormap_new (gdk_visual_get_best (), TRUE));
else if (g_type_is_a (type, GDK_TYPE_WINDOW))
{
GdkWindowAttr attributes;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment