@@ -1051,11 +1051,10 @@ class Drawable
10511051 function CreatePixmapFromBuffer(string buffer)
10521052 {
10531053 var display = self.display;
1054- int pixmap = display._CreatePixmapFromBuffer(self.xdrawable, buffer);
1055- if (pixmap != None) {
1056- var result = new Drawable;
1057- result.display = display;
1058- result.xdrawable = pixmap;
1054+ int xpixmap = display._CreatePixmapFromBuffer(self.xdrawable, buffer);
1055+ if (xpixmap != None) {
1056+ var result = new Pixmap;
1057+ result._set(display, xpixmap);
10591058 return result;
10601059 }
10611060 else
@@ -1086,11 +1085,28 @@ class Drawable
10861085
10871086class Pixmap : Drawable
10881087{
1088+ function Pixmap(from, int width, int height, int depth[optional], int has_depth[opt_flag])
1089+ {
1090+ self.display = from.display;
1091+ if (! has_depth)
1092+ depth = display.DefaultDepth(display.DefaultScreen());
1093+ int xpixmap = getfun("XCreatePixmap")
1094+ (from.display, from.xdrawable, width, height, depth);
1095+ self.xdrawable = xpixmap;
1096+ }
10891097 // Internal only - construct from a X Pixmap
10901098 function _set(display, int xpixmap)
10911099 {
10921100 self.display = display;
1093- self.drawable = xpixmap;
1101+ self.xdrawable = xpixmap;
1102+ }
1103+ function Free()
1104+ {
1105+ int xdrawable = self.xdrawable;
1106+ if (xdrawable != None) {
1107+ getfun("XFreePixmap")(self.display.xdisplay, self.xdrawable);
1108+ self.xdrawable =: None;
1109+ }
10941110 }
10951111}
10961112
0 commit comments