forked from AuroraMiddleware/gtk
API: Remove drawable getters for visual, screen and depth
Removed and replaced are: gdk_drawable_get_visual() => gdk_window_get_visual() gdk_drawable_get_screen() => gdk_window_get_screen() gdk_drawable_get_depth() => gdk_visual_get_depth (gdk_window_get_visual())
This commit is contained in:
parent
ffed076891
commit
a6ef356107
@ -286,10 +286,7 @@ gdk_color_get_type
|
||||
<FILE>drawing</FILE>
|
||||
GdkDrawable
|
||||
gdk_drawable_get_display
|
||||
gdk_drawable_get_screen
|
||||
gdk_drawable_get_visual
|
||||
gdk_drawable_get_colormap
|
||||
gdk_drawable_get_depth
|
||||
gdk_drawable_get_size
|
||||
gdk_drawable_get_clip_region
|
||||
gdk_drawable_get_visible_region
|
||||
|
@ -534,13 +534,10 @@ gdk_drag_get_protocol
|
||||
#if IN_FILE(__GDK_DRAW_C__)
|
||||
gdk_drawable_get_clip_region
|
||||
gdk_drawable_get_colormap
|
||||
gdk_drawable_get_depth
|
||||
gdk_drawable_get_display
|
||||
gdk_drawable_get_screen
|
||||
gdk_drawable_get_size
|
||||
gdk_drawable_get_type G_GNUC_CONST
|
||||
gdk_drawable_get_visible_region
|
||||
gdk_drawable_get_visual
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -81,57 +81,6 @@ gdk_drawable_get_size (GdkDrawable *drawable,
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_visual:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Gets the #GdkVisual describing the pixel format of @drawable.
|
||||
*
|
||||
* Return value: a #GdkVisual
|
||||
**/
|
||||
GdkVisual*
|
||||
gdk_drawable_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_visual (drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_depth:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Obtains the bit depth of the drawable, that is, the number of bits
|
||||
* that make up a pixel in the drawable's visual. Examples are 8 bits
|
||||
* per pixel, 24 bits per pixel, etc.
|
||||
*
|
||||
* Return value: number of bits per pixel
|
||||
**/
|
||||
gint
|
||||
gdk_drawable_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
|
||||
}
|
||||
/**
|
||||
* gdk_drawable_get_screen:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Gets the #GdkScreen associated with a #GdkDrawable.
|
||||
*
|
||||
* Return value: the #GdkScreen associated with @drawable
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkScreen*
|
||||
gdk_drawable_get_screen(GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_screen (drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_display:
|
||||
* @drawable: a #GdkDrawable
|
||||
@ -147,7 +96,7 @@ gdk_drawable_get_display (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return gdk_screen_get_display (gdk_drawable_get_screen (drawable));
|
||||
return gdk_screen_get_display (gdk_colormap_get_screen (gdk_drawable_get_colormap (drawable)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,14 +56,11 @@ struct _GdkDrawableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gint (*get_depth) (GdkDrawable *drawable);
|
||||
void (*get_size) (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
|
||||
GdkVisual* (*get_visual) (GdkDrawable *drawable);
|
||||
GdkScreen* (*get_screen) (GdkDrawable *drawable);
|
||||
|
||||
cairo_region_t* (*get_clip_region) (GdkDrawable *drawable);
|
||||
cairo_region_t* (*get_visible_region) (GdkDrawable *drawable);
|
||||
@ -96,9 +93,6 @@ void gdk_drawable_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height);
|
||||
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
|
||||
GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
|
||||
gint gdk_drawable_get_depth (GdkDrawable *drawable);
|
||||
GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
|
||||
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
|
||||
|
||||
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
|
||||
|
@ -148,30 +148,6 @@ gdk_offscreen_window_get_colormap (GdkDrawable *drawable)
|
||||
return offscreen->colormap;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_offscreen_window_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return gdk_drawable_get_depth (offscreen->wrapper);
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_offscreen_window_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return offscreen->screen;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_offscreen_window_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return gdk_drawable_get_visual (offscreen->wrapper);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_offscreen_window_new (GdkWindow *window,
|
||||
GdkScreen *screen,
|
||||
@ -735,9 +711,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
|
||||
drawable_class->get_colormap = gdk_offscreen_window_get_colormap;
|
||||
drawable_class->get_depth = gdk_offscreen_window_get_depth;
|
||||
drawable_class->get_screen = gdk_offscreen_window_get_screen;
|
||||
drawable_class->get_visual = gdk_offscreen_window_get_visual;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -227,9 +227,6 @@ static void gdk_window_real_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
static GdkVisual* gdk_window_real_get_visual (GdkDrawable *drawable);
|
||||
static gint gdk_window_real_get_depth (GdkDrawable *drawable);
|
||||
static GdkScreen* gdk_window_real_get_screen (GdkDrawable *drawable);
|
||||
static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
|
||||
|
||||
static cairo_region_t* gdk_window_get_clip_region (GdkDrawable *drawable);
|
||||
@ -376,11 +373,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
|
||||
object_class->set_property = gdk_window_set_property;
|
||||
object_class->get_property = gdk_window_get_property;
|
||||
|
||||
drawable_class->get_depth = gdk_window_real_get_depth;
|
||||
drawable_class->get_screen = gdk_window_real_get_screen;
|
||||
drawable_class->get_size = gdk_window_real_get_size;
|
||||
drawable_class->get_colormap = gdk_window_real_get_colormap;
|
||||
drawable_class->get_visual = gdk_window_real_get_visual;
|
||||
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;
|
||||
@ -3651,31 +3645,6 @@ gdk_window_real_get_size (GdkDrawable *drawable,
|
||||
*height = private->height;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_window_real_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
|
||||
|
||||
colormap = gdk_drawable_get_colormap (drawable);
|
||||
return colormap ? gdk_colormap_get_visual (colormap) : NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_window_real_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (drawable), 0);
|
||||
|
||||
return ((GdkWindowObject *)GDK_WINDOW (drawable))->depth;
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_window_real_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_drawable_get_screen (GDK_WINDOW_OBJECT (drawable)->impl);
|
||||
}
|
||||
|
||||
static GdkColormap*
|
||||
gdk_window_real_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
|
@ -112,26 +112,6 @@ gdk_quartz_get_colormap (GdkDrawable *drawable)
|
||||
return GDK_DRAWABLE_IMPL_QUARTZ (drawable)->colormap;
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_quartz_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
return _gdk_screen;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_quartz_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_quartz_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
/* This is a bit bogus but I'm not sure the other way is better */
|
||||
|
||||
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drawable_impl_quartz_finalize (GObject *object)
|
||||
{
|
||||
@ -157,10 +137,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
|
||||
drawable_class->create_cairo_surface = gdk_quartz_create_cairo_surface;
|
||||
|
||||
drawable_class->get_colormap = gdk_quartz_get_colormap;
|
||||
|
||||
drawable_class->get_depth = gdk_quartz_get_depth;
|
||||
drawable_class->get_screen = gdk_quartz_get_screen;
|
||||
drawable_class->get_visual = gdk_quartz_get_visual;
|
||||
}
|
||||
|
||||
GType
|
||||
|
@ -55,12 +55,6 @@ static cairo_surface_t *gdk_win32_create_cairo_surface (GdkDrawable *drawable,
|
||||
|
||||
static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable);
|
||||
|
||||
static gint gdk_win32_get_depth (GdkDrawable *drawable);
|
||||
|
||||
static GdkScreen * gdk_win32_get_screen (GdkDrawable *drawable);
|
||||
|
||||
static GdkVisual* gdk_win32_get_visual (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_drawable_impl_win32_finalize (GObject *object);
|
||||
|
||||
static const cairo_user_data_key_t gdk_win32_cairo_key;
|
||||
@ -80,10 +74,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
|
||||
drawable_class->create_cairo_surface = gdk_win32_create_cairo_surface;
|
||||
|
||||
drawable_class->get_colormap = gdk_win32_get_colormap;
|
||||
|
||||
drawable_class->get_depth = gdk_win32_get_depth;
|
||||
drawable_class->get_screen = gdk_win32_get_screen;
|
||||
drawable_class->get_visual = gdk_win32_get_visual;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -257,26 +247,6 @@ _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_win32_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
/* This is a bit bogus but I'm not sure the other way is better */
|
||||
|
||||
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_win32_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_screen_get_default ();
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_win32_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);
|
||||
}
|
||||
|
||||
HGDIOBJ
|
||||
gdk_win32_drawable_get_handle (GdkDrawable *drawable)
|
||||
{
|
||||
|
@ -45,9 +45,6 @@ static cairo_surface_t *gdk_x11_create_cairo_surface (GdkDrawable *drawable,
|
||||
int height);
|
||||
|
||||
static GdkColormap* gdk_x11_get_colormap (GdkDrawable *drawable);
|
||||
static gint gdk_x11_get_depth (GdkDrawable *drawable);
|
||||
static GdkScreen * gdk_x11_get_screen (GdkDrawable *drawable);
|
||||
static GdkVisual* gdk_x11_get_visual (GdkDrawable *drawable);
|
||||
|
||||
static const cairo_user_data_key_t gdk_x11_cairo_key;
|
||||
|
||||
@ -62,10 +59,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
|
||||
drawable_class->create_cairo_surface = gdk_x11_create_cairo_surface;
|
||||
|
||||
drawable_class->get_colormap = gdk_x11_get_colormap;
|
||||
|
||||
drawable_class->get_depth = gdk_x11_get_depth;
|
||||
drawable_class->get_screen = gdk_x11_get_screen;
|
||||
drawable_class->get_visual = gdk_x11_get_visual;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -127,14 +120,6 @@ gdk_x11_get_colormap (GdkDrawable *drawable)
|
||||
return impl->colormap;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
/* This is a bit bogus but I'm not sure the other way is better */
|
||||
|
||||
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static GdkDrawable *
|
||||
get_impl_drawable (GdkDrawable *drawable)
|
||||
{
|
||||
@ -147,21 +132,6 @@ get_impl_drawable (GdkDrawable *drawable)
|
||||
}
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_x11_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
if (GDK_IS_DRAWABLE_IMPL_X11 (drawable))
|
||||
return GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
|
||||
else
|
||||
return GDK_DRAWABLE_IMPL_X11 (get_impl_drawable (drawable))->screen;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_x11_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_drawable_get_xdisplay:
|
||||
* @drawable: a #GdkDrawable.
|
||||
@ -257,23 +227,10 @@ gdk_x11_create_cairo_surface (GdkDrawable *drawable,
|
||||
GdkVisual *visual;
|
||||
|
||||
visual = gdk_window_get_visual (impl->wrapper);
|
||||
if (visual)
|
||||
return cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
|
||||
impl->xid,
|
||||
GDK_VISUAL_XVISUAL (visual),
|
||||
width, height);
|
||||
else if (gdk_drawable_get_depth (drawable) == 1)
|
||||
return cairo_xlib_surface_create_for_bitmap (GDK_SCREEN_XDISPLAY (impl->screen),
|
||||
impl->xid,
|
||||
GDK_SCREEN_XSCREEN (impl->screen),
|
||||
width, height);
|
||||
else
|
||||
{
|
||||
g_warning ("Using Cairo rendering requires the drawable argument to\n"
|
||||
"have a specified colormap. All windows have a colormap,\n"
|
||||
"so why is this code even reached?");
|
||||
return NULL;
|
||||
}
|
||||
return cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
|
||||
impl->xid,
|
||||
GDK_VISUAL_XVISUAL (visual),
|
||||
width, height);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
|
Loading…
Reference in New Issue
Block a user