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
This commit is contained in:
Matthias Clasen 2010-09-27 20:35:25 -04:00
parent 2e5251b405
commit d1f256ac30
6 changed files with 144 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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"

View File

@ -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