API: Remove colormap handling from GdkScreen

In particular, the following functions are gone:
- gdk_screen_get_default_colormap()
- gdk_screen_set_default_colormap()
- gdk_screen_get_system_colormap()
- gdk_screen_get_rgba_colormap()
This commit is contained in:
Benjamin Otte 2010-08-29 12:51:07 +02:00
parent 04d5c477aa
commit cf4cb4f6d9
16 changed files with 4 additions and 365 deletions

View File

@ -190,11 +190,7 @@ gdk_display_manager_get_type
<TITLE>GdkScreen</TITLE>
GdkScreen
gdk_screen_get_default
gdk_screen_get_default_colormap
gdk_screen_set_default_colormap
gdk_screen_get_system_colormap
gdk_screen_get_system_visual
gdk_screen_get_rgba_colormap
gdk_screen_get_rgba_visual
gdk_screen_is_composited
gdk_screen_get_root_window
@ -253,7 +249,6 @@ gdk_pixbuf_get_from_surface
GdkColor
GdkColormap
gdk_colormap_new
gdk_colormap_get_system
gdk_colormap_alloc_colors
gdk_colormap_alloc_color
gdk_colormap_free_colors

View File

@ -305,7 +305,6 @@ gdk_color_free
gdk_color_get_type G_GNUC_CONST
gdk_color_hash
gdk_colormap_alloc_color
gdk_colormap_get_system
gdk_colormap_get_visual
gdk_color_parse
gdk_color_to_string
@ -847,14 +846,11 @@ gdk_screen_get_number
gdk_screen_get_primary_monitor
gdk_screen_get_root_window
gdk_screen_get_setting
gdk_screen_get_default_colormap
gdk_screen_set_default_colormap
gdk_screen_get_n_monitors
gdk_screen_get_monitor_geometry
gdk_screen_get_monitor_width_mm
gdk_screen_get_monitor_height_mm
gdk_screen_get_monitor_plug_name
gdk_screen_get_rgba_colormap
gdk_screen_get_rgba_visual
gdk_screen_get_active_window
gdk_screen_get_window_stack
@ -863,12 +859,6 @@ gdk_screen_make_display_name
#endif
#endif
#if IN_HEADER(__GDK_SCREEN_H__)
#if IN_FILE(__GDK_COLOR_X11_C__)
gdk_screen_get_system_colormap
#endif
#endif
#if IN_HEADER(__GDK_SELECTION_H__)
#if IN_FILE(__GDK_SELECTION_C__)
gdk_selection_owner_set

View File

@ -224,17 +224,3 @@ gdk_color_to_string (const GdkColor *color)
return pango_color_to_string (&pango_color);
}
/**
* gdk_colormap_get_system:
*
* Gets the system's default colormap for the default screen. (See
* gdk_colormap_get_system_for_screen ())
*
* Return value: the default colormap.
**/
GdkColormap*
gdk_colormap_get_system (void)
{
return gdk_screen_get_system_colormap (gdk_screen_get_default ());
}

View File

@ -91,10 +91,6 @@ GType gdk_colormap_get_type (void) G_GNUC_CONST;
GdkColormap* gdk_colormap_new (GdkVisual *visual,
gboolean allocate);
#ifndef GDK_MULTIHEAD_SAFE
GdkColormap* gdk_colormap_get_system (void);
#endif
GdkScreen *gdk_colormap_get_screen (GdkColormap *cmap);
gint gdk_colormap_alloc_colors (GdkColormap *colormap,

View File

@ -23,7 +23,6 @@
#include "config.h"
#include "gdk.h" /* For gdk_rectangle_intersect() */
#include "gdkcolor.h"
#include "gdkwindow.h"
#include "gdkscreen.h"
#include "gdkintl.h"

View File

@ -63,12 +63,7 @@ struct _GdkScreenClass
};
GType gdk_screen_get_type (void) G_GNUC_CONST;
GdkColormap *gdk_screen_get_default_colormap (GdkScreen *screen);
void gdk_screen_set_default_colormap (GdkScreen *screen,
GdkColormap *colormap);
GdkColormap* gdk_screen_get_system_colormap (GdkScreen *screen);
GdkVisual* gdk_screen_get_system_visual (GdkScreen *screen);
GdkColormap *gdk_screen_get_rgba_colormap (GdkScreen *screen);
GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen);
gboolean gdk_screen_is_composited (GdkScreen *screen);

