From 1450c37d5bc9288a7148b82ba0f5082d700288b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Wed, 4 Mar 1998 19:15:07 +0100
Subject: [PATCH] Kludge to work with pike-0.5.

Rev: lib/modules/Protocols.pmod/X.pmod/Types.pmod:1.28
Rev: lib/modules/Protocols.pmod/X.pmod/_Types.pmod:1.1
---
 lib/modules/Protocols.pmod/X.pmod/Types.pmod  | 21 +++++++++++++------
 lib/modules/Protocols.pmod/X.pmod/_Types.pmod |  9 ++++++++
 2 files changed, 24 insertions(+), 6 deletions(-)
 create mode 100644 lib/modules/Protocols.pmod/X.pmod/_Types.pmod

diff --git a/lib/modules/Protocols.pmod/X.pmod/Types.pmod b/lib/modules/Protocols.pmod/X.pmod/Types.pmod
index 8c26d219b5..41f5fa2df4 100644
--- a/lib/modules/Protocols.pmod/X.pmod/Types.pmod
+++ b/lib/modules/Protocols.pmod/X.pmod/Types.pmod
@@ -21,8 +21,11 @@ class XResource
   void Free()
   {
     object req = this_object()->FreeRequest();
-    req->id = id;
-    display->send_request( req );
+    if (req)
+      {
+	req->id = id;
+	display->send_request( req );
+      }
   }
 
   void destroy()
@@ -246,6 +249,8 @@ class Colormap
   }
 }
 
+/* Kludge */
+#define PIXMAP (_Types.get_pixmap_class())
 
 class Drawable
 {
@@ -306,7 +311,7 @@ class Drawable
   {
     object req = CreatePixmap_req(width, height, depth);
     display->send_request( req );
-    object p = Pixmap(display, req->pid, this_object(), colormap );
+    object p = PIXMAP(display, req->pid, this_object(), colormap );
     p->depth = depth;
     return p;
   }
@@ -441,7 +446,7 @@ class Window
   inherit Drawable;
   int currentInputMask;
 
-  function FreeRequest = lambda(){}; // FIXME!!
+  function FreeRequest = lambda(){ return 0; }; // FIXME!!
 
   /* Keys are event names, values are arrays of ({ priority, function }) */
   mapping(string:array(array)) event_callbacks = ([ ]);
@@ -653,7 +658,7 @@ class Window
     w->depth = d||depth||this_object()->rootDepth;
     w->colormap = c;
     w->currentInputMask = req->attributes->EventMask;
-    w->attributes = attributes;
+    w->attributes = attributes || ([]);
     return w;
   }
     
@@ -979,4 +984,8 @@ class RootWindow
   }
 }
 
-
+/* Kludge */
+void create()
+{
+  _Types.set_pixmap_class(Pixmap);
+}
diff --git a/lib/modules/Protocols.pmod/X.pmod/_Types.pmod b/lib/modules/Protocols.pmod/X.pmod/_Types.pmod
new file mode 100644
index 0000000000..406a4dd4c6
--- /dev/null
+++ b/lib/modules/Protocols.pmod/X.pmod/_Types.pmod
@@ -0,0 +1,9 @@
+/* _Types.pmod
+ *
+ * Kludge for pike-0.5 */
+
+program pixmap_class;
+
+program get_pixmap_class() { return pixmap_class; }
+
+void set_pixmap_class(program p) { pixmap_class = p; }
-- 
GitLab