diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index 46d94fc8f6..0ff8a79569 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -240,28 +240,6 @@ GdkScreenClass gdk_screen_get_type -
-Bitmaps and Pixmaps -pixmaps -GdkPixmap -gdk_pixmap_new -GdkBitmap - - -GDK_PIXMAP -GDK_PIXMAP_GET_CLASS -GDK_PIXMAP_OBJECT -GDK_TYPE_PIXMAP -GDK_IS_PIXMAP -GDK_PIXMAP_CLASS -GDK_IS_PIXMAP_CLASS - - -gdk_pixmap_get_type -GdkPixmapObject -GdkPixmapObjectClass -
-
Pixbufs pixbufs @@ -1014,17 +992,12 @@ GDK_CURSOR_XCURSOR GDK_CURSOR_XDISPLAY GDK_WINDOW_XWINDOW gdkx_visual_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 gdk_xid_table_lookup_for_display gdk_window_lookup gdk_window_lookup_for_display -gdk_pixmap_lookup -gdk_pixmap_lookup_for_display gdk_x11_lookup_xdisplay gdk_x11_get_server_time gdk_net_wm_supports @@ -1072,7 +1045,6 @@ gdk_x11_get_xatom_name_for_display GDK_HAVE_WCHAR_H GDK_HAVE_WCTYPE_H -gdk_x11_pixmap_get_drawable_impl gdk_x11_window_get_drawable_impl
diff --git a/examples/pixmap/pixmap.c b/examples/pixmap/pixmap.c deleted file mode 100644 index 7bb3850219..0000000000 --- a/examples/pixmap/pixmap.c +++ /dev/null @@ -1,89 +0,0 @@ - -#include "config.h" -#include - - -/* XPM data of Open-File icon */ -static const char * xpm_data[] = { -"16 16 3 1", -" c None", -". c #000000000000", -"X c #FFFFFFFFFFFF", -" ", -" ...... ", -" .XXX.X. ", -" .XXX.XX. ", -" .XXX.XXX. ", -" .XXX..... ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" .XXXXXXX. ", -" ......... ", -" ", -" "}; - - -/* when invoked (via signal delete_event), terminates the application. - */ -gint close_application( GtkWidget *widget, - GdkEvent *event, - gpointer data ) -{ - gtk_main_quit (); - return FALSE; -} - - -/* is invoked when the button is clicked. It just prints a message. - */ -void button_clicked( GtkWidget *widget, - gpointer data ) { - g_print ("button clicked\n"); -} - -int main( int argc, - char *argv[] ) -{ - /* GtkWidget is the storage type for widgets */ - GtkWidget *window, *pixmapwid, *button; - GdkPixmap *pixmap; - GdkBitmap *mask; - GtkStyle *style; - - /* create the main window, and attach delete_event signal to terminating - the application */ - gtk_init (&argc, &argv); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - g_signal_connect (window, "delete-event", - G_CALLBACK (close_application), NULL); - gtk_container_set_border_width (GTK_CONTAINER (window), 10); - gtk_widget_show (window); - - /* now for the pixmap from gdk */ - style = gtk_widget_get_style (window); - pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask, - &style->bg[GTK_STATE_NORMAL], - (gchar **)xpm_data); - - /* a pixmap widget to contain the pixmap */ - pixmapwid = gtk_image_new_from_pixmap (pixmap, mask); - gtk_widget_show (pixmapwid); - - /* a button to contain the pixmap widget */ - button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), pixmapwid); - gtk_container_add (GTK_CONTAINER (window), button); - gtk_widget_show (button); - - g_signal_connect (button, "clicked", - G_CALLBACK (button_clicked), NULL); - - /* show the window */ - gtk_main (); - - return 0; -} diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 136603ada0..175084b52b 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -87,7 +87,6 @@ gdk_public_h_sources = \ gdkkeysyms-compat.h \ gdkpango.h \ gdkpixbuf.h \ - gdkpixmap.h \ gdkprivate.h \ gdkproperty.h \ gdkscreen.h \ @@ -127,7 +126,6 @@ gdk_c_sources = \ gdkoffscreenwindow.c \ gdkpango.c \ gdkpixbuf-drawable.c \ - gdkpixmap.c \ gdkrectangle.c \ gdkscreen.c \ gdkselection.c \ @@ -209,7 +207,6 @@ x11_introspection_files = \ x11/gdkinput.c \ x11/gdkkeys-x11.c \ x11/gdkmain-x11.c \ - x11/gdkpixmap-x11.c \ x11/gdkproperty-x11.c \ x11/gdkscreen-x11.c \ x11/gdkselection-x11.c \ diff --git a/gdk/gdk.h b/gdk/gdk.h index ea7926a86d..6f6a0735da 100644 --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols index 146ec0502e..aff488af2a 100644 --- a/gdk/gdk.symbols +++ b/gdk/gdk.symbols @@ -545,14 +545,6 @@ gdk_drawable_set_colormap #endif #endif -#if IN_HEADER(__GDK_PIXMAP_X11_H__) -#if IN_FILE(__GDK_PIXMAP_X11_C__) -#ifdef GDK_WINDOWING_X11 -gdk_pixmap_impl_x11_get_type G_GNUC_CONST -#endif -#endif -#endif - #if IN_HEADER(__GDK_WINDOW_X11_H__) #if IN_FILE(__GDK_WINDOW_X11_C__) #ifdef GDK_WINDOWING_X11 @@ -815,23 +807,6 @@ gdk_pixbuf_get_from_surface #endif #endif -#if IN_HEADER(__GDK_PIXMAP_H__) -#if IN_FILE(__GDK_PIXMAP_C__) -gdk_pixmap_get_type G_GNUC_CONST -gdk_pixmap_new -#endif -#endif - -#if IN_HEADER(__GDK_PIXMAP_H__) -#if IN_FILE(__GDK_PIXMAP_X11_C__) -gdk_pixmap_foreign_new -gdk_pixmap_foreign_new_for_display -gdk_pixmap_foreign_new_for_screen -gdk_pixmap_lookup -gdk_pixmap_lookup_for_display -#endif -#endif - #if IN_HEADER(__GDK_SCREEN_H__) #if IN_FILE(__GDK_SCREEN_C__) gdk_screen_get_type G_GNUC_CONST @@ -1023,7 +998,6 @@ gdk_x11_display_error_trap_pop_ignored gdk_x11_drawable_get_xdisplay gdk_x11_drawable_get_xid gdk_x11_window_get_drawable_impl -gdk_x11_pixmap_get_drawable_impl #endif #if IN_FILE(__GDK_MAIN_X11_C__) diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h index d2fce09cf1..1ca695d787 100644 --- a/gdk/gdkinternals.h +++ b/gdk/gdkinternals.h @@ -323,11 +323,6 @@ cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable, * Interfaces used by windowing code * *************************************/ -GdkPixmap *_gdk_pixmap_new (GdkDrawable *drawable, - gint width, - gint height, - gint depth); - void _gdk_window_impl_new (GdkWindow *window, GdkWindow *real_parent, GdkScreen *screen, @@ -448,7 +443,6 @@ GType _gdk_paintable_get_type (void) G_GNUC_CONST; /* Implementation types */ GType _gdk_window_impl_get_type (void) G_GNUC_CONST; -GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST; struct GdkAppLaunchContextPrivate { diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c index be99f42adf..6cc35fc969 100644 --- a/gdk/gdkpixbuf-drawable.c +++ b/gdk/gdkpixbuf-drawable.c @@ -28,7 +28,6 @@ #include "gdkcolor.h" #include "gdkwindow.h" #include "gdkpixbuf.h" -#include "gdkpixmap.h" #include "gdkinternals.h" @@ -53,14 +52,8 @@ * * If the drawable @src has no colormap (gdk_drawable_get_colormap() * returns %NULL), then a suitable colormap must be specified. - * Typically a #GdkWindow or a pixmap created by passing a #GdkWindow - * to gdk_pixmap_new() will already have a colormap associated with - * it. If the drawable has a colormap, the @cmap argument will be - * ignored. If the drawable is a bitmap (1 bit per pixel pixmap), - * then a colormap is not required; pixels with a value of 1 are - * assumed to be white, and pixels with a value of 0 are assumed to be - * black. For taking screenshots, gdk_colormap_get_system() returns - * the correct colormap to use. + * If the drawable has a colormap, the @cmap argument will be + * ignored. * * If the specified destination pixbuf @dest is %NULL, then this * function will create an RGB pixbuf with 8 bits per channel and no @@ -70,12 +63,6 @@ * and it contains alpha information, then the filled pixels will be * set to full opacity (alpha = 255). * - * If the specified drawable is a pixmap, then the requested source - * rectangle must be completely contained within the pixmap, otherwise - * the function will return %NULL. For pixmaps only (not for windows) - * passing -1 for width or height is allowed to mean the full width - * or height of the pixmap. - * * If the specified drawable is a window, and the window is off the * screen, then there is no image data in the obscured/offscreen * regions to be placed in the pixbuf. The contents of portions of the @@ -106,7 +93,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, int dest_x, int dest_y, int width, int height) { - int src_width, src_height; cairo_surface_t *surface; int depth; @@ -155,18 +141,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest, /* Coordinate sanity checks */ - if (GDK_IS_PIXMAP (src)) - { - gdk_drawable_get_size (src, &src_width, &src_height); - if (width < 0) - width = src_width; - if (height < 0) - height = src_height; - - g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL); - g_return_val_if_fail (src_x + width <= src_width && src_y + height <= src_height, NULL); - } - surface = _gdk_drawable_ref_cairo_surface (src); dest = gdk_pixbuf_get_from_surface (dest, surface, diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c deleted file mode 100644 index 2c42162e5f..0000000000 --- a/gdk/gdkpixmap.c +++ /dev/null @@ -1,196 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "config.h" -#include "gdkpixmap.h" -#include "gdkinternals.h" -#include "gdkpixbuf.h" -#include "gdkscreen.h" - - -static void gdk_pixmap_real_get_size (GdkDrawable *drawable, - gint *width, - gint *height); - -static cairo_surface_t *gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable); -static cairo_surface_t *gdk_pixmap_create_cairo_surface (GdkDrawable *drawable, - int width, - int height); - -static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable); -static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable); -static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable, - GdkColormap *cmap); -static GdkColormap* gdk_pixmap_real_get_colormap (GdkDrawable *drawable); -static GdkScreen* gdk_pixmap_real_get_screen (GdkDrawable *drawable); - -static void gdk_pixmap_init (GdkPixmapObject *pixmap); -static void gdk_pixmap_class_init (GdkPixmapObjectClass *klass); -static void gdk_pixmap_finalize (GObject *object); - -static gpointer parent_class = NULL; - -GType -gdk_pixmap_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - object_type = g_type_register_static_simple (GDK_TYPE_DRAWABLE, - "GdkPixmap", - sizeof (GdkPixmapObjectClass), - (GClassInitFunc) gdk_pixmap_class_init, - sizeof (GdkPixmapObject), - (GInstanceInitFunc) gdk_pixmap_init, - 0); - - return object_type; -} - -static void -gdk_pixmap_init (GdkPixmapObject *pixmap) -{ - /* 0-initialization is good for all other fields. */ - pixmap->impl = g_object_new (_gdk_pixmap_impl_get_type (), NULL); -} - -static void -gdk_pixmap_class_init (GdkPixmapObjectClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = gdk_pixmap_finalize; - - drawable_class->get_depth = gdk_pixmap_real_get_depth; - drawable_class->get_screen = gdk_pixmap_real_get_screen; - drawable_class->get_size = gdk_pixmap_real_get_size; - drawable_class->set_colormap = gdk_pixmap_real_set_colormap; - drawable_class->get_colormap = gdk_pixmap_real_get_colormap; - drawable_class->get_visual = gdk_pixmap_real_get_visual; - drawable_class->ref_cairo_surface = gdk_pixmap_ref_cairo_surface; - drawable_class->create_cairo_surface = gdk_pixmap_create_cairo_surface; -} - -static void -gdk_pixmap_finalize (GObject *object) -{ - GdkPixmapObject *obj = (GdkPixmapObject *) object; - - g_object_unref (obj->impl); - obj->impl = NULL; - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -GdkPixmap * -gdk_pixmap_new (GdkDrawable *drawable, - gint width, - gint height, - gint depth) -{ - GdkDrawable *source_drawable; - - if (drawable) - source_drawable = _gdk_drawable_get_source_drawable (drawable); - else - source_drawable = NULL; - return _gdk_pixmap_new (source_drawable, width, height, depth); -} - -static void -gdk_pixmap_real_get_size (GdkDrawable *drawable, - gint *width, - gint *height) -{ - g_return_if_fail (GDK_IS_PIXMAP (drawable)); - - gdk_drawable_get_size (GDK_DRAWABLE (((GdkPixmapObject*)drawable)->impl), - width, height); -} - -static GdkVisual* -gdk_pixmap_real_get_visual (GdkDrawable *drawable) -{ - GdkColormap *colormap; - - g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL); - - colormap = gdk_drawable_get_colormap (drawable); - return colormap ? gdk_colormap_get_visual (colormap) : NULL; -} - -static gint -gdk_pixmap_real_get_depth (GdkDrawable *drawable) -{ - gint depth; - - g_return_val_if_fail (GDK_IS_PIXMAP (drawable), 0); - - depth = GDK_PIXMAP_OBJECT (drawable)->depth; - - return depth; -} - -static void -gdk_pixmap_real_set_colormap (GdkDrawable *drawable, - GdkColormap *cmap) -{ - g_return_if_fail (GDK_IS_PIXMAP (drawable)); - - gdk_drawable_set_colormap (((GdkPixmapObject*)drawable)->impl, cmap); -} - -static GdkColormap* -gdk_pixmap_real_get_colormap (GdkDrawable *drawable) -{ - g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL); - - return gdk_drawable_get_colormap (((GdkPixmapObject*)drawable)->impl); -} - -static cairo_surface_t * -gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable) -{ - return _gdk_drawable_ref_cairo_surface (((GdkPixmapObject*)drawable)->impl); -} - -static cairo_surface_t * -gdk_pixmap_create_cairo_surface (GdkDrawable *drawable, - int width, - int height) -{ - return _gdk_drawable_create_cairo_surface (GDK_PIXMAP_OBJECT(drawable)->impl, - width, height); -} - -static GdkScreen* -gdk_pixmap_real_get_screen (GdkDrawable *drawable) -{ - return gdk_drawable_get_screen (GDK_PIXMAP_OBJECT (drawable)->impl); -} diff --git a/gdk/gdkpixmap.h b/gdk/gdkpixmap.h deleted file mode 100644 index ce22802090..0000000000 --- a/gdk/gdkpixmap.h +++ /dev/null @@ -1,94 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __GDK_PIXMAP_H__ -#define __GDK_PIXMAP_H__ - -#include -#include - -G_BEGIN_DECLS - -typedef struct _GdkPixmapObject GdkPixmapObject; -typedef struct _GdkPixmapObjectClass GdkPixmapObjectClass; - -#define GDK_TYPE_PIXMAP (gdk_pixmap_get_type ()) -#define GDK_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP, GdkPixmap)) -#define GDK_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP, GdkPixmapObjectClass)) -#define GDK_IS_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP)) -#define GDK_IS_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP)) -#define GDK_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP, GdkPixmapObjectClass)) -#define GDK_PIXMAP_OBJECT(object) ((GdkPixmapObject *) GDK_PIXMAP (object)) - -struct _GdkPixmapObject -{ - GdkDrawable parent_instance; - - GdkDrawable *GSEAL (impl); /* window-system-specific delegate object */ - - gint GSEAL (depth); -}; - -struct _GdkPixmapObjectClass -{ - GdkDrawableClass parent_class; - -}; - -GType gdk_pixmap_get_type (void) G_GNUC_CONST; - -/* Pixmaps - */ -GdkPixmap* gdk_pixmap_new (GdkDrawable *drawable, - gint width, - gint height, - gint depth); - -/* Functions to create/lookup pixmaps from their native equivalents - */ -#ifndef GDK_MULTIHEAD_SAFE -GdkPixmap* gdk_pixmap_foreign_new (GdkNativeWindow anid); -GdkPixmap* gdk_pixmap_lookup (GdkNativeWindow anid); -#endif /* GDK_MULTIHEAD_SAFE */ - -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); - - -G_END_DECLS - -#endif /* __GDK_PIXMAP_H__ */ diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h index ab52197d8d..e36d01c751 100644 --- a/gdk/gdktypes.h +++ b/gdk/gdktypes.h @@ -51,8 +51,8 @@ /** * GDK_PARENT_RELATIVE: * - * A special value for #GdkPixmap variables, indicating that the background - * pixmap for a window should be inherited from the parent window. + * A special value, indicating that the background + * for a window should be inherited from the parent window. */ #define GDK_PARENT_RELATIVE 1L @@ -95,16 +95,11 @@ typedef struct _GdkCursor GdkCursor; typedef struct _GdkVisual GdkVisual; typedef struct _GdkDrawable GdkDrawable; -typedef struct _GdkDrawable GdkBitmap; -typedef struct _GdkDrawable GdkPixmap; /** * GdkWindow: * - * An opaque structure representing an onscreen drawable. Pointers to structures - * of type #GdkPixmap, #GdkBitmap, and #GdkWindow can often be used - * interchangeably. The type #GdkDrawable refers generically to any of these - * types. + * An opaque structure representing an onscreen drawable. */ typedef struct _GdkDrawable GdkWindow; typedef struct _GdkDisplay GdkDisplay; diff --git a/gdk/makefile.msc b/gdk/makefile.msc index 717e2b9787..648427c822 100644 --- a/gdk/makefile.msc +++ b/gdk/makefile.msc @@ -84,7 +84,6 @@ gdk_OBJECTS = \ gdkpango.obj \ gdkpixbuf-drawable.obj \ gdkpixbuf-render.obj \ - gdkpixmap.obj \ gdkrectangle.obj \ gdkscreen.obj \ gdkselection.obj \ @@ -104,7 +103,6 @@ gdk_public_h_sources = \ gdkkeys.h \ gdkpango.h \ gdkpixbuf.h \ - gdkpixmap.h \ gdkproperty.h \ gdkselection.h \ gdktypes.h \ diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am index 683ea3e9ae..2bb63b9515 100644 --- a/gdk/quartz/Makefile.am +++ b/gdk/quartz/Makefile.am @@ -39,8 +39,6 @@ libgdk_quartz_la_SOURCES = \ gdkinputprivate.h \ gdkkeys-quartz.c \ gdkmain-quartz.c \ - gdkpixmap-quartz.c \ - gdkpixmap-quartz.h \ gdkprivate-quartz.h \ gdkproperty-quartz.c \ gdkquartz.h \ diff --git a/gdk/quartz/gdkpixmap-quartz.c b/gdk/quartz/gdkpixmap-quartz.c deleted file mode 100644 index 64d6f35587..0000000000 --- a/gdk/quartz/gdkpixmap-quartz.c +++ /dev/null @@ -1,260 +0,0 @@ -/* gdkpixmap-quartz.c - * - * Copyright (C) 2005 Imendio AB - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include "gdkpixmap.h" -#include "gdkprivate-quartz.h" - -static gpointer parent_class; - -static void -gdk_pixmap_impl_quartz_init (GdkPixmapImplQuartz *impl) -{ -} - -static void -gdk_pixmap_impl_quartz_get_size (GdkDrawable *drawable, - gint *width, - gint *height) -{ - if (width) - *width = GDK_PIXMAP_IMPL_QUARTZ (drawable)->width; - if (height) - *height = GDK_PIXMAP_IMPL_QUARTZ (drawable)->height; -} - -static CGContextRef -gdk_pixmap_impl_quartz_get_context (GdkDrawable *drawable, - gboolean antialias) -{ - GdkPixmapImplQuartz *impl = GDK_PIXMAP_IMPL_QUARTZ (drawable); - CGContextRef cg_context; - size_t height; - - cg_context = CGBitmapContextCreate (impl->data, - CGImageGetWidth (impl->image), - CGImageGetHeight (impl->image), - CGImageGetBitsPerComponent (impl->image), - CGImageGetBytesPerRow (impl->image), - CGImageGetColorSpace (impl->image), - CGImageGetBitmapInfo (impl->image)); - CGContextSetAllowsAntialiasing (cg_context, antialias); - - /* convert coordinates from core graphics to gtk+ */ - height = CGImageGetHeight (impl->image); - - CGContextTranslateCTM (cg_context, 0, height); - CGContextScaleCTM (cg_context, 1.0, -1.0); - - return cg_context; -} - -static void -gdk_pixmap_impl_quartz_finalize (GObject *object) -{ - GdkPixmapImplQuartz *impl = GDK_PIXMAP_IMPL_QUARTZ (object); - - CGImageRelease (impl->image); - - _gdk_quartz_drawable_finish (GDK_DRAWABLE (impl)); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gdk_pixmap_impl_quartz_class_init (GdkPixmapImplQuartzClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); - GdkDrawableImplQuartzClass *drawable_quartz_class = GDK_DRAWABLE_IMPL_QUARTZ_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = gdk_pixmap_impl_quartz_finalize; - - drawable_class->get_size = gdk_pixmap_impl_quartz_get_size; - - drawable_quartz_class->get_context = gdk_pixmap_impl_quartz_get_context; -} - -GType -_gdk_pixmap_impl_quartz_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - const GTypeInfo object_info = - { - sizeof (GdkPixmapImplQuartzClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gdk_pixmap_impl_quartz_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkPixmapImplQuartz), - 0, /* n_preallocs */ - (GInstanceInitFunc) gdk_pixmap_impl_quartz_init - }; - - object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_QUARTZ, - "GdkPixmapImplQuartz", - &object_info, - 0); - } - - return object_type; -} - -GType -_gdk_pixmap_impl_get_type (void) -{ - return _gdk_pixmap_impl_quartz_get_type (); -} - -static void -data_provider_release (void *info, const void *data, size_t size) -{ - g_free (info); -} - -GdkPixmap* -_gdk_pixmap_new (GdkDrawable *drawable, - gint width, - gint height, - gint depth) -{ - GdkPixmap *pixmap; - GdkDrawableImplQuartz *draw_impl; - GdkPixmapImplQuartz *pix_impl; - gint window_depth; - CGColorSpaceRef colorspace; - CGDataProviderRef data_provider; - CGImageAlphaInfo alpha_info; - gint bytes_per_row, bits_per_pixel; - - g_return_val_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable), NULL); - g_return_val_if_fail ((drawable != NULL) || (depth != -1), NULL); - g_return_val_if_fail ((width != 0) && (height != 0), NULL); - - if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable)) - return NULL; - - if (!drawable) - drawable = gdk_screen_get_root_window (gdk_screen_get_default ()); - - window_depth = gdk_drawable_get_depth (GDK_DRAWABLE (drawable)); - - if (depth == -1) - depth = window_depth; - - switch (depth) - { - case 24: - alpha_info = kCGImageAlphaNoneSkipLast; - bytes_per_row = width * 4; - bits_per_pixel = 32; - colorspace = CGColorSpaceCreateDeviceRGB (); - break; - case 32: - alpha_info = kCGImageAlphaPremultipliedFirst; - bytes_per_row = width * 4; - bits_per_pixel = 32; - colorspace = CGColorSpaceCreateDeviceRGB (); - break; - case 1: - alpha_info = kCGImageAlphaNone; - bytes_per_row = width; - bits_per_pixel = 8; - colorspace = CGColorSpaceCreateDeviceGray (); - break; - default: - g_warning ("Unsupported bit depth %d\n", depth); - return NULL; - } - - pixmap = g_object_new (gdk_pixmap_get_type (), NULL); - draw_impl = GDK_DRAWABLE_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (pixmap)->impl); - pix_impl = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (pixmap)->impl); - draw_impl->wrapper = GDK_DRAWABLE (pixmap); - - g_assert (depth == 24 || depth == 32 || depth == 1); - - pix_impl->data = g_malloc (height * bytes_per_row); - data_provider = CGDataProviderCreateWithData (pix_impl->data, pix_impl->data, - height * bytes_per_row, data_provider_release); - pix_impl->image = CGImageCreate (width, height, 8, bits_per_pixel, - bytes_per_row, colorspace, - alpha_info, - data_provider, NULL, FALSE, - kCGRenderingIntentDefault); - CGDataProviderRelease (data_provider); - CGColorSpaceRelease (colorspace); - - pix_impl->width = width; - pix_impl->height = height; - GDK_PIXMAP_OBJECT (pixmap)->depth = depth; - - if (depth == window_depth) { - GdkColormap *colormap = gdk_drawable_get_colormap (drawable); - - if (colormap) - gdk_drawable_set_colormap (pixmap, colormap); - } - - return pixmap; -} - -GdkPixmap * -gdk_pixmap_foreign_new_for_display (GdkDisplay *display, - GdkNativeWindow anid) -{ - return NULL; -} - -GdkPixmap* -gdk_pixmap_foreign_new (GdkNativeWindow anid) -{ - return NULL; -} - -GdkPixmap * -gdk_pixmap_foreign_new_for_screen (GdkScreen *screen, - GdkNativeWindow anid, - gint width, - gint height, - gint depth) -{ - return NULL; -} - -GdkPixmap* -gdk_pixmap_lookup (GdkNativeWindow anid) -{ - return NULL; -} - -GdkPixmap* -gdk_pixmap_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return NULL; -} diff --git a/gdk/quartz/gdkpixmap-quartz.h b/gdk/quartz/gdkpixmap-quartz.h deleted file mode 100644 index bb2122ad40..0000000000 --- a/gdk/quartz/gdkpixmap-quartz.h +++ /dev/null @@ -1,64 +0,0 @@ -/* gdkdrawable-quartz.h - * - * Copyright (C) 2005 Imendio AB - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __GDK_PIXMAP_QUARTZ_H__ -#define __GDK_PIXMAP_QUARTZ_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -/* Pixmap implementation for Quartz - */ - -typedef struct _GdkPixmapImplQuartz GdkPixmapImplQuartz; -typedef struct _GdkPixmapImplQuartzClass GdkPixmapImplQuartzClass; - -#define GDK_TYPE_PIXMAP_IMPL_QUARTZ (_gdk_pixmap_impl_quartz_get_type ()) -#define GDK_PIXMAP_IMPL_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP_IMPL_QUARTZ, GdkPixmapImplQuartz)) -#define GDK_PIXMAP_IMPL_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP_IMPL_QUARTZ, GdkPixmapImplQuartzClass)) -#define GDK_IS_PIXMAP_IMPL_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP_IMPL_QUARTZ)) -#define GDK_IS_PIXMAP_IMPL_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP_IMPL_QUARTZ)) -#define GDK_PIXMAP_IMPL_QUARTZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP_IMPL_QUARTZ, GdkPixmapImplQuartzClass)) - -struct _GdkPixmapImplQuartz -{ - GdkDrawableImplQuartz parent_instance; - - gint width; - gint height; - - void *data; - - CGImageRef image; -}; - -struct _GdkPixmapImplQuartzClass -{ - GdkDrawableImplQuartzClass parent_class; -}; - -GType _gdk_pixmap_impl_quartz_get_type (void); - -G_END_DECLS - -#endif /* __GDK_PIXMAP_QUARTZ_H__ */ diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index 6c4d79323e..9dc090e60b 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -25,7 +25,6 @@ #define GDK_QUARTZ_RELEASE_POOL [pool release] #include -#include #include #include diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am index 889791a725..a1cf0fd357 100644 --- a/gdk/win32/Makefile.am +++ b/gdk/win32/Makefile.am @@ -46,8 +46,6 @@ libgdk_win32_la_SOURCES = \ gdkinput.c \ gdkkeys-win32.c \ gdkmain-win32.c \ - gdkpixmap-win32.c \ - gdkpixmap-win32.h \ gdkprivate-win32.h \ gdkproperty-win32.c \ gdkscreen-win32.c \ diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c index 13fca73c8c..e594b88f7b 100644 --- a/gdk/win32/gdkdrawable-win32.c +++ b/gdk/win32/gdkdrawable-win32.c @@ -310,9 +310,8 @@ gdk_win32_drawable_get_handle (GdkDrawable *drawable) * @drawable: a Win32 #GdkDrawable implementation * * Releases any resources allocated internally for the drawable. - * This is called when the drawable becomes unusable - * (gdk_window_destroy() for a window, or the refcount going to - * zero for a pixmap.) + * This is called when the drawable becomes unusable, i.e. + * gdk_window_destroy() is called. **/ void _gdk_win32_drawable_finish (GdkDrawable *drawable) diff --git a/gdk/win32/gdkim-win32.c b/gdk/win32/gdkim-win32.c index 128d7b8e43..dd7cf87944 100644 --- a/gdk/win32/gdkim-win32.c +++ b/gdk/win32/gdkim-win32.c @@ -31,7 +31,6 @@ #include #include -#include "gdkpixmap.h" #include "gdkinternals.h" #include "gdkwin32.h" diff --git a/gdk/win32/gdkpixmap-win32.c b/gdk/win32/gdkpixmap-win32.c deleted file mode 100644 index f711ef766f..0000000000 --- a/gdk/win32/gdkpixmap-win32.c +++ /dev/null @@ -1,417 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * Copyright (C) 1998-2002 Tor Lillqvist - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "config.h" -#include -#include -#include - -#include "gdkpixmap.h" -#include "gdkdisplay.h" -#include "gdkscreen.h" - -#include "gdkprivate-win32.h" - -static void gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable, - gint *width, - gint *height); - -static void gdk_pixmap_impl_win32_init (GdkPixmapImplWin32 *pixmap); -static void gdk_pixmap_impl_win32_class_init (GdkPixmapImplWin32Class *klass); -static void gdk_pixmap_impl_win32_finalize (GObject *object); - -static gpointer parent_class = NULL; - -GType -_gdk_pixmap_impl_win32_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - const GTypeInfo object_info = - { - sizeof (GdkPixmapImplWin32Class), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gdk_pixmap_impl_win32_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkPixmapImplWin32), - 0, /* n_preallocs */ - (GInstanceInitFunc) gdk_pixmap_impl_win32_init, - }; - - object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_WIN32, - "GdkPixmapImplWin32", - &object_info, 0); - } - - return object_type; -} - -GType -_gdk_pixmap_impl_get_type (void) -{ - return _gdk_pixmap_impl_win32_get_type (); -} - -static void -gdk_pixmap_impl_win32_init (GdkPixmapImplWin32 *impl) -{ - impl->width = 1; - impl->height = 1; -} - -static void -gdk_pixmap_impl_win32_class_init (GdkPixmapImplWin32Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); - - object_class->finalize = gdk_pixmap_impl_win32_finalize; - - drawable_class->get_size = gdk_pixmap_impl_win32_get_size; -} - -static void -gdk_pixmap_impl_win32_finalize (GObject *object) -{ - GdkPixmapImplWin32 *impl = GDK_PIXMAP_IMPL_WIN32 (object); - GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_WIN32 (impl)->wrapper); - - GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_impl_win32_finalize: %p\n", - GDK_PIXMAP_HBITMAP (wrapper))); - - _gdk_win32_drawable_finish (GDK_DRAWABLE (object)); - - GDI_CALL (DeleteObject, (GDK_PIXMAP_HBITMAP (wrapper))); - - gdk_win32_handle_table_remove (GDK_PIXMAP_HBITMAP (wrapper)); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gdk_pixmap_impl_win32_get_size (GdkDrawable *drawable, - gint *width, - gint *height) -{ - if (width) - *width = GDK_PIXMAP_IMPL_WIN32 (drawable)->width; - if (height) - *height = GDK_PIXMAP_IMPL_WIN32 (drawable)->height; -} - -static int -bits_for_depth (gint depth) -{ - switch (depth) - { - case 1: - return 1; - - case 2: - case 3: - case 4: - return 4; - - case 5: - case 6: - case 7: - case 8: - return 8; - - case 15: - case 16: - return 16; - - case 24: - case 32: - return 32; - } - g_assert_not_reached (); - return 0; -} - -GdkPixmap* -_gdk_pixmap_new (GdkDrawable *drawable, - gint width, - gint height, - gint depth) -{ - struct { - BITMAPINFOHEADER bmiHeader; - union { - WORD bmiIndices[256]; - DWORD bmiMasks[3]; - RGBQUAD bmiColors[256]; - } u; - } bmi; - UINT iUsage; - HDC hdc; - HWND hwnd; - HPALETTE holdpal = NULL; - HBITMAP hbitmap; - GdkPixmap *pixmap; - GdkDrawableImplWin32 *drawable_impl; - GdkPixmapImplWin32 *pixmap_impl; - GdkColormap *cmap; - guchar *bits; - gint i; - gint window_depth; - - g_return_val_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable), NULL); - g_return_val_if_fail ((drawable != NULL) || (depth != -1), NULL); - g_return_val_if_fail ((width != 0) && (height != 0), NULL); - - if (!drawable) - drawable = _gdk_root; - - if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable)) - return NULL; - - window_depth = gdk_drawable_get_depth (GDK_DRAWABLE (drawable)); - if (depth == -1) - depth = window_depth; - - GDK_NOTE (PIXMAP, g_print ("gdk_pixmap_new: %dx%dx%d drawable=%p\n", - width, height, depth, drawable)); - - pixmap = g_object_new (gdk_pixmap_get_type (), NULL); - drawable_impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl); - pixmap_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl); - drawable_impl->wrapper = GDK_DRAWABLE (pixmap); - - pixmap_impl->is_foreign = FALSE; - pixmap_impl->width = width; - pixmap_impl->height = height; - GDK_PIXMAP_OBJECT (pixmap)->depth = depth; - - if (depth == window_depth) - { - cmap = gdk_drawable_get_colormap (drawable); - if (cmap) - gdk_drawable_set_colormap (pixmap, cmap); - } - - if (GDK_IS_WINDOW (drawable)) - hwnd = GDK_WINDOW_HWND (drawable); - else - hwnd = GetDesktopWindow (); - if ((hdc = GetDC (hwnd)) == NULL) - { - WIN32_GDI_FAILED ("GetDC"); - g_object_unref ((GObject *) pixmap); - return NULL; - } - - bmi.bmiHeader.biSize = sizeof (BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = width; - bmi.bmiHeader.biHeight = -height; - bmi.bmiHeader.biPlanes = 1; - switch (depth) - { - case 1: - case 24: - case 32: - bmi.bmiHeader.biBitCount = bits_for_depth (depth); - break; - - case 4: - bmi.bmiHeader.biBitCount = 4; - break; - - case 5: - case 6: - case 7: - case 8: - bmi.bmiHeader.biBitCount = 8; - break; - - case 15: - case 16: - bmi.bmiHeader.biBitCount = 16; - break; - - default: - g_warning ("gdk_win32_pixmap_new: depth = %d", depth); - g_assert_not_reached (); - } - - if (bmi.bmiHeader.biBitCount == 16) - bmi.bmiHeader.biCompression = BI_BITFIELDS; - else - bmi.bmiHeader.biCompression = BI_RGB; - - bmi.bmiHeader.biSizeImage = 0; - bmi.bmiHeader.biXPelsPerMeter = - bmi.bmiHeader.biYPelsPerMeter = 0; - bmi.bmiHeader.biClrUsed = 0; - bmi.bmiHeader.biClrImportant = 0; - - iUsage = DIB_RGB_COLORS; - if (depth == 1) - { - bmi.u.bmiColors[0].rgbBlue = - bmi.u.bmiColors[0].rgbGreen = - bmi.u.bmiColors[0].rgbRed = 0x00; - bmi.u.bmiColors[0].rgbReserved = 0x00; - - bmi.u.bmiColors[1].rgbBlue = - bmi.u.bmiColors[1].rgbGreen = - bmi.u.bmiColors[1].rgbRed = 0xFF; - bmi.u.bmiColors[1].rgbReserved = 0x00; - } - else - { - if (depth <= 8 && drawable_impl->colormap != NULL) - { - GdkColormapPrivateWin32 *cmapp = - GDK_WIN32_COLORMAP_DATA (drawable_impl->colormap); - gint k; - - if ((holdpal = SelectPalette (hdc, cmapp->hpal, FALSE)) == NULL) - WIN32_GDI_FAILED ("SelectPalette"); - else if ((k = RealizePalette (hdc)) == GDI_ERROR) - WIN32_GDI_FAILED ("RealizePalette"); - else if (k > 0) - GDK_NOTE (PIXMAP_OR_COLORMAP, g_print ("_gdk_win32_pixmap_new: realized %p: %d colors\n", - cmapp->hpal, k)); - - iUsage = DIB_PAL_COLORS; - for (i = 0; i < 256; i++) - bmi.u.bmiIndices[i] = i; - } - else if (bmi.bmiHeader.biBitCount == 16) - { - GdkVisual *visual = gdk_visual_get_system (); - - bmi.u.bmiMasks[0] = visual->red_mask; - bmi.u.bmiMasks[1] = visual->green_mask; - bmi.u.bmiMasks[2] = visual->blue_mask; - } - } - - hbitmap = CreateDIBSection (hdc, (BITMAPINFO *) &bmi, - iUsage, (PVOID *) &bits, NULL, 0); - if (holdpal != NULL) - SelectPalette (hdc, holdpal, FALSE); - - GDI_CALL (ReleaseDC, (hwnd, hdc)); - - GDK_NOTE (PIXMAP, g_print ("... =%p bits=%p pixmap=%p\n", hbitmap, bits, pixmap)); - - if (hbitmap == NULL) - { - WIN32_GDI_FAILED ("CreateDIBSection"); - g_object_unref ((GObject *) pixmap); - return NULL; - } - - drawable_impl->handle = hbitmap; - pixmap_impl->bits = bits; - - gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap); - - return pixmap; -} - -GdkPixmap * -gdk_pixmap_foreign_new_for_display (GdkDisplay *display, - GdkNativeWindow anid) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - g_return_val_if_fail (display == _gdk_display, NULL); - - 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) -{ - GdkPixmap *pixmap; - GdkDrawableImplWin32 *draw_impl; - GdkPixmapImplWin32 *pix_impl; - HBITMAP hbitmap; - SIZE size; - - /* Check to make sure we were passed a HBITMAP */ - g_return_val_if_fail (GetObjectType ((HGDIOBJ) anid) == OBJ_BITMAP, NULL); - - hbitmap = (HBITMAP) anid; - - /* Get information about the bitmap to fill in the structure for the - * GDK window. - */ - GetBitmapDimensionEx (hbitmap, &size); - - /* Allocate a new GDK pixmap */ - pixmap = g_object_new (gdk_pixmap_get_type (), NULL); - draw_impl = GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl); - pix_impl = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl); - draw_impl->wrapper = GDK_DRAWABLE (pixmap); - - draw_impl->handle = hbitmap; - draw_impl->colormap = NULL; - pix_impl->width = size.cx; - pix_impl->height = size.cy; - pix_impl->bits = NULL; - - gdk_win32_handle_table_insert (&GDK_PIXMAP_HBITMAP (pixmap), pixmap); - - return pixmap; -} - -GdkPixmap* -gdk_pixmap_lookup (GdkNativeWindow anid) -{ - return (GdkPixmap*) gdk_win32_handle_table_lookup (anid); -} - -GdkPixmap* -gdk_pixmap_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - g_return_val_if_fail (display == _gdk_display, NULL); - - return gdk_pixmap_lookup (anid); -} diff --git a/gdk/win32/gdkpixmap-win32.h b/gdk/win32/gdkpixmap-win32.h deleted file mode 100644 index fbeb28f7d1..0000000000 --- a/gdk/win32/gdkpixmap-win32.h +++ /dev/null @@ -1,67 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GDK_PIXMAP_WIN32_H__ -#define __GDK_PIXMAP_WIN32_H__ - -#include -#include - -G_BEGIN_DECLS - -/* Pixmap implementation for Win32 - */ - -typedef struct _GdkPixmapImplWin32 GdkPixmapImplWin32; -typedef struct _GdkPixmapImplWin32Class GdkPixmapImplWin32Class; - -#define GDK_TYPE_PIXMAP_IMPL_WIN32 (_gdk_pixmap_impl_win32_get_type ()) -#define GDK_PIXMAP_IMPL_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP_IMPL_WIN32, GdkPixmapImplWin32)) -#define GDK_PIXMAP_IMPL_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP_IMPL_WIN32, GdkPixmapImplWin32Class)) -#define GDK_IS_PIXMAP_IMPL_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP_IMPL_WIN32)) -#define GDK_IS_PIXMAP_IMPL_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP_IMPL_WIN32)) -#define GDK_PIXMAP_IMPL_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP_IMPL_WIN32, GdkPixmapImplWin32Class)) - -struct _GdkPixmapImplWin32 -{ - GdkDrawableImplWin32 parent_instance; - - gint width; - gint height; - guchar *bits; - guint is_foreign : 1; -}; - -struct _GdkPixmapImplWin32Class -{ - GdkDrawableImplWin32Class parent_class; -}; - -GType _gdk_pixmap_impl_win32_get_type (void); - -G_END_DECLS - -#endif /* __GDK_PIXMAP_WIN32_H__ */ diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index b7b279ebf2..3b159c3c32 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -37,7 +37,6 @@ #include #include -#include #include "gdkinternals.h" @@ -184,8 +183,6 @@ void gdk_win32_handle_table_remove (HANDLE handle); COLORREF _gdk_win32_colormap_color (GdkColormap *colormap, gulong pixel); -HRGN _gdk_win32_bitmap_to_hrgn (GdkPixmap *bitmap); - HRGN _gdk_win32_cairo_region_to_hrgn (const cairo_region_t *region, gint x_origin, gint y_origin); diff --git a/gdk/win32/gdkwin32.h b/gdk/win32/gdkwin32.h index df76effd2c..5a494756d8 100644 --- a/gdk/win32/gdkwin32.h +++ b/gdk/win32/gdkwin32.h @@ -42,9 +42,8 @@ G_BEGIN_DECLS #include "gdkprivate-win32.h" #define GDK_WINDOW_HWND(win) (GDK_DRAWABLE_IMPL_WIN32(((GdkWindowObject *)win)->impl)->handle) -#define GDK_PIXMAP_HBITMAP(pixmap) (GDK_DRAWABLE_IMPL_WIN32(((GdkPixmapObject *)pixmap)->impl)->handle) #define GDK_DRAWABLE_IMPL_WIN32_HANDLE(d) (((GdkDrawableImplWin32 *) d)->handle) -#define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_HWND (win) : (GDK_IS_PIXMAP (win) ? GDK_PIXMAP_HBITMAP (win) : (GDK_IS_DRAWABLE_IMPL_WIN32 (win) ? GDK_DRAWABLE_IMPL_WIN32_HANDLE (win) : 0))) +#define GDK_DRAWABLE_HANDLE(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_HWND (win) : (GDK_IS_DRAWABLE_IMPL_WIN32 (win) ? GDK_DRAWABLE_IMPL_WIN32_HANDLE (win) : 0)) #else /* definition for exported 'internals' go here */ #define GDK_WINDOW_HWND(d) (gdk_win32_drawable_get_handle (d)) diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc index 45a335026e..c87eeed92c 100644 --- a/gdk/win32/makefile.msc +++ b/gdk/win32/makefile.msc @@ -46,7 +46,6 @@ gdk_win32_OBJECTS = \ gdkinput-win32.obj \ gdkkeys-win32.obj \ gdkmain-win32.obj \ - gdkpixmap-win32.obj \ gdkproperty-win32.obj \ # gdkregion-win32.obj \ gdkscreen-win32.obj \ diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am index c83b7cd49d..f0d45c2d9c 100644 --- a/gdk/x11/Makefile.am +++ b/gdk/x11/Makefile.am @@ -43,8 +43,6 @@ libgdk_x11_la_SOURCES = \ gdkinput.c \ gdkkeys-x11.c \ gdkmain-x11.c \ - gdkpixmap-x11.c \ - gdkpixmap-x11.h \ gdkproperty-x11.c \ gdkscreen-x11.c \ gdkscreen-x11.h \ diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index 1ef1a5000b..67ce6d4a02 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -41,9 +41,7 @@ #include "gdkprivate-x11.h" #include "gdkcursor.h" #include "gdkdisplay-x11.h" -#include "gdkpixmap-x11.h" #include "gdkx.h" -#include #include static guint theme_serial = 0; diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c index 2fff65e938..a715bd1246 100644 --- a/gdk/x11/gdkdrawable-x11.c +++ b/gdk/x11/gdkdrawable-x11.c @@ -35,7 +35,6 @@ #include "gdkprivate-x11.h" #include "gdkdrawable-x11.h" -#include "gdkpixmap-x11.h" #include "gdkscreen-x11.h" #include "gdkdisplay-x11.h" @@ -95,8 +94,7 @@ gdk_drawable_impl_x11_finalize (GObject *object) * _gdk_x11_drawable_finish: * @drawable: a #GdkDrawableImplX11. * - * Performs necessary cleanup prior to freeing a pixmap or - * destroying a window. + * Performs necessary cleanup prior to destroying a window. **/ void _gdk_x11_drawable_finish (GdkDrawable *drawable) @@ -177,11 +175,9 @@ get_impl_drawable (GdkDrawable *drawable) { if (GDK_IS_WINDOW (drawable)) return ((GdkWindowObject *)drawable)->impl; - else if (GDK_IS_PIXMAP (drawable)) - return ((GdkPixmapObject *)drawable)->impl; else { - g_warning (G_STRLOC " drawable is not a pixmap or window"); + g_warning (G_STRLOC " drawable is not a window"); return NULL; } } @@ -222,7 +218,7 @@ gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable) * gdk_x11_drawable_get_xid: * @drawable: a #GdkDrawable. * - * Returns the X resource (window or pixmap) belonging to a #GdkDrawable. + * Returns the X resource (window) belonging to a #GdkDrawable. * * Return value: the ID of @drawable's X resource. **/ @@ -255,11 +251,9 @@ gdk_x11_drawable_get_xid (GdkDrawable *drawable) impl = ((GdkWindowObject *)drawable)->impl; } - else if (GDK_IS_PIXMAP (drawable)) - impl = ((GdkPixmapObject *)drawable)->impl; else { - g_warning (G_STRLOC " drawable is not a pixmap or window"); + g_warning (G_STRLOC " drawable is not a window"); return None; } @@ -271,11 +265,6 @@ gdk_x11_window_get_drawable_impl (GdkWindow *window) { return ((GdkWindowObject *)window)->impl; } -GdkDrawable * -gdk_x11_pixmap_get_drawable_impl (GdkPixmap *pixmap) -{ - return ((GdkPixmapObject *)pixmap)->impl; -} static void gdk_x11_cairo_surface_destroy (void *data) @@ -317,9 +306,7 @@ gdk_x11_create_cairo_surface (GdkDrawable *drawable, { g_warning ("Using Cairo rendering requires the drawable argument to\n" "have a specified colormap. All windows have a colormap,\n" - "however, pixmaps only have colormap by default if they\n" - "were created with a non-NULL window argument. Otherwise\n" - "a colormap must be set on them with gdk_drawable_set_colormap"); + "so why is this code even reached?"); return NULL; } diff --git a/gdk/x11/gdkdrawable-x11.h b/gdk/x11/gdkdrawable-x11.h index 7d243dbd9d..f499455110 100644 --- a/gdk/x11/gdkdrawable-x11.h +++ b/gdk/x11/gdkdrawable-x11.h @@ -74,7 +74,6 @@ GType _gdk_drawable_impl_x11_get_type (void); void _gdk_x11_drawable_finish (GdkDrawable *drawable); void _gdk_x11_drawable_update_size (GdkDrawable *drawable); GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window); -GdkDrawable *gdk_x11_pixmap_get_drawable_impl (GdkPixmap *pixmap); G_END_DECLS diff --git a/gdk/x11/gdkim-x11.c b/gdk/x11/gdkim-x11.c index 9fabd77026..53c7aa6733 100644 --- a/gdk/x11/gdkim-x11.c +++ b/gdk/x11/gdkim-x11.c @@ -32,7 +32,6 @@ #include "gdkx.h" #include "gdk.h" /* For gdk_flush() */ -#include "gdkpixmap.h" #include "gdkinternals.h" #include "gdkdisplay-x11.h" diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c deleted file mode 100644 index d41552c229..0000000000 --- a/gdk/x11/gdkpixmap-x11.c +++ /dev/null @@ -1,361 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#include "config.h" -#include -#include -#include -/* Needed for SEEK_END in SunOS */ -#include -#include - -#include "gdkx.h" - -#include "gdkpixmap-x11.h" -#include "gdkprivate-x11.h" -#include "gdkscreen-x11.h" -#include "gdkdisplay-x11.h" - -#include - - -typedef struct -{ - gchar *color_string; - GdkColor color; - gint transparent; -} _GdkPixmapColor; - -typedef struct -{ - guint ncolors; - GdkColormap *colormap; - gulong pixels[1]; -} _GdkPixmapInfo; - -static void gdk_pixmap_impl_x11_get_size (GdkDrawable *drawable, - gint *width, - gint *height); - -static void gdk_pixmap_impl_x11_dispose (GObject *object); -static void gdk_pixmap_impl_x11_finalize (GObject *object); - -G_DEFINE_TYPE (GdkPixmapImplX11, gdk_pixmap_impl_x11, GDK_TYPE_DRAWABLE_IMPL_X11) - -GType -_gdk_pixmap_impl_get_type (void) -{ - return gdk_pixmap_impl_x11_get_type (); -} - -static void -gdk_pixmap_impl_x11_init (GdkPixmapImplX11 *impl) -{ - impl->width = 1; - impl->height = 1; -} - -static void -gdk_pixmap_impl_x11_class_init (GdkPixmapImplX11Class *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass); - - object_class->dispose = gdk_pixmap_impl_x11_dispose; - object_class->finalize = gdk_pixmap_impl_x11_finalize; - - drawable_class->get_size = gdk_pixmap_impl_x11_get_size; -} - -static void -gdk_pixmap_impl_x11_dispose (GObject *object) -{ - GdkPixmapImplX11 *impl = GDK_PIXMAP_IMPL_X11 (object); - GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_X11 (impl)->wrapper); - GdkDisplay *display = GDK_PIXMAP_DISPLAY (wrapper); - - if (!display->closed) - { - if (!impl->is_foreign) - XFreePixmap (GDK_DISPLAY_XDISPLAY (display), GDK_PIXMAP_XID (wrapper)); - } - - _gdk_xid_table_remove (display, GDK_PIXMAP_XID (wrapper)); - - G_OBJECT_CLASS (gdk_pixmap_impl_x11_parent_class)->dispose (object); -} - -static void -gdk_pixmap_impl_x11_finalize (GObject *object) -{ - GdkPixmapImplX11 *impl = GDK_PIXMAP_IMPL_X11 (object); - GdkPixmap *wrapper = GDK_PIXMAP (GDK_DRAWABLE_IMPL_X11 (impl)->wrapper); - GdkDisplay *display = GDK_PIXMAP_DISPLAY (wrapper); - - if (!display->closed) - { - GdkDrawableImplX11 *draw_impl = GDK_DRAWABLE_IMPL_X11 (impl); - - _gdk_x11_drawable_finish (GDK_DRAWABLE (draw_impl)); - } - - G_OBJECT_CLASS (gdk_pixmap_impl_x11_parent_class)->finalize (object); -} - -static void -gdk_pixmap_impl_x11_get_size (GdkDrawable *drawable, - gint *width, - gint *height) -{ - if (width) - *width = GDK_PIXMAP_IMPL_X11 (drawable)->width; - if (height) - *height = GDK_PIXMAP_IMPL_X11 (drawable)->height; -} - -GdkPixmap* -_gdk_pixmap_new (GdkDrawable *drawable, - gint width, - gint height, - gint depth) -{ - GdkPixmap *pixmap; - GdkDrawableImplX11 *draw_impl; - GdkPixmapImplX11 *pix_impl; - GdkColormap *cmap; - gint window_depth; - - g_return_val_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable), NULL); - g_return_val_if_fail ((drawable != NULL) || (depth != -1), NULL); - g_return_val_if_fail ((width != 0) && (height != 0), NULL); - - if (!drawable) - { - GDK_NOTE (MULTIHEAD, g_message ("need to specify the screen parent window " - "for gdk_pixmap_new() to be multihead safe")); - drawable = gdk_screen_get_root_window (gdk_screen_get_default ()); - } - - if (GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable)) - return NULL; - - window_depth = gdk_drawable_get_depth (GDK_DRAWABLE (drawable)); - if (depth == -1) - depth = window_depth; - - 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_WINDOW_SCREEN (drawable); - draw_impl->xid = XCreatePixmap (GDK_PIXMAP_XDISPLAY (pixmap), - GDK_WINDOW_XID (drawable), - width, height, depth); - - pix_impl->is_foreign = FALSE; - pix_impl->width = width; - pix_impl->height = height; - GDK_PIXMAP_OBJECT (pixmap)->depth = depth; - - if (depth == window_depth) - { - cmap = gdk_drawable_get_colormap (drawable); - if (cmap) - gdk_drawable_set_colormap (pixmap, cmap); - } - - _gdk_xid_table_insert (GDK_WINDOW_DISPLAY (drawable), - &GDK_PIXMAP_XID (pixmap), pixmap); - return pixmap; -} - -/** - * gdk_pixmap_foreign_new_for_display: - * @display: The #GdkDisplay where @anid is located. - * @anid: a native pixmap handle. - * - * 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 - * XID. - * - * Return value: the newly-created #GdkPixmap wrapper for the - * native pixmap or %NULL if the pixmap has been destroyed. - * - * Since: 2.2 - **/ -GdkPixmap * -gdk_pixmap_foreign_new_for_display (GdkDisplay *display, - GdkNativeWindow anid) -{ - Pixmap xpixmap; - Window root_return; - GdkScreen *screen; - int x_ret, y_ret; - unsigned int w_ret, h_ret, bw_ret, depth_ret; - - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - - /* check to make sure we were passed something at - * least a little sane */ - g_return_val_if_fail ((anid != 0), NULL); - - /* set the pixmap to the passed in value */ - xpixmap = anid; - - /* get information about the Pixmap to fill in the structure for - the gdk window */ - if (!XGetGeometry (GDK_DISPLAY_XDISPLAY (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 - * XID. - * - * 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); - - xpixmap = anid; - - draw_impl->screen = screen; - draw_impl->xid = xpixmap; - - pix_impl->is_foreign = TRUE; - pix_impl->width = width; - pix_impl->height = height; - GDK_PIXMAP_OBJECT (pixmap)->depth = depth; - - _gdk_xid_table_insert (gdk_screen_get_display (screen), - &GDK_PIXMAP_XID (pixmap), pixmap); - - return pixmap; -} - -/** - * gdk_pixmap_foreign_new: - * @anid: a native pixmap handle. - * - * Wraps a native window for the default display 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 - * XID. - * - * Return value: the newly-created #GdkPixmap wrapper for the - * native pixmap or %NULL if the pixmap has been destroyed. - **/ -GdkPixmap* -gdk_pixmap_foreign_new (GdkNativeWindow anid) -{ - return gdk_pixmap_foreign_new_for_display (gdk_display_get_default (), anid); -} - -/** - * gdk_pixmap_lookup: - * @anid: a native pixmap handle. - * - * Looks up the #GdkPixmap that wraps the given native pixmap handle. - * - * For example in the X backend, a native pixmap handle is an Xlib - * XID. - * - * Return value: the #GdkPixmap wrapper for the native pixmap, - * or %NULL if there is none. - **/ -GdkPixmap* -gdk_pixmap_lookup (GdkNativeWindow anid) -{ - return (GdkPixmap*) gdk_xid_table_lookup_for_display (gdk_display_get_default (), anid); -} - -/** - * gdk_pixmap_lookup_for_display: - * @display: the #GdkDisplay associated with @anid - * @anid: a native pixmap handle. - * - * Looks up the #GdkPixmap that wraps the given native pixmap handle. - * - * For example in the X backend, a native pixmap handle is an Xlib - * XID. - * - * Return value: the #GdkPixmap wrapper for the native pixmap, - * or %NULL if there is none. - * - * Since: 2.2 - **/ -GdkPixmap* -gdk_pixmap_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - return (GdkPixmap*) gdk_xid_table_lookup_for_display (display, anid); -} diff --git a/gdk/x11/gdkpixmap-x11.h b/gdk/x11/gdkpixmap-x11.h deleted file mode 100644 index 9da6911093..0000000000 --- a/gdk/x11/gdkpixmap-x11.h +++ /dev/null @@ -1,68 +0,0 @@ -/* GDK - The GIMP Drawing Kit - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GDK_PIXMAP_X11_H__ -#define __GDK_PIXMAP_X11_H__ - -#include -#include - -G_BEGIN_DECLS - -/* Pixmap implementation for X11 - */ - -typedef struct _GdkPixmapImplX11 GdkPixmapImplX11; -typedef struct _GdkPixmapImplX11Class GdkPixmapImplX11Class; - -#define GDK_TYPE_PIXMAP_IMPL_X11 (gdk_pixmap_impl_x11_get_type ()) -#define GDK_PIXMAP_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP_IMPL_X11, GdkPixmapImplX11)) -#define GDK_PIXMAP_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP_IMPL_X11, GdkPixmapImplX11Class)) -#define GDK_IS_PIXMAP_IMPL_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP_IMPL_X11)) -#define GDK_IS_PIXMAP_IMPL_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP_IMPL_X11)) -#define GDK_PIXMAP_IMPL_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP_IMPL_X11, GdkPixmapImplX11Class)) - -struct _GdkPixmapImplX11 -{ - GdkDrawableImplX11 parent_instance; - - gint width; - gint height; - - guint is_foreign : 1; -}; - -struct _GdkPixmapImplX11Class -{ - GdkDrawableImplX11Class parent_class; - -}; - -GType gdk_pixmap_impl_x11_get_type (void); - -G_END_DECLS - -#endif /* __GDK_PIXMAP_X11_H__ */ diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 0a0f505661..9194e4ca3c 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -36,7 +36,6 @@ #include #include #include -#include #include #include "gdkinternals.h" @@ -161,12 +160,9 @@ extern const int _gdk_event_mask_table[]; extern GdkAtom _gdk_selection_property; extern gboolean _gdk_synchronize; -#define GDK_PIXMAP_SCREEN(pix) (GDK_DRAWABLE_IMPL_X11 (((GdkPixmapObject *)pix)->impl)->screen) -#define GDK_PIXMAP_DISPLAY(pix) (GDK_SCREEN_X11 (GDK_PIXMAP_SCREEN (pix))->display) -#define GDK_PIXMAP_XROOTWIN(pix) (GDK_SCREEN_X11 (GDK_PIXMAP_SCREEN (pix))->xroot_window) -#define GDK_DRAWABLE_DISPLAY(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_DISPLAY (win) : GDK_PIXMAP_DISPLAY (win)) -#define GDK_DRAWABLE_SCREEN(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_SCREEN (win) : GDK_PIXMAP_SCREEN (win)) -#define GDK_DRAWABLE_XROOTWIN(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XROOTWIN (win) : GDK_PIXMAP_XROOTWIN (win)) +#define GDK_DRAWABLE_DISPLAY(win) (GDK_WINDOW_DISPLAY (win)) +#define GDK_DRAWABLE_SCREEN(win) (GDK_WINDOW_SCREEN (win)) +#define GDK_DRAWABLE_XROOTWIN(win) (GDK_WINDOW_XROOTWIN (win)) #define GDK_SCREEN_DISPLAY(screen) (GDK_SCREEN_X11 (screen)->display) #define GDK_SCREEN_XROOTWIN(screen) (GDK_SCREEN_X11 (screen)->xroot_window) #define GDK_WINDOW_SCREEN(win) (GDK_DRAWABLE_IMPL_X11 (((GdkWindowObject *)win)->impl)->screen) diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 53177a4801..301b09905c 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -541,8 +541,8 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen, * gdk_screen_get_rgba_colormap: * @screen: a #GdkScreen. * - * Gets a colormap to use for creating windows or pixmaps with an - * alpha channel. The windowing system on which GTK+ is running + * Gets a colormap to use for creating windows with an alpha + * channel. The windowing system on which GTK+ is running * may not support this capability, in which case %NULL will * be returned. Even if a non-%NULL value is returned, its * possible that the window's alpha channel won't be honored @@ -583,9 +583,8 @@ gdk_screen_get_rgba_colormap (GdkScreen *screen) * gdk_screen_get_rgba_visual: * @screen: a #GdkScreen * - * Gets a visual to use for creating windows or pixmaps with an - * alpha channel. See the docs for gdk_screen_get_rgba_colormap() - * for caveats. + * Gets a visual to use for creating windows with an alpha channel. + * See the docs for gdk_screen_get_rgba_colormap() for caveats. * * Return value: (transfer none): a visual to use for windows with an * alpha channel or %NULL if the capability is not available. diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h index 074ec5fb20..e08449e4d4 100644 --- a/gdk/x11/gdkx.h +++ b/gdk/x11/gdkx.h @@ -37,7 +37,6 @@ G_BEGIN_DECLS Display *gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable); XID gdk_x11_drawable_get_xid (GdkDrawable *drawable); GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window); -GdkDrawable *gdk_x11_pixmap_get_drawable_impl (GdkPixmap *pixmap); Display *gdk_x11_colormap_get_xdisplay (GdkColormap *colormap); Colormap gdk_x11_colormap_get_xcolormap (GdkColormap *colormap); Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor); @@ -72,10 +71,8 @@ gint gdk_x11_get_default_screen (void); #define GDK_WINDOW_XDISPLAY(win) (GDK_SCREEN_X11 (GDK_WINDOW_SCREEN (win))->xdisplay) #define GDK_WINDOW_XID(win) (GDK_DRAWABLE_IMPL_X11(((GdkWindowObject *)win)->impl)->xid) -#define GDK_PIXMAP_XDISPLAY(pix) (GDK_SCREEN_X11 (GDK_PIXMAP_SCREEN (pix))->xdisplay) -#define GDK_PIXMAP_XID(pix) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)pix)->impl)->xid) -#define GDK_DRAWABLE_XDISPLAY(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XDISPLAY (win) : GDK_PIXMAP_XDISPLAY (win)) -#define GDK_DRAWABLE_XID(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XID (win) : GDK_PIXMAP_XID (win)) +#define GDK_DRAWABLE_XDISPLAY(win) (GDK_WINDOW_XDISPLAY (win)) +#define GDK_DRAWABLE_XID(win) (GDK_WINDOW_XID (win)) #define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay) #define GDK_SCREEN_XSCREEN(screen) (GDK_SCREEN_X11 (screen)->xscreen) #define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_num) @@ -93,8 +90,6 @@ gint gdk_x11_get_default_screen (void); #define GDK_WINDOW_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (gdk_x11_window_get_drawable_impl (win))) #define GDK_WINDOW_XID(win) (gdk_x11_drawable_get_xid (win)) #define GDK_WINDOW_XWINDOW(win) (gdk_x11_drawable_get_xid (win)) -#define GDK_PIXMAP_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (gdk_x11_pixmap_get_drawable_impl (win))) -#define GDK_PIXMAP_XID(win) (gdk_x11_drawable_get_xid (win)) #define GDK_DRAWABLE_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (win)) #define GDK_DRAWABLE_XID(win) (gdk_x11_drawable_get_xid (win)) #define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen))) diff --git a/gdk/x11/gdkxid.c b/gdk/x11/gdkxid.c index 21d876c154..637068c785 100644 --- a/gdk/x11/gdkxid.c +++ b/gdk/x11/gdkxid.c @@ -78,9 +78,8 @@ _gdk_xid_table_remove (GdkDisplay *display, * * Returns the GDK object associated with the given X id. * - * Return value: the associated Gdk object, which may be a #GdkPixmap, - * a #GdkWindow or %NULL if no object is associated - * with the X id. + * Return value: the associated #GdkWindow or %NULL if no + * object is associated with the X id. * * Since: 2.2 */ @@ -109,9 +108,8 @@ gdk_xid_table_lookup_for_display (GdkDisplay *display, * Returns the Gdk object associated with the given X id for the default * display. * - * Return value: the associated Gdk object, which may be a #GdkPixmap, - * a #GdkWindow or %NULL if no object is associated - * with the X id. + * Return value: the associated #GdkWindow or %NULL if no + * object is associated with the X id. */ gpointer gdk_xid_table_lookup (XID xid)