diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt index b223b89f68..c8608beb25 100644 --- a/docs/reference/gdk/gdk-sections.txt +++ b/docs/reference/gdk/gdk-sections.txt @@ -259,6 +259,7 @@ gdk_pixmap_create_from_xpm gdk_pixmap_colormap_create_from_xpm gdk_pixmap_create_from_xpm_d gdk_pixmap_colormap_create_from_xpm_d +gdk_pixmap_get_size gdk_pixmap_ref gdk_pixmap_unref GdkBitmap diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index a768500513..bf05ba256e 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -1006,6 +1006,7 @@ gdk_pixmap_create_from_data gdk_pixmap_create_from_xpm gdk_pixmap_colormap_create_from_xpm_d gdk_pixmap_create_from_xpm_d +gdk_pixmap_get_size gdk_pixmap_get_type G_GNUC_CONST gdk_pixmap_new #endif diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index 8ff3e1c4e7..932de976f3 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -152,7 +152,8 @@ gdk_drawable_get_data (GdkDrawable *drawable, * size is the size reported in the most-recently-processed configure * event, rather than the current size on the X server. * - * Deprecated: 2.24: Use gdk_window_get_width() and gdk_window_get_height() + * Deprecated: 2.24: Use gdk_window_get_width() and gdk_window_get_height() for + * #GdkWindows. Use gdk_pixmap_get_size() for #GdkPixmaps. */ void gdk_drawable_get_size (GdkDrawable *drawable, diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c index 3e2f2b1c67..67ab96cd96 100644 --- a/gdk/gdkpixmap.c +++ b/gdk/gdkpixmap.c @@ -843,5 +843,27 @@ gdk_pixmap_real_get_screen (GdkDrawable *drawable) return gdk_drawable_get_screen (GDK_PIXMAP_OBJECT (drawable)->impl); } +/** + * gdk_pixmap_get_size: + * @pixmap: a #GdkPixmap + * @width: (out) (allow-none): location to store @pixmap's width, or %NULL + * @height: (out) (allow-none): location to store @pixmap's height, or %NULL + * + * This function is purely to make it possible to query the size of pixmaps + * even when compiling without deprecated symbols and you must use pixmaps. + * It is identical to gdk_drawable_get_size(), but for pixmaps. + * + * Since: 2.24 + **/ +void +gdk_pixmap_get_size (GdkPixmap *pixmap, + gint *width, + gint *height) +{ + g_return_if_fail (GDK_IS_PIXMAP (pixmap)); + + gdk_drawable_get_size (pixmap, width, height); +} + #define __GDK_PIXMAP_C__ #include "gdkaliasdef.c" diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h index 9d138ec701..576efc7205 100644 --- a/gdk/gdkpixmap.h +++ b/gdk/gdkpixmap.h @@ -103,6 +103,10 @@ GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d (GdkDrawable *drawable, gchar **data); #endif +void gdk_pixmap_get_size (GdkPixmap *pixmap, + gint *width, + gint *height); + /* Functions to create/lookup pixmaps from their native equivalents */ #ifndef GDK_MULTIHEAD_SAFE