Commit 04d5c477 authored by Benjamin Otte's avatar Benjamin Otte
Browse files

API: Remove gdk_drawable_get_colormap()

And with it, remove any notion of colormaps from GdkWindow. In
particular, X11 windows will now not set attrs.colormap when calling
XCreateWindow.
parent 28b45671
......@@ -285,7 +285,6 @@ gdk_color_get_type
<TITLE>Drawing Primitives</TITLE>
<FILE>drawing</FILE>
GdkDrawable
gdk_drawable_get_colormap
gdk_drawable_get_size
gdk_drawable_get_clip_region
gdk_drawable_get_visible_region
......
......@@ -72,15 +72,6 @@ or a #GdkWindow.
@colormap:
<!-- ##### FUNCTION gdk_drawable_get_colormap ##### -->
<para>
</para>
@drawable:
@Returns:
<!-- ##### FUNCTION gdk_drawable_get_depth ##### -->
<para>
......
......@@ -533,7 +533,6 @@ gdk_drag_get_protocol
#if IN_HEADER(__GDK_DRAWABLE_H__)
#if IN_FILE(__GDK_DRAW_C__)
gdk_drawable_get_clip_region
gdk_drawable_get_colormap
gdk_drawable_get_size
gdk_drawable_get_type G_GNUC_CONST
gdk_drawable_get_visible_region
......
......@@ -81,23 +81,6 @@ gdk_drawable_get_size (GdkDrawable *drawable,
GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
}
/**
* gdk_drawable_get_colormap:
* @drawable: a #GdkDrawable
*
* Gets the colormap for @drawable, if one is set; returns
* %NULL otherwise.
*
* Return value: the colormap, or %NULL
**/
GdkColormap*
gdk_drawable_get_colormap (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable);
}
/**
* gdk_drawable_get_clip_region:
* @drawable: a #GdkDrawable
......
......@@ -60,8 +60,6 @@ struct _GdkDrawableClass
gint *width,
gint *height);
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
cairo_region_t* (*get_clip_region) (GdkDrawable *drawable);
cairo_region_t* (*get_visible_region) (GdkDrawable *drawable);
......@@ -92,7 +90,6 @@ GType gdk_drawable_get_type (void) G_GNUC_CONST;
void gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
......
......@@ -51,7 +51,6 @@ struct _GdkOffscreenWindow
GdkDrawable parent_instance;
GdkWindow *wrapper;
GdkColormap *colormap;
GdkScreen *screen;
cairo_surface_t *surface;
......@@ -109,9 +108,6 @@ gdk_offscreen_window_destroy (GdkWindow *window,
if (!recursing)
gdk_offscreen_window_hide (window);
g_object_unref (offscreen->colormap);
offscreen->colormap = NULL;
}
static gboolean
......@@ -140,14 +136,6 @@ gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable)
return cairo_surface_reference (offscreen->surface);
}
static GdkColormap*
gdk_offscreen_window_get_colormap (GdkDrawable *drawable)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
return offscreen->colormap;
}
void
_gdk_offscreen_window_new (GdkWindow *window,
GdkScreen *screen,
......@@ -173,14 +161,6 @@ _gdk_offscreen_window_new (GdkWindow *window,
offscreen->screen = screen;
if (gdk_screen_get_system_visual (screen) == private->visual)
{
offscreen->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (offscreen->colormap);
}
else
offscreen->colormap = gdk_colormap_new (private->visual, FALSE);
offscreen->surface = gdk_window_create_similar_surface ((GdkWindow *)private->parent,
CAIRO_CONTENT_COLOR,
private->width,
......@@ -705,7 +685,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
object_class->finalize = gdk_offscreen_window_finalize;
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
drawable_class->get_colormap = gdk_offscreen_window_get_colormap;
}
static void
......
......@@ -227,8 +227,6 @@ static void gdk_window_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
static cairo_region_t* gdk_window_get_clip_region (GdkDrawable *drawable);
static cairo_region_t* gdk_window_get_visible_region (GdkDrawable *drawable);
......@@ -374,7 +372,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
object_class->get_property = gdk_window_get_property;
drawable_class->get_size = gdk_window_real_get_size;
drawable_class->get_colormap = gdk_window_real_get_colormap;
drawable_class->ref_cairo_surface = gdk_window_ref_cairo_surface;
drawable_class->create_cairo_surface = gdk_window_create_cairo_surface;
drawable_class->set_cairo_clip = gdk_window_set_cairo_clip;
......@@ -3659,17 +3656,6 @@ gdk_window_real_get_size (GdkDrawable *drawable,
*height = private->height;
}
static GdkColormap*
gdk_window_real_get_colormap (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
if (GDK_WINDOW_DESTROYED (drawable))
return NULL;
return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
}
static void
gdk_window_drop_cairo_surface (GdkWindowObject *private)
{
......
......@@ -106,20 +106,9 @@ gdk_quartz_ref_cairo_surface (GdkDrawable *drawable)
return impl->cairo_surface;
}
static GdkColormap*
gdk_quartz_get_colormap (GdkDrawable *drawable)
{
return GDK_DRAWABLE_IMPL_QUARTZ (drawable)->colormap;
}
static void
gdk_drawable_impl_quartz_finalize (GObject *object)
{
GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (object);
if (impl->colormap)
g_object_unref (impl->colormap);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
......@@ -135,8 +124,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
drawable_class->create_cairo_surface = gdk_quartz_create_cairo_surface;
drawable_class->get_colormap = gdk_quartz_get_colormap;
}
GType
......
......@@ -46,8 +46,6 @@ struct _GdkDrawableImplQuartz
GdkDrawable *wrapper;
GdkColormap *colormap;
cairo_surface_t *cairo_surface;
};
......
......@@ -833,29 +833,6 @@ _gdk_window_impl_new (GdkWindow *window,
}
}
if (!private->input_only)
{
if (private->visual == gdk_screen_get_system_visual (_gdk_screen))
{
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
else if (private->visual == gdk_screen_get_rgba_visual (_gdk_screen))
{
draw_impl->colormap = gdk_screen_get_rgba_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
else
{
draw_impl->colormap = gdk_colormap_new (private->visual, FALSE);
}
}
else
{
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
/* Maintain the z-ordered list of children. */
if (private->parent != (GdkWindowObject *)_gdk_root)
parent_impl->sorted_children = g_list_prepend (parent_impl->sorted_children, window);
......@@ -922,7 +899,7 @@ _gdk_window_impl_new (GdkWindow *window,
gdk_window_set_title (window, title);
if (draw_impl->colormap == gdk_screen_get_rgba_colormap (_gdk_screen))
if (gdk_window_get_visual (window) == gdk_screen_get_rgba_visual (_gdk_screen))
{
[impl->toplevel setOpaque:NO];
[impl->toplevel setBackgroundColor:[NSColor clearColor]];
......@@ -1048,8 +1025,6 @@ _gdk_windowing_window_init (void)
drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (private->impl);
drawable_impl->wrapper = GDK_DRAWABLE (private);
drawable_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (drawable_impl->colormap);
}
static void
......
......@@ -53,8 +53,6 @@ static cairo_surface_t *gdk_win32_create_cairo_surface (GdkDrawable *drawable,
int width,
int height);
static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable);
static void gdk_drawable_impl_win32_finalize (GObject *object);
static const cairo_user_data_key_t gdk_win32_cairo_key;
......@@ -72,8 +70,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
drawable_class->create_cairo_surface = gdk_win32_create_cairo_surface;
drawable_class->get_colormap = gdk_win32_get_colormap;
}
static void
......@@ -91,12 +87,6 @@ gdk_drawable_impl_win32_finalize (GObject *object)
* Win32 specific implementations of generic functions *
*****************************************************/
static GdkColormap*
gdk_win32_get_colormap (GdkDrawable *drawable)
{
return GDK_DRAWABLE_IMPL_WIN32 (drawable)->colormap;
}
/* Drawing
*/
......
......@@ -49,7 +49,6 @@ struct _GdkDrawableImplWin32
{
GdkDrawable parent_instance;
GdkDrawable *wrapper;
GdkColormap *colormap;
HANDLE handle;
guint hdc_count;
......
......@@ -37,7 +37,6 @@
#include "gdkdevicemanager-win32.h"
#include "gdkenumtypes.h"
static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_win32_init (GdkWindowImplWin32 *window);
static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass);
static void gdk_window_impl_win32_finalize (GObject *object);
......@@ -126,13 +125,10 @@ static void
gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_window_impl_win32_finalize;
drawable_class->get_colormap = gdk_window_impl_win32_get_colormap;
}
static void
......@@ -189,25 +185,6 @@ _gdk_win32_adjust_client_rect (GdkWindow *window,
API_CALL (AdjustWindowRectEx, (rect, style, FALSE, exstyle));
}
static GdkColormap*
gdk_window_impl_win32_get_colormap (GdkDrawable *drawable)
{
GdkDrawableImplWin32 *drawable_impl;
g_return_val_if_fail (GDK_IS_WINDOW_IMPL_WIN32 (drawable), NULL);
drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only &&
drawable_impl->colormap == NULL)
{
drawable_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (drawable_impl->colormap);
}
return drawable_impl->colormap;
}
void
_gdk_root_window_size_init (void)
{
......@@ -242,8 +219,6 @@ _gdk_windowing_window_init (GdkScreen *screen)
draw_impl->handle = GetDesktopWindow ();
draw_impl->wrapper = GDK_DRAWABLE (private);
draw_impl->colormap = gdk_screen_get_default_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
private->window_type = GDK_WINDOW_ROOT;
private->depth = gdk_visual_get_system ()->depth;
......@@ -486,9 +461,6 @@ _gdk_window_impl_new (GdkWindow *window,
dwExStyle = 0;
private->input_only = FALSE;
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
}
else
{
......@@ -499,9 +471,7 @@ _gdk_window_impl_new (GdkWindow *window,
dwExStyle = WS_EX_TRANSPARENT;
private->depth = 0;
private->input_only = TRUE;
draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
g_object_ref (draw_impl->colormap);
GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY, system colormap\n"));
GDK_NOTE (MISC, g_print ("... GDK_INPUT_ONLY\n"));
}
switch (private->window_type)
......
......@@ -44,8 +44,6 @@ static cairo_surface_t *gdk_x11_create_cairo_surface (GdkDrawable *drawable,
int width,
int height);
static GdkColormap* gdk_x11_get_colormap (GdkDrawable *drawable);
static const cairo_user_data_key_t gdk_x11_cairo_key;
G_DEFINE_TYPE (GdkDrawableImplX11, _gdk_drawable_impl_x11, GDK_TYPE_DRAWABLE)
......@@ -57,8 +55,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
drawable_class->create_cairo_surface = gdk_x11_create_cairo_surface;
drawable_class->get_colormap = gdk_x11_get_colormap;
}
static void
......@@ -110,16 +106,6 @@ _gdk_x11_drawable_update_size (GdkDrawable *drawable)
* X11 specific implementations of generic functions *
*****************************************************/
static GdkColormap*
gdk_x11_get_colormap (GdkDrawable *drawable)
{
GdkDrawableImplX11 *impl;
impl = GDK_DRAWABLE_IMPL_X11 (drawable);
return impl->colormap;
}
static GdkDrawable *
get_impl_drawable (GdkDrawable *drawable)
{
......
......@@ -54,8 +54,6 @@ struct _GdkDrawableImplX11
GdkDrawable *wrapper;
GdkColormap *colormap;
Window xid;
GdkScreen *screen;
......
......@@ -110,7 +110,6 @@ static void move_to_current_desktop (GdkWindow *window);
static void gdk_window_x11_set_background (GdkWindow *window,
cairo_pattern_t *pattern);
static GdkColormap* gdk_window_impl_x11_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_x11_finalize (GObject *object);
static void gdk_window_impl_iface_init (GdkWindowImplIface *iface);
......@@ -175,11 +174,8 @@ static void
gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
object_class->finalize = gdk_window_impl_x11_finalize;
drawable_class->get_colormap = gdk_window_impl_x11_get_colormap;
}
static void
......@@ -422,34 +418,6 @@ _gdk_x11_window_tmp_reset_parent_bg (GdkWindow *window)
_gdk_x11_window_tmp_reset_bg (window, FALSE);
}
static GdkColormap*
gdk_window_impl_x11_get_colormap (GdkDrawable *drawable)
{
GdkDrawableImplX11 *drawable_impl;
g_return_val_if_fail (GDK_IS_WINDOW_IMPL_X11 (drawable), NULL);
drawable_impl = GDK_DRAWABLE_IMPL_X11 (drawable);
if (!((GdkWindowObject *) drawable_impl->wrapper)->input_only &&
drawable_impl->colormap == NULL)
{
XWindowAttributes window_attributes;
GdkVisual *visual;
XGetWindowAttributes (GDK_SCREEN_XDISPLAY (drawable_impl->screen),
drawable_impl->xid,
&window_attributes);
visual = gdk_x11_screen_lookup_visual (drawable_impl->screen,
window_attributes.visual->visualid);
drawable_impl->colormap = gdk_x11_colormap_foreign_new (visual,
window_attributes.colormap);
}
return drawable_impl->colormap;
}
void
_gdk_windowing_window_init (GdkScreen * screen)
{
......@@ -476,8 +444,6 @@ _gdk_windowing_window_init (GdkScreen * screen)
draw_impl->screen = screen;
draw_impl->xid = screen_x11->xroot_window;
draw_impl->wrapper = GDK_DRAWABLE (private);
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (draw_impl->colormap);
private->window_type = GDK_WINDOW_ROOT;
private->depth = DefaultDepthOfScreen (screen_x11->xscreen);
......@@ -762,16 +728,6 @@ _gdk_window_impl_new (GdkWindow *window,
{
class = InputOutput;
if ((gdk_screen_get_system_visual (screen)) == private->visual)
{
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (draw_impl->colormap);
}
else
{
draw_impl->colormap = gdk_colormap_new (private->visual, FALSE);
}
xattributes.background_pixel = BlackPixel (xdisplay, screen_x11->screen_num);
xattributes.border_pixel = BlackPixel (xdisplay, screen_x11->screen_num);
......@@ -800,8 +756,6 @@ _gdk_window_impl_new (GdkWindow *window,
else
{
class = InputOnly;
draw_impl->colormap = gdk_screen_get_system_colormap (screen);
g_object_ref (draw_impl->colormap);
}
if (private->width > 65535 ||
......@@ -5440,7 +5394,7 @@ _gdk_windowing_window_beep (GdkWindow *window)
* On X11, this works only on X screens with a compositing manager
* running.
*
* For setting up per-pixel alpha, see gdk_screen_get_rgba_colormap().
* For setting up per-pixel alpha, see gdk_screen_get_rgba_visual().
* For making non-toplevel windows translucent, see
* gdk_window_set_composited().
*
......
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