mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
gdk: Remove GdkPixmap
All iusers of it are gone, so it's now time to let go. cairo_surface_t is a full replacement, combined with gdk_window_create_similar_surface().
This commit is contained in:
parent
cadcd029a1
commit
f74f9b2766
@ -240,28 +240,6 @@ GdkScreenClass
|
||||
gdk_screen_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Bitmaps and Pixmaps</TITLE>
|
||||
<FILE>pixmaps</FILE>
|
||||
GdkPixmap
|
||||
gdk_pixmap_new
|
||||
GdkBitmap
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_PIXMAP
|
||||
GDK_PIXMAP_GET_CLASS
|
||||
GDK_PIXMAP_OBJECT
|
||||
GDK_TYPE_PIXMAP
|
||||
GDK_IS_PIXMAP
|
||||
GDK_PIXMAP_CLASS
|
||||
GDK_IS_PIXMAP_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_pixmap_get_type
|
||||
GdkPixmapObject
|
||||
GdkPixmapObjectClass
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Pixbufs</TITLE>
|
||||
<FILE>pixbufs</FILE>
|
||||
@ -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
|
||||
<SUBSECTION Private>
|
||||
GDK_HAVE_WCHAR_H
|
||||
GDK_HAVE_WCTYPE_H
|
||||
gdk_x11_pixmap_get_drawable_impl
|
||||
gdk_x11_window_get_drawable_impl
|
||||
</SECTION>
|
||||
|
||||
|
@ -1,89 +0,0 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
/* 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;
|
||||
}
|
@ -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 \
|
||||
|
@ -46,7 +46,6 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gdk/gdkpango.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/gdkpixmap.h>
|
||||
#include <gdk/gdkproperty.h>
|
||||
#include <gdk/gdkscreen.h>
|
||||
#include <gdk/gdkselection.h>
|
||||
|
@ -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__)
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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,
|
||||
|
196
gdk/gdkpixmap.c
196
gdk/gdkpixmap.c
@ -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);
|
||||
}
|
@ -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 <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GDK_PIXMAP_H__
|
||||
#define __GDK_PIXMAP_H__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdrawable.h>
|
||||
|
||||
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__ */
|
@ -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;
|
||||
|
@ -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 \
|
||||
|
@ -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 \
|
||||
|
@ -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;
|
||||
}
|
@ -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 <ApplicationServices/ApplicationServices.h>
|
||||
#include <gdk/quartz/gdkdrawable-quartz.h>
|
||||
#include <gdk/gdkpixmap.h>
|
||||
|
||||
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__ */
|
@ -25,7 +25,6 @@
|
||||
#define GDK_QUARTZ_RELEASE_POOL [pool release]
|
||||
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/quartz/gdkpixmap-quartz.h>
|
||||
#include <gdk/quartz/gdkwindow-quartz.h>
|
||||
#include <gdk/quartz/gdkquartz.h>
|
||||
|
||||
|
@ -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 \
|
||||
|
@ -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)
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "gdkpixmap.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkwin32.h"
|
||||
|
||||
|
@ -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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
}
|
@ -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 <gdk/win32/gdkdrawable-win32.h>
|
||||
#include <gdk/gdkpixmap.h>
|
||||
|
||||
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__ */
|
@ -37,7 +37,6 @@
|
||||
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/win32/gdkwindow-win32.h>
|
||||
#include <gdk/win32/gdkpixmap-win32.h>
|
||||
|
||||
#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);
|
||||
|
@ -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))
|
||||
|
@ -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 \
|
||||
|
@ -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 \
|
||||
|
@ -41,9 +41,7 @@
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkpixmap-x11.h"
|
||||
#include "gdkx.h"
|
||||
#include <gdk/gdkpixmap.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
static guint theme_serial = 0;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "gdkx.h"
|
||||
#include "gdk.h" /* For gdk_flush() */
|
||||
#include "gdkpixmap.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
|
@ -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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
/* Needed for SEEK_END in SunOS */
|
||||
#include <unistd.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "gdkx.h"
|
||||
|
||||
#include "gdkpixmap-x11.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkscreen-x11.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
#include <gdk/gdkinternals.h>
|
||||
|
||||
|
||||
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
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* 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
|
||||
* <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);
|
||||
|
||||
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
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* 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
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* 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
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* 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);
|
||||
}
|
@ -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 <gdk/x11/gdkdrawable-x11.h>
|
||||
#include <gdk/gdkpixmap.h>
|
||||
|
||||
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__ */
|
@ -36,7 +36,6 @@
|
||||
#include <gdk/gdkcursor.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/x11/gdkwindow-x11.h>
|
||||
#include <gdk/x11/gdkpixmap-x11.h>
|
||||
#include <gdk/x11/gdkdisplay-x11.h>
|
||||
|
||||
#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)
|
||||
|
@ -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.
|
||||
|
@ -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)))
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user