[gtk+/gtk-2-24] Backport some new GdkWindow api from 2.90
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Backport some new GdkWindow api from 2.90
- Date: Tue, 28 Sep 2010 00:38:11 +0000 (UTC)
commit d1f256ac3067fedaad58a7b85f145c80d4a03536
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Sep 27 20:35:25 2010 -0400
Backport some new GdkWindow api from 2.90
This commit adds
gdk_window_get_display
gdk_window_get_screen
gdk_window_get_visual
gdk_window_get_width
gdk_window_get_height
and deprecates the corresponding GdkDrawable APIs.
This will make it easier to prepare the port to GTK+ 3
docs/reference/gdk/gdk-sections.txt | 5 ++
gdk/gdk.symbols | 13 +++-
gdk/gdkdraw.c | 19 ++++--
gdk/gdkdrawable.h | 11 ++--
gdk/gdkwindow.c | 104 +++++++++++++++++++++++++++++++++++
gdk/gdkwindow.h | 8 ++-
6 files changed, 144 insertions(+), 16 deletions(-)
---
diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt
index e7ea98d..b223b89 100644
--- a/docs/reference/gdk/gdk-sections.txt
+++ b/docs/reference/gdk/gdk-sections.txt
@@ -656,6 +656,11 @@ gdk_window_new
gdk_window_destroy
gdk_window_ref
gdk_window_unref
+gdk_window_get_display
+gdk_window_get_screen
+gdk_window_get_visual
+gdk_window_get_width
+gdk_window_get_height
gdk_window_get_window_type
gdk_window_at_pointer
gdk_window_show
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index b3a5fbb..a768500 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -564,15 +564,15 @@ gdk_drawable_unref
gdk_draw_string
gdk_draw_text
gdk_draw_text_wc
-#endif
-gdk_drawable_get_depth
gdk_drawable_get_display
-gdk_drawable_get_image
gdk_drawable_get_screen
gdk_drawable_get_size
+gdk_drawable_get_visual
+#endif
+gdk_drawable_get_depth
+gdk_drawable_get_image
gdk_drawable_get_type G_GNUC_CONST
gdk_drawable_get_visible_region
-gdk_drawable_get_visual
gdk_drawable_set_colormap
gdk_draw_arc
gdk_draw_drawable
@@ -756,6 +756,11 @@ gdk_pointer_grab
gdk_window_beep
gdk_window_geometry_changed
gdk_window_ensure_native
+gdk_window_get_screen
+gdk_window_get_display
+gdk_window_get_visual
+gdk_window_get_width
+gdk_window_get_height
#endif
#endif
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index b44b1f0..8ff3e1c 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -151,8 +151,9 @@ gdk_drawable_get_data (GdkDrawable *drawable,
* On the X11 platform, if @drawable is a #GdkWindow, the returned
* 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()
+ */
void
gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
@@ -170,7 +171,9 @@ gdk_drawable_get_size (GdkDrawable *drawable,
* Gets the #GdkVisual describing the pixel format of @drawable.
*
* Return value: a #GdkVisual
- **/
+ *
+ * Deprecated: 2.24: Use gdk_window_get_visual()
+ */
GdkVisual*
gdk_drawable_get_visual (GdkDrawable *drawable)
{
@@ -205,9 +208,11 @@ gdk_drawable_get_depth (GdkDrawable *drawable)
* Return value: the #GdkScreen associated with @drawable
*
* Since: 2.2
+ *
+ * Deprecated: 2.24: Use gdk_window_get_screen() instead
**/
GdkScreen*
-gdk_drawable_get_screen(GdkDrawable *drawable)
+gdk_drawable_get_screen (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
@@ -223,15 +228,17 @@ gdk_drawable_get_screen(GdkDrawable *drawable)
* Return value: the #GdkDisplay associated with @drawable
*
* Since: 2.2
+ *
+ * Deprecated: 2.24: Use gdk_window_get_display() instead
**/
GdkDisplay*
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));
}
-
+
/**
* gdk_drawable_set_colormap:
* @drawable: a #GdkDrawable
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index 9d0d329..bb92571 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -250,18 +250,19 @@ gpointer gdk_drawable_get_data (GdkDrawable *drawable,
const gchar *key);
#endif /* GDK_DISABLE_DEPRECATED */
-void gdk_drawable_get_size (GdkDrawable *drawable,
- gint *width,
- gint *height);
void gdk_drawable_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap);
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
-GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
gint gdk_drawable_get_depth (GdkDrawable *drawable);
+
+#ifndef GDK_DISABLE_DEPRECATED
+void gdk_drawable_get_size (GdkDrawable *drawable,
+ gint *width,
+ gint *height);
+GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
-#ifndef GDK_DISABLE_DEPRECATED
GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable);
void gdk_drawable_unref (GdkDrawable *drawable);
#endif /* GDK_DISABLE_DEPRECATED */
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 61b32db..5b00e4d 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -11215,6 +11215,110 @@ gdk_window_create_similar_surface (GdkWindow * window,
return surface;
}
+/**
+ * gdk_window_get_screen:
+ * @window: a #GdkWindow
+ *
+ * Gets the #GdkScreen associated with a #GdkWindow.
+ *
+ * Return value: the #GdkScreen associated with @window
+ */
+GdkScreen*
+gdk_window_get_screen (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ return gdk_drawable_get_screen (GDK_DRAWABLE (window));
+}
+
+/**
+ * gdk_window_get_display:
+ * @window: a #GdkWindow
+ *
+ * Gets the #GdkDisplay associated with a #GdkWindow.
+ *
+ * Return value: the #GdkDisplay associated with @window
+ *
+ * Since: 2.24
+ */
+GdkDisplay *
+gdk_window_get_display (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ return gdk_drawable_get_display (GDK_DRAWABLE (window));
+}
+
+/**
+ * gdk_window_get_visual:
+ * @window: a #GdkWindow
+ *
+ * Gets the #GdkVisual describing the pixel format of @window.
+ *
+ * Return value: a #GdkVisual
+ *
+ * Since: 2.24
+ */
+GdkVisual*
+gdk_window_get_visual (GdkWindow *window)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
+
+ return gdk_drawable_get_visual (GDK_DRAWABLE (window));
+}
+
+/**
+ * gdk_window_get_width:
+ * @window: a #GdkWindow
+ *
+ * Returns the width of the given @window.
+ *
+ * On the X11 platform the returned size is the size reported in the
+ * most-recently-processed configure event, rather than the current
+ * size on the X server.
+ *
+ * Returns: The width of @window
+ *
+ * Since: 2.24
+ */
+int
+gdk_window_get_width (GdkWindow *window)
+{
+ gint width, height;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+
+ return width;
+}
+
+/**
+ * gdk_window_get_height:
+ * @window: a #GdkWindow
+ *
+ * Returns the height of the given @window.
+ *
+ * On the X11 platform the returned size is the size reported in the
+ * most-recently-processed configure event, rather than the current
+ * size on the X server.
+ *
+ * Returns: The height of @window
+ *
+ * Since: 2.24
+ */
+int
+gdk_window_get_height (GdkWindow *window)
+{
+ gint width, height;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+
+ gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
+
+ return height;
+}
+
#define __GDK_WINDOW_C__
#include "gdkaliasdef.c"
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 422bf11..07834a1 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -335,6 +335,13 @@ GdkWindow* gdk_window_new (GdkWindow *parent,
void gdk_window_destroy (GdkWindow *window);
GdkWindowType gdk_window_get_window_type (GdkWindow *window);
gboolean gdk_window_is_destroyed (GdkWindow *window);
+
+GdkScreen* gdk_window_get_screen (GdkWindow *window);
+GdkDisplay* gdk_window_get_display (GdkWindow *window);
+GdkVisual* gdk_window_get_visual (GdkWindow *window);
+int gdk_window_get_width (GdkWindow *window);
+int gdk_window_get_height (GdkWindow *window);
+
GdkWindow* gdk_window_at_pointer (gint *win_x,
gint *win_y);
void gdk_window_show (GdkWindow *window);
@@ -720,7 +727,6 @@ void gdk_window_remove_redirection (GdkWindow *window);
#define gdk_window_get_type gdk_window_get_window_type
#define gdk_window_get_colormap gdk_drawable_get_colormap
#define gdk_window_set_colormap gdk_drawable_set_colormap
-#define gdk_window_get_visual gdk_drawable_get_visual
#define gdk_window_ref g_object_ref
#define gdk_window_unref g_object_unref
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]