View File

@ -62,43 +62,6 @@ gdk_colormap_new (GdkVisual *visual,
return NULL;
}
GdkColormap *
gdk_screen_get_system_colormap (GdkScreen *screen)
{
static GdkColormap *colormap = NULL;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
if (!colormap)
{
colormap = g_object_new (GDK_TYPE_COLORMAP, NULL);
colormap->visual = gdk_visual_get_system ();
colormap->size = colormap->visual->colormap_size;
}
return colormap;
}
GdkColormap *
gdk_screen_get_rgba_colormap (GdkScreen *screen)
{
static GdkColormap *colormap = NULL;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
if (!colormap)
{
colormap = g_object_new (GDK_TYPE_COLORMAP, NULL);
colormap->visual = gdk_screen_get_rgba_visual (screen);
colormap->size = colormap->visual->colormap_size;
}
return colormap;
}
void
gdk_colormap_free_colors (GdkColormap *colormap,
const GdkColor *colors,

View File

@ -84,9 +84,6 @@ _gdk_screen_quartz_init (GdkScreenQuartz *screen_quartz)
GdkScreen *screen = GDK_SCREEN (screen_quartz);
NSScreen *nsscreen;
gdk_screen_set_default_colormap (screen,
gdk_screen_get_system_colormap (screen));
nsscreen = [[NSScreen screens] objectAtIndex:0];
gdk_screen_set_resolution (screen,
72.0 * [nsscreen userSpaceScaleFactor]);
@ -104,12 +101,6 @@ gdk_screen_quartz_dispose (GObject *object)
{
GdkScreenQuartz *screen = GDK_SCREEN_QUARTZ (object);
if (screen->default_colormap)
{
g_object_unref (screen->default_colormap);
screen->default_colormap = NULL;
}
if (screen->screen_changed_id)
{
g_source_remove (screen->screen_changed_id);
@ -313,31 +304,6 @@ _gdk_windowing_substitute_screen_number (const gchar *display_name,
return g_strdup (display_name);
}
GdkColormap*
gdk_screen_get_default_colormap (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return GDK_SCREEN_QUARTZ (screen)->default_colormap;
}
void
gdk_screen_set_default_colormap (GdkScreen *screen,
GdkColormap *colormap)
{
GdkColormap *old_colormap;
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (GDK_IS_COLORMAP (colormap));
old_colormap = GDK_SCREEN_QUARTZ (screen)->default_colormap;
GDK_SCREEN_QUARTZ (screen)->default_colormap = g_object_ref (colormap);
if (old_colormap)
g_object_unref (old_colormap);
}
gint
gdk_screen_get_width (GdkScreen *screen)
{

View File

@ -38,7 +38,6 @@ struct _GdkScreenQuartz
GdkScreen parent_instance;
GdkDisplay *display;
GdkColormap *default_colormap;
/* Origin of "root window" in Cocoa coordinates */
gint min_x;

View File

@ -590,53 +590,6 @@ gdk_colormap_new (GdkVisual *visual,
return colormap;
}
GdkColormap*
gdk_screen_get_system_colormap (GdkScreen *screen)
{
static GdkColormap *colormap = NULL;
GdkColormapPrivateWin32 *private;
g_return_val_if_fail (screen == _gdk_screen, NULL);
if (!colormap)
{
colormap = g_object_new (gdk_colormap_get_type (), NULL);
private = GDK_WIN32_COLORMAP_DATA (colormap);
colormap->visual = gdk_visual_get_system ();
colormap->size = colormap->visual->colormap_size;
private->private_val = FALSE;
switch (colormap->visual->type)
{
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR:
private->info = g_new0 (GdkColorInfo, colormap->size);
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
(GEqualFunc) gdk_color_equal);
/* Fallthrough */
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_STATIC_COLOR:
create_colormap (colormap, FALSE);
colormap->colors = g_new (GdkColor, colormap->size);
sync_colors (colormap);
break;
case GDK_VISUAL_TRUE_COLOR:
break;
default:
g_assert_not_reached ();
}
}
return colormap;
}
static void
gdk_colors_free (GdkColormap *colormap,
gulong *in_pixels,

View File

@ -204,8 +204,6 @@ gdk_display_open (const gchar *display_name)
_gdk_monitor_init ();
_gdk_visual_init ();
gdk_screen_set_default_colormap (_gdk_screen,
gdk_screen_get_system_colormap (_gdk_screen));
_gdk_windowing_window_init (_gdk_screen);
_gdk_events_init ();
_gdk_input_init (_gdk_display);

View File

@ -21,8 +21,6 @@
#include "gdk.h"
#include "gdkprivate-win32.h"
static GdkColormap *default_colormap = NULL;
GdkDisplay *
gdk_screen_get_display (GdkScreen *screen)
{
@ -35,29 +33,6 @@ gdk_screen_get_root_window (GdkScreen *screen)
return _gdk_root;
}
GdkColormap *
gdk_screen_get_default_colormap (GdkScreen *screen)
{
return default_colormap;
}
void
gdk_screen_set_default_colormap (GdkScreen *screen,
GdkColormap *colormap)
{
GdkColormap *old_colormap;
g_return_if_fail (screen == _gdk_screen);
g_return_if_fail (GDK_IS_COLORMAP (colormap));
old_colormap = default_colormap;
default_colormap = g_object_ref (colormap);
if (old_colormap)
g_object_unref (old_colormap);
}
gint
gdk_screen_get_n_monitors (GdkScreen *screen)
{
@ -119,14 +94,6 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
*dest = _gdk_monitors[num_monitor].rect;
}
GdkColormap *
gdk_screen_get_rgba_colormap (GdkScreen *screen)
{
g_return_val_if_fail (screen == _gdk_screen, NULL);
return NULL;
}
GdkVisual *
gdk_screen_get_rgba_visual (GdkScreen *screen)
{

View File

@ -348,69 +348,6 @@ gdk_colormap_sync (GdkColormap *colormap,
gdk_colormap_sync_palette (colormap);
}
/**
* gdk_screen_get_system_colormap:
* @screen: a #GdkScreen
*
* Gets the system's default colormap for @screen
*
* Returns: (transfer none): the default colormap for @screen.
*
* Since: 2.2
*/
GdkColormap *
gdk_screen_get_system_colormap (GdkScreen *screen)
{
GdkColormap *colormap = NULL;
GdkColormapPrivateX11 *private;
GdkScreenX11 *screen_x11;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
screen_x11 = GDK_SCREEN_X11 (screen);
if (screen_x11->system_colormap)
return screen_x11->system_colormap;
colormap = g_object_new (GDK_TYPE_COLORMAP, NULL);
private = GDK_COLORMAP_PRIVATE_DATA (colormap);
private->screen = screen;
colormap->visual = gdk_screen_get_system_visual (screen);
private->xcolormap = DefaultColormapOfScreen (screen_x11->xscreen);
private->private_val = FALSE;
private->hash = NULL;
private->last_sync_time = 0;
private->info = NULL;
colormap->colors = NULL;
colormap->size = colormap->visual->colormap_size;
switch (colormap->visual->type)
{
case GDK_VISUAL_GRAYSCALE:
case GDK_VISUAL_PSEUDO_COLOR:
private->info = g_new0 (GdkColorInfo, colormap->size);
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
(GEqualFunc) gdk_color_equal);
/* Fall through */
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_STATIC_COLOR:
case GDK_VISUAL_DIRECT_COLOR:
colormap->colors = g_new (GdkColor, colormap->size);
gdk_colormap_sync (colormap, TRUE);
case GDK_VISUAL_TRUE_COLOR:
break;
}
gdk_colormap_add (colormap);
screen_x11->system_colormap = colormap;
return colormap;
}
/*
* gdk_colormap_change:
* @colormap: a #GdkColormap.
@ -1039,10 +976,6 @@ gdk_x11_colormap_foreign_new (GdkVisual *visual,
screen = gdk_visual_get_screen (visual);
if (xcolormap == DefaultColormap (GDK_SCREEN_XDISPLAY (screen),
GDK_SCREEN_XNUMBER (screen)))
return g_object_ref (gdk_screen_get_system_colormap (screen));
colormap = gdk_colormap_lookup (screen, xcolormap);
if (colormap)
return g_object_ref (colormap);

View File

@ -237,50 +237,6 @@ gdk_screen_get_root_window (GdkScreen *screen)
return GDK_SCREEN_X11 (screen)->root_window;
}
/**
* gdk_screen_get_default_colormap:
* @screen: a #GdkScreen
*
* Gets the default colormap for @screen.
*
* Returns: (transfer none): the default #GdkColormap.
*
* Since: 2.2
**/
GdkColormap *
gdk_screen_get_default_colormap (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return GDK_SCREEN_X11 (screen)->default_colormap;
}
/**
* gdk_screen_set_default_colormap:
* @screen: a #GdkScreen
* @colormap: a #GdkColormap
*
* Sets the default @colormap for @screen.
*
* Since: 2.2
**/
void
gdk_screen_set_default_colormap (GdkScreen *screen,
GdkColormap *colormap)
{
GdkColormap *old_colormap;
g_return_if_fail (GDK_IS_SCREEN (screen));
g_return_if_fail (GDK_IS_COLORMAP (colormap));
old_colormap = GDK_SCREEN_X11 (screen)->default_colormap;
GDK_SCREEN_X11 (screen)->default_colormap = g_object_ref (colormap);
if (old_colormap)
g_object_unref (old_colormap);
}
static void
_gdk_screen_x11_events_uninit (GdkScreen *screen)
{
@ -310,24 +266,6 @@ gdk_screen_x11_dispose (GObject *object)
_gdk_screen_x11_events_uninit (GDK_SCREEN (object));
if (screen_x11->default_colormap)
{
g_object_unref (screen_x11->default_colormap);
screen_x11->default_colormap = NULL;
}
if (screen_x11->system_colormap)
{
g_object_unref (screen_x11->system_colormap);
screen_x11->system_colormap = NULL;
}
if (screen_x11->rgba_colormap)
{
g_object_unref (screen_x11->rgba_colormap);
screen_x11->rgba_colormap = NULL;
}
if (screen_x11->root_window)
_gdk_window_destroy (screen_x11->root_window, TRUE);
@ -538,11 +476,11 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
}
/**
* gdk_screen_get_rgba_colormap:
* @screen: a #GdkScreen.
* gdk_screen_get_rgba_visual:
* @screen: a #GdkScreen
*
* Gets a colormap to use for creating windows with an alpha
* channel. The windowing system on which GTK+ is running
* Gets a visual to use for creating windows with an alpha channel.
* The windowing system on which GTK+ is running
* may not support this capability, in which case %NULL will
* be returned. Even if a non-%NULL value is returned, its
* possible that the window's alpha channel won't be honored
@ -554,37 +492,6 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
*
* For setting an overall opacity for a top-level window, see
* gdk_window_set_opacity().
* Return value: (transfer none): a colormap to use for windows with
* an alpha channel or %NULL if the capability is not available.
*
* Since: 2.8
**/
GdkColormap *
gdk_screen_get_rgba_colormap (GdkScreen *screen)
{
GdkScreenX11 *screen_x11;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
screen_x11 = GDK_SCREEN_X11 (screen);
if (!screen_x11->rgba_visual)
return NULL;
if (!screen_x11->rgba_colormap)
screen_x11->rgba_colormap = gdk_colormap_new (screen_x11->rgba_visual,
FALSE);
return screen_x11->rgba_colormap;
}
/**
* gdk_screen_get_rgba_visual:
* @screen: a #GdkScreen
*
* Gets a visual to use for creating windows with an alpha channel.
* See the docs for gdk_screen_get_rgba_colormap() for caveats.
*
* Return value: (transfer none): a visual to use for windows with an
* alpha channel or %NULL if the capability is not available.

View File

@ -81,11 +81,6 @@ struct _GdkScreenX11
GHashTable *colormap_hash;
GdkVisual *rgba_visual;
/* Colormap Part */
GdkColormap *default_colormap;
GdkColormap *system_colormap;
GdkColormap *rgba_colormap;
/* X settings */
XSettingsClient *xsettings_client;
guint xsettings_in_init : 1;

View File

@ -429,9 +429,6 @@ _gdk_windowing_window_init (GdkScreen * screen)
g_assert (screen_x11->root_window == NULL);
gdk_screen_set_default_colormap (screen,
gdk_screen_get_system_colormap (screen));
screen_x11->root_window = g_object_new (GDK_TYPE_WINDOW, NULL);
private = (GdkWindowObject *) screen_x11->root_window;