summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-11-13 21:28:36 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-11-13 21:28:36 +0000
commita0ca2a7b0d905c7aa4eba64d213853afa3e87e33 (patch)
tree9537aa88ace45d6d1172aa58e720568b7e8e2547 /gdk
parent8b621ad059cf6727c5a23942beed1ad180cc7b84 (diff)
downloadgtk+-a0ca2a7b0d905c7aa4eba64d213853afa3e87e33.tar.gz
New function gdk_pixmap_foreign_new(). (gtk-blizzard-981005-0. Christopher
Fri Nov 13 11:22:38 1998 Owen Taylor <otaylor@redhat.com> * gdk/gdkpixmap.c: New function gdk_pixmap_foreign_new(). (gtk-blizzard-981005-0. Christopher Blizzard <blizzard@applied-theory.com) * gdk/gdk.h gdk/gdkx.h: Moved gdk_window_foreign_new and gdk_pixmap_foreign_new to gdkx.h. Fri Nov 13 16:06:48 1998 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am: Added rules to generate an empty GTK+ theme called "Default" upon installation. * gtk/gtkrc.c (gtk_rc_parse_style): Fix inheritance of fonts and fontsets. (gtk-matsu-980924. Takashi Matsuda matsu@arch.comp.kyutech.ac.jp) * gtk/gtkmain.c: Change test to detect glibc's utf8 based mb* functions to be more specific. * gtk/gtkwindow.[ch] gtk/gtkfixed.c: Indentation cleanups.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdk.h1
-rw-r--r--gdk/gdkpixmap.c47
-rw-r--r--gdk/gdktypes.h1
-rw-r--r--gdk/gdkx.h3
-rw-r--r--gdk/x11/gdkpixmap-x11.c47
-rw-r--r--gdk/x11/gdkx.h3
6 files changed, 101 insertions, 1 deletions
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 5ee53061b5..84563cf8fe 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -126,7 +126,6 @@ GdkWindow* gdk_window_new (GdkWindow *parent,
GdkWindowAttr *attributes,
gint attributes_mask);
-GdkWindow* gdk_window_foreign_new (guint32 anid);
void gdk_window_destroy (GdkWindow *window);
GdkWindow* gdk_window_ref (GdkWindow *window);
void gdk_window_unref (GdkWindow *window);
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index dfaf4822c9..291c8d7746 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -749,6 +749,53 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
}
GdkPixmap*
+gdk_pixmap_foreign_new (guint32 anid)
+{
+ GdkPixmap *pixmap;
+ GdkWindowPrivate *window_private;
+ GdkWindowPrivate *private;
+ Pixmap xpixmap;
+ Window root_return;
+ unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
+
+ /* 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 the root window */
+ window_private = &gdk_root_parent;
+
+ /* get information about the Pixmap to fill in the structure for
+ the gdk window */
+ if (!XGetGeometry(window_private->xdisplay, xpixmap, &root_return,
+ &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
+ return NULL;
+
+ /* allocate a new gdk pixmap */
+ private = g_new(GdkWindowPrivate, 1);
+ pixmap = (GdkPixmap *)private;
+
+ private->xdisplay = window_private->xdisplay;
+ private->window_type = GDK_WINDOW_PIXMAP;
+ private->xwindow = xpixmap;
+ private->colormap = NULL;
+ private->parent = NULL;
+ private->x = 0;
+ private->y = 0;
+ private->width = w_ret;
+ private->height = h_ret;
+ private->resize_count = 0;
+ private->ref_count = 1;
+ private->destroyed = 0;
+
+ gdk_xid_table_insert(&private->xwindow, pixmap);
+
+ return pixmap;
+}
+
+GdkPixmap*
gdk_pixmap_ref (GdkPixmap *pixmap)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 964095b4c7..26527b45f8 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -847,6 +847,7 @@ struct _GdkCursor
GdkCursorType type;
};
+
struct _GdkColorContextDither
{
gint fast_rgb[32][32][32]; /* quick look-up table for faster rendering */
diff --git a/gdk/gdkx.h b/gdk/gdkx.h
index fbe655d2ea..306f03d091 100644
--- a/gdk/gdkx.h
+++ b/gdk/gdkx.h
@@ -47,5 +47,8 @@ GdkColormap* gdkx_colormap_get (Colormap xcolormap);
Window gdk_get_client_window (Display *dpy,
Window win);
+/* Functions to create pixmaps and windows from their X equivalents */
+GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
+GdkWindow *gdk_window_foreign_new (guint32 anid);
#endif /* __GDK_X_H__ */
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index dfaf4822c9..291c8d7746 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -749,6 +749,53 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
}
GdkPixmap*
+gdk_pixmap_foreign_new (guint32 anid)
+{
+ GdkPixmap *pixmap;
+ GdkWindowPrivate *window_private;
+ GdkWindowPrivate *private;
+ Pixmap xpixmap;
+ Window root_return;
+ unsigned int x_ret, y_ret, w_ret, h_ret, bw_ret, depth_ret;
+
+ /* 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 the root window */
+ window_private = &gdk_root_parent;
+
+ /* get information about the Pixmap to fill in the structure for
+ the gdk window */
+ if (!XGetGeometry(window_private->xdisplay, xpixmap, &root_return,
+ &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret))
+ return NULL;
+
+ /* allocate a new gdk pixmap */
+ private = g_new(GdkWindowPrivate, 1);
+ pixmap = (GdkPixmap *)private;
+
+ private->xdisplay = window_private->xdisplay;
+ private->window_type = GDK_WINDOW_PIXMAP;
+ private->xwindow = xpixmap;
+ private->colormap = NULL;
+ private->parent = NULL;
+ private->x = 0;
+ private->y = 0;
+ private->width = w_ret;
+ private->height = h_ret;
+ private->resize_count = 0;
+ private->ref_count = 1;
+ private->destroyed = 0;
+
+ gdk_xid_table_insert(&private->xwindow, pixmap);
+
+ return pixmap;
+}
+
+GdkPixmap*
gdk_pixmap_ref (GdkPixmap *pixmap)
{
GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
index fbe655d2ea..306f03d091 100644
--- a/gdk/x11/gdkx.h
+++ b/gdk/x11/gdkx.h
@@ -47,5 +47,8 @@ GdkColormap* gdkx_colormap_get (Colormap xcolormap);
Window gdk_get_client_window (Display *dpy,
Window win);
+/* Functions to create pixmaps and windows from their X equivalents */
+GdkPixmap *gdk_pixmap_foreign_new (guint32 anid);
+GdkWindow *gdk_window_foreign_new (guint32 anid);
#endif /* __GDK_X_H__ */