X11 binding, XGetWindowProperty, and different behaviour for similar code between D and C++ (D fails)

Simon Gomizelj simongmzlj at gmail.com
Fri Apr 3 01:09:25 PDT 2009


As a personal learning D/learn X11 project, I thought it would be  
interesting to try to port dwm over to D. Building it up nice and slowly,  
right now I'm trying to collect a list of windows and their states a-la  
dwm.c code.

The D code, which is translated from C code, does not work, it returns:
X Error of failed request:  BadValue (integer parameter out of range for  
operation)
   Major opcode of failed request:  20 (X_GetProperty)
   Value in failed request:  0x2
   Serial number of failed request:  29
   Current serial number in output stream:  29

The C++ code, which is the D code translated back, does work. The code  
fails on a call to XGetWindowProperty. Debugging each shows that both the  
C++ and D code pass the same atom, display, and window. Setting  
WM_STATE_ELEMENTS < 2 causes the D code to start to segfault while the C++  
code still seems to work.

The std.c.linux.X11.X and std.c.linux.X11.Xlib modules I grabbed off of  
http://www.dsource.org/projects/bindings/browser/trunk/X11?order=date. The  
rest are hand translated (but unconsequential, XGetWindowProperty is  
contained in Xlib). X.d and Xlib.d look correct enough.

I've spent a full day looking at this code, and I can't seem to determine  
why the D code fails. Anyone have any ideas? Thanks in advance.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Digitalmars-d mailing list