# XLib (specifically, the swig xlib wrapper)

**URL:** <https://www.ruby-forum.com/t/xlib-specifically-the-swig-xlib-wrapper/66348>\
**Category:** Ruby\
**Created:** [August 24, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/xlib-specifically-the-swig-xlib-wrapper/66348 "2006-08-24T20:56:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axis\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d07c76/32.png) [@Axis\_S](https://www.ruby-forum.com/u/Axis_S)\
**Post date:** [August 24, 2006, 8:56pm UTC](https://www.ruby-forum.com/t/xlib-specifically-the-swig-xlib-wrapper/66348/1 "2006-08-24T20:56:57Z")

</div>

I want to write a window manager in Ruby (or at least, write some sort  
of prototype to learn how they are made) but all the Xlib bindings  
available are years old and/or incomplete.

One project, however, uses SWIG and is fairly complete (though it is a  
direct translation of the function calls). I could use it, or at least  
turn it into something more ruby-like, but it’s pretty out of date.  
That is, it won’t compile on my machine. I spent a while looking into  
the errors, but I’ve never used SWIG before, so I didn’t get very far.

Would anyone with SWIG experience be willing to bring it up to speed to  
some current-ish version of SWIG? As a head start, there’s a patch that  
does some of the work, though it just gives me different errors.

project page: [Ruby Xlib Wrappers using SWIG download | SourceForge.net](http://sourceforge.net/projects/ruby-xlib-wrap/)

patch:  
[http://sourceforge.net/tracker/index.php?func=detail&aid=756724&group\_id=36722&atid=417702](http://sourceforge.net/tracker/index.php?func=detail&aid=756724&group_id=36722&atid=417702)

Thanks

---

<div class="post-metadata">

**Author:** ![Axis\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d07c76/32.png) [@Axis\_S](https://www.ruby-forum.com/u/Axis_S)\
**Post date:** [August 28, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/xlib-specifically-the-swig-xlib-wrapper/66348/2 "2006-08-28T17:33:15Z")

</div>

On 8/24/06, Axis S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Would anyone with SWIG experience be willing to bring it up to speed to  
> some current-ish version of SWIG? As a head start, there’s a patch that  
> does some of the work, though it just gives me different errors.
> 
> project page: [http://sourceforge.net/projects/ruby-xlib-wrap/](http://sourceforge.net/projects/ruby-xlib-wrap/)
> 
> patch:  
> [Ruby Xlib Wrappers using SWIG / Patches / #2 patch to update Xlib.i and Xutil.i to use SWIG-1.3.19](http://sourceforge.net/tracker/index.php?func=detail&aid=756724&group_id=36722&atid=417702)

Hello

Last time I looked at ruby-xlib-wrap it was far from ideal. The  
problem I found was that some Xlib functions often return repeatedly  
the same pointer/value (ie the value of screen or display normally  
does not change) but swing would wrap it in new objects. This is both  
inefficient and obscures the fact that the value is identical.

I intended to update some of the wrappers that I would need for my  
program but then I found a working solution that was already written  
in C. So I got no swig experience either.

Assuming the state of the library did not change much you would have  
to add some hand-crafted code anyway, so you could as well start  
looking into swig.

I’m looking forward to the ruby wm 🙂

Thanks

Michal

---

<div class="post-metadata">

**Author:** ![Axis\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d07c76/32.png) [@Axis\_S](https://www.ruby-forum.com/u/Axis_S)\
**Post date:** [August 28, 2006, 11:02pm UTC](https://www.ruby-forum.com/t/xlib-specifically-the-swig-xlib-wrapper/66348/3 "2006-08-28T23:02:33Z")

</div>

> > I want to write a window manager in Ruby (or at least, write some sort  
> > of prototype to learn how they are made) but all the Xlib bindings  
> > available are years old and/or incomplete.

My Ruby/Wise is indeed incomplete.  
I have no SWIG experience.

Maybe matju’s binding (not Xlib, talks directly to the Xserver) is of  
use:  
[http://artengine.ca/matju/RubyX11/](http://artengine.ca/matju/RubyX11/)

> I’m looking forward to the ruby wm 🙂

I found out today that wmii plugins are mostly written in Ruby 🙂

and I learned of wmii from dutch.rb (which needs a successor).
