[patch] compiling GTK+ w/o X



Hi,

the following small patch is necessary to compile GTK+ including
all tests without having X installed. Please review...


Salut, Sven

Index: demos/testpixbuf-drawable.c
===================================================================
RCS file: /cvs/gnome/gtk+/demos/testpixbuf-drawable.c,v
retrieving revision 1.13
diff -u -r1.13 testpixbuf-drawable.c
--- demos/testpixbuf-drawable.c	2001/02/03 01:09:37	1.13
+++ demos/testpixbuf-drawable.c	2001/03/15 03:43:38
@@ -1,6 +1,6 @@
 #include <config.h>
 #include <gtk/gtk.h>
-#include <gdk/x11/gdkx.h>
+#include <gdk/gdkprivate.h>
 
 int close_app(GtkWidget *widget, gpointer data)
 {
@@ -53,11 +53,9 @@
    g_print("X:%d Y:%d\n", evt->width, evt->height);
    if(evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
    {
-      GdkWindow *root;
       GdkPixbuf *new_pixbuf;
 
-      root = GDK_ROOT_PARENT();
-      new_pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
+      new_pixbuf = gdk_pixbuf_get_from_drawable(NULL, gdk_parent_root, NULL,
 						0, 0, 0, 0, evt->width, evt->height);
       gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", new_pixbuf);
       gdk_pixbuf_unref(pixbuf);
@@ -69,8 +67,7 @@
 extern void pixbuf_init();
 
 int main(int argc, char **argv)
-{   
-   GdkWindow     *root;
+{
    GtkWidget     *window;
    GtkWidget     *vbox;
    GtkWidget     *drawing_area;
@@ -84,8 +81,7 @@
 
    gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
 
-   root = GDK_ROOT_PARENT();
-   pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
+   pixbuf = gdk_pixbuf_get_from_drawable(NULL, gdk_parent_root, NULL,
 					 0, 0, 0, 0, 150, 160);
    
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
Index: demos/testpixbuf-save.c
===================================================================
RCS file: /cvs/gnome/gtk+/demos/testpixbuf-save.c,v
retrieving revision 1.2
diff -u -r1.2 testpixbuf-save.c
--- demos/testpixbuf-save.c	2001/02/08 23:36:50	1.2
+++ demos/testpixbuf-save.c	2001/03/15 03:43:38
@@ -1,7 +1,6 @@
 
 #include <config.h>
-/* if building outside GTK, remove /x11 part */
-#include <gdk/x11/gdkx.h>
+#include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
 #include <stdio.h>
 
@@ -95,11 +94,9 @@
     
         g_print ("X:%d Y:%d\n", evt->width, evt->height);
         if (evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf)) {
-                GdkWindow *root;
                 GdkPixbuf *new_pixbuf;
-
-                root = GDK_ROOT_PARENT ();
-                new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
+                
+                new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, gdk_parent_root, NULL,
                                                            0, 0, 0, 0, evt->width, evt->height);
                 gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", new_pixbuf);
                 gdk_pixbuf_unref (pixbuf);
@@ -110,8 +107,7 @@
 
 int
 main (int argc, char **argv)
-{   
-        GdkWindow     *root;
+{
         GtkWidget     *window;
         GtkWidget     *vbox;
         GtkWidget     *drawing_area;
@@ -120,9 +116,8 @@
         gtk_init (&argc, &argv);   
 
         gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
-
-        root = GDK_ROOT_PARENT ();
-        pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
+        
+        pixbuf = gdk_pixbuf_get_from_drawable (NULL, gdk_parent_root, NULL,
                                                0, 0, 0, 0, 150, 160);
    
         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]