root/trunk/third/nautilus/libnautilus-extensions/bug-5712-pr3-workaround--gdkimage.c @ 15547

Revision 15547, 3.7 KB (checked in by ghudson, 9 years ago)

This commit was generated by cvs2svn to compensate for changes in r15546,
which included commits to RCS files with non-trunk default branches.

Line 
1/* FIXME bugzilla.eazel.com 5813:
2 * As soon as gtk 1.2.9 is released, this hack needs to be exorcised.
3 */
4
5
6/* GDK - The GIMP Drawing Kit
7 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Library General Public License for more details.
18 *
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
23 */
24
25/*
26 * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
27 * file for a list of people on the GTK+ Team.  See the ChangeLog
28 * files for a list of changes.  These files are distributed with
29 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
30 */
31
32#include <config.h>
33
34#include <errno.h>
35#include <stdlib.h>
36#include <sys/types.h>
37
38#include <gdk/gdk.h>
39#include <gdk/gdkprivate.h>
40
41static void gdk_image_put_normal (GdkDrawable *drawable,
42                                  GdkGC       *gc,
43                                  GdkImage    *image,
44                                  gint         xsrc,
45                                  gint         ysrc,
46                                  gint         xdest,
47                                  gint         ydest,
48                                  gint         width,
49                                  gint         height);
50
51GdkImage* NAUTILUS_BUG_5712_PR3_WORKAROUND__gdk_image_get (GdkWindow *window,
52                                                           gint       x,
53                                                           gint       y,
54                                                           gint       width,
55                                                           gint       height);
56
57GdkImage*
58NAUTILUS_BUG_5712_PR3_WORKAROUND__gdk_image_get (GdkWindow *window,
59               gint       x,
60               gint       y,
61               gint       width,
62               gint       height)
63{
64  GdkImage *image;
65  GdkImagePrivate *private;
66  GdkWindowPrivate *win_private;
67  XImage *ximage;
68
69  g_return_val_if_fail (window != NULL, NULL);
70
71  win_private = (GdkWindowPrivate *) window;
72  if (win_private->destroyed)
73    return NULL;
74
75  ximage = XGetImage (gdk_display,
76                      win_private->xwindow,
77                      x, y, width, height,
78                      AllPlanes, ZPixmap);
79 
80  if (ximage == NULL)
81    return NULL;
82 
83  private = g_new (GdkImagePrivate, 1);
84  image = (GdkImage*) private;
85
86  private->xdisplay = gdk_display;
87  private->image_put = gdk_image_put_normal;
88  private->ximage = ximage;
89  image->type = GDK_IMAGE_NORMAL;
90  image->visual = gdk_window_get_visual (window);
91  image->width = width;
92  image->height = height;
93  image->depth = private->ximage->depth;
94
95  image->mem = private->ximage->data;
96  image->bpl = private->ximage->bytes_per_line;
97  image->bpp = private->ximage->bits_per_pixel;
98  image->byte_order = private->ximage->byte_order;
99
100  return image;
101}
102
103static void
104gdk_image_put_normal (GdkDrawable *drawable,
105                      GdkGC       *gc,
106                      GdkImage    *image,
107                      gint         xsrc,
108                      gint         ysrc,
109                      gint         xdest,
110                      gint         ydest,
111                      gint         width,
112                      gint         height)
113{
114  GdkWindowPrivate *drawable_private;
115  GdkImagePrivate *image_private;
116  GdkGCPrivate *gc_private;
117
118  g_return_if_fail (drawable != NULL);
119  g_return_if_fail (image != NULL);
120  g_return_if_fail (gc != NULL);
121
122  drawable_private = (GdkWindowPrivate*) drawable;
123  if (drawable_private->destroyed)
124    return;
125  image_private = (GdkImagePrivate*) image;
126  gc_private = (GdkGCPrivate*) gc;
127
128  g_return_if_fail (image->type == GDK_IMAGE_NORMAL);
129
130  XPutImage (drawable_private->xdisplay, drawable_private->xwindow,
131             gc_private->xgc, image_private->ximage,
132             xsrc, ysrc, xdest, ydest, width, height);
133}
Note: See TracBrowser for help on using the browser.