[gtk+/gtk-2-24] API: Add gdk_pixmap_get_size()



commit 176218c5a000fa4a5caa934893954c31c5e9a676
Author: Benjamin Otte <otte redhat com>
Date:   Thu Nov 18 17:28:19 2010 +0100

    API: Add gdk_pixmap_get_size()
    
    Allows querying a pixmap's size when compiling with deprecations.

 docs/reference/gdk/gdk-sections.txt |    1 +
 gdk/gdk.symbols                     |    1 +
 gdk/gdkdraw.c                       |    3 ++-
 gdk/gdkpixmap.c                     |   22 ++++++++++++++++++++++
 gdk/gdkpixmap.h                     |    4 ++++
 5 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt
index b223b89..c8608be 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 a768500..bf05ba2 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 8ff3e1c..932de97 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 3e2f2b1..67ab96c 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 9d138ec..576efc7 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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]