mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-11 21:20:09 +00:00
New function to allow wrapping a native pixmap without a server roundtrip.
2006-03-29 Matthias Clasen <mclasen@redhat.com> * gdk/gdk.symbols: * gdk/gdkpixmap.h: * gdk/win32/gdkpixmap-win32.c: * gdk/x11/gdkpixmap-x11.c (gdk_pixmap_foreign_new_for_screen): New function to allow wrapping a native pixmap without a server roundtrip. (#334954, David Baron)
This commit is contained in:
parent
8910e9333d
commit
7e6f1345a9
@ -1,5 +1,12 @@
|
||||
2006-03-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk/gdk.symbols:
|
||||
* gdk/gdkpixmap.h:
|
||||
* gdk/win32/gdkpixmap-win32.c:
|
||||
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_foreign_new_for_screen):
|
||||
New function to allow wrapping a native pixmap without
|
||||
a server roundtrip. (#334954, David Baron)
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
* gtk/gtkrecent*.c: Fix some symbol aliasing glitches.
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
2006-03-29 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gdk/gdk.symbols:
|
||||
* gdk/gdkpixmap.h:
|
||||
* gdk/win32/gdkpixmap-win32.c:
|
||||
* gdk/x11/gdkpixmap-x11.c (gdk_pixmap_foreign_new_for_screen):
|
||||
New function to allow wrapping a native pixmap without
|
||||
a server roundtrip. (#334954, David Baron)
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
* gtk/gtkrecent*.c: Fix some symbol aliasing glitches.
|
||||
|
||||
|
@ -1254,6 +1254,7 @@ gdkx_visual_get
|
||||
gdkx_colormap_get
|
||||
gdk_pixmap_foreign_new
|
||||
gdk_pixmap_foreign_new_for_display
|
||||
gdk_pixmap_foreign_new_for_screen
|
||||
gdk_window_foreign_new
|
||||
gdk_window_foreign_new_for_display
|
||||
gdk_xid_table_lookup
|
||||
|
@ -917,6 +917,7 @@ gdk_pixmap_get_type G_GNUC_CONST
|
||||
gdk_pixmap_create_from_data
|
||||
gdk_pixmap_foreign_new
|
||||
gdk_pixmap_foreign_new_for_display
|
||||
gdk_pixmap_foreign_new_for_screen
|
||||
gdk_pixmap_lookup
|
||||
gdk_pixmap_lookup_for_display
|
||||
gdk_pixmap_new
|
||||
|
@ -108,6 +108,11 @@ GdkPixmap* gdk_pixmap_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_foreign_new_for_screen (GdkScreen *screen,
|
||||
GdkNativeWindow anid,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth);
|
||||
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
#define gdk_bitmap_ref gdk_drawable_ref
|
||||
|
@ -446,6 +446,18 @@ gdk_pixmap_foreign_new_for_display (GdkDisplay *display,
|
||||
return gdk_pixmap_foreign_new (anid);
|
||||
}
|
||||
|
||||
GdkPixmap *
|
||||
gdk_pixmap_foreign_new_for_screen (GdkScreen *screen,
|
||||
GdkNativeWindow anid,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return gdk_pixmap_foreign_new (anid);
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_foreign_new (GdkNativeWindow anid)
|
||||
{
|
||||
|
@ -344,11 +344,9 @@ GdkPixmap *
|
||||
gdk_pixmap_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid)
|
||||
{
|
||||
GdkPixmap *pixmap;
|
||||
GdkDrawableImplX11 *draw_impl;
|
||||
GdkPixmapImplX11 *pix_impl;
|
||||
Pixmap xpixmap;
|
||||
Window root_return;
|
||||
GdkScreen *screen;
|
||||
int x_ret, y_ret;
|
||||
unsigned int w_ret, h_ret, bw_ret, depth_ret;
|
||||
|
||||
@ -367,19 +365,66 @@ gdk_pixmap_foreign_new_for_display (GdkDisplay *display,
|
||||
xpixmap, &root_return,
|
||||
&x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
|
||||
return NULL;
|
||||
|
||||
screen = _gdk_x11_display_screen_for_xrootwin (display, root_return);
|
||||
return gdk_pixmap_foreign_new_for_screen (screen, anid, w_ret, h_ret, depth_ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixmap_foreign_new_for_screen:
|
||||
* @screen: a #GdkScreen
|
||||
* @anid: a native pixmap handle
|
||||
* @width: the width of the pixmap identified by @anid
|
||||
* @height: the height of the pixmap identified by @anid
|
||||
* @depth: the depth of the pixmap identified by @anid
|
||||
*
|
||||
* Wraps a native pixmap in a #GdkPixmap.
|
||||
* This may fail if the pixmap has been destroyed.
|
||||
*
|
||||
* For example in the X backend, a native pixmap handle is an Xlib
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* This function is an alternative to gdk_pixmap_foreign_new_for_display()
|
||||
* for cases where the dimensions of the pixmap are known. For the X
|
||||
* backend, this avoids a roundtrip to the server.
|
||||
*
|
||||
* Return value: the newly-created #GdkPixmap wrapper for the
|
||||
* native pixmap or %NULL if the pixmap has been destroyed.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
GdkPixmap *
|
||||
gdk_pixmap_foreign_new_for_screen (GdkScreen *screen,
|
||||
GdkNativeWindow anid,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth)
|
||||
{
|
||||
Pixmap xpixmap;
|
||||
GdkPixmap *pixmap;
|
||||
GdkDrawableImplX11 *draw_impl;
|
||||
GdkPixmapImplX11 *pix_impl;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
g_return_val_if_fail (anid != 0, NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail (depth > 0, NULL);
|
||||
|
||||
pixmap = g_object_new (gdk_pixmap_get_type (), NULL);
|
||||
draw_impl = GDK_DRAWABLE_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
|
||||
pix_impl = GDK_PIXMAP_IMPL_X11 (GDK_PIXMAP_OBJECT (pixmap)->impl);
|
||||
draw_impl->wrapper = GDK_DRAWABLE (pixmap);
|
||||
|
||||
draw_impl->screen = _gdk_x11_display_screen_for_xrootwin (display, root_return);
|
||||
xpixmap = anid;
|
||||
|
||||
draw_impl->screen = screen;
|
||||
draw_impl->xid = xpixmap;
|
||||
|
||||
pix_impl->is_foreign = TRUE;
|
||||
pix_impl->width = w_ret;
|
||||
pix_impl->height = h_ret;
|
||||
GDK_PIXMAP_OBJECT (pixmap)->depth = depth_ret;
|
||||
pix_impl->width = width;
|
||||
pix_impl->height = height;
|
||||
GDK_PIXMAP_OBJECT (pixmap)->depth = depth;
|
||||
|
||||
_gdk_xid_table_insert (display, &GDK_PIXMAP_XID (pixmap), pixmap);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user