[Fwd: gtk-blizzard-981005-0.README]
- From: "Shawn T . Amundson" <amundson gimp org>
- To: gtk-devel-list redhat com
- Subject: [Fwd: gtk-blizzard-981005-0.README]
- Date: Tue, 6 Oct 1998 14:18:42 -0700
This has the test program Chris mentioned.
-Shawn
----- Forwarded message from Christopher Blizzard <blizzard@appliedtheory.com> -----
Date: Mon, 05 Oct 1998 18:32:39 -0400
From: Christopher Blizzard <blizzard@appliedtheory.com>
Organization: AppliedTheory Communications, Inc
X-Mailer: Mozilla 4.5b2 [en] (X11; I; Linux 2.0.35 i586)
To: ftp-admin@gimp.org, Chris Blizzard <blizzard@appliedtheory.com>
Subject: gtk-blizzard-981005-0.README
This patch allows you to allow Xlib Pixmaps that may have been created
via
other methods to be managed as a GdkPixmap.
Attached is a test program and an .xpm to test with. Please let me know
if there are any problems, this is a pretty simple patch.
--Chris
--
------------
Christopher Blizzard
http://odin.appliedtheory.com/
------------
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/xpm.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <stdio.h>
#include <string.h>
int
main(int argc, char **argv)
{
Display *disp = NULL;
Window win = 0;
GtkWidget *toplevel;
GtkWidget *gtk_pixmap;
GdkPixmap *gdk_pixmap;
Pixmap pixmap = 0;
int rv;
gtk_init(&argc, &argv);
toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_border_width(GTK_CONTAINER(toplevel), 10);
gtk_signal_connect(GTK_OBJECT(toplevel), "delete_event",
GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
gtk_widget_set_usize(toplevel, 225, 225);
gtk_widget_realize(toplevel);
win = GDK_WINDOW_XWINDOW(toplevel);
disp = GDK_DISPLAY();
rv = XpmReadFileToPixmap(disp, DefaultRootWindow(disp),
"red.xpm", &pixmap, NULL, NULL);
if (rv != XpmSuccess)
{
fprintf(stderr, "Failed to read xpm file: %s\n",
XpmGetErrorString(rv));
exit(1);
}
gdk_pixmap = gdk_pixmap_foreign_new(pixmap);
gtk_pixmap = gtk_pixmap_new(gdk_pixmap, NULL);
gtk_container_add(GTK_CONTAINER(toplevel), gtk_pixmap);
gtk_widget_show(gtk_pixmap);
gtk_widget_show(toplevel);
gtk_main();
return 0;
}
----- End forwarded message -----
--
Shawn T. Amundson
amundson@gimp.org http://www.gimp.org/~amundson
"The assumption that the universe looks the same in every
direction is clearly not true in reality." - Stephen Hawking
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]