d-programming-deimos / libx11 Goto Github PK
View Code? Open in Web Editor NEWCore X11 protocol client library.
License: GNU Lesser General Public License v3.0
Core X11 protocol client library.
License: GNU Lesser General Public License v3.0
Now it has follow declaration:
struct XIValuatorState{
int mask_len;
ubyte mask;
double* values;
}
mask should be a pointer.
XISetMask
XIClearMask
XIMaskIsSet
XIMaskLen
These macros are strange templates with string argument. I thing they should be simple functions for example:
void XISetMask(ubyte[] mask, uint event) {
mask[event >> 3] |= 1 << (event & 7);
}
Currently the structure looks like:
struct XSizeHints {
c_long flags;
int x, y;
int width, height;
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct min_aspect {
int x;
int y;
};
struct max_aspect {
int x;
int y;
};
int base_width, base_height;
int win_gravity;
}
Which, when tested is 64 bytes on 64bit Linux (DMD). The original C structure in Xutils.h however is 80 bytes on the same machine (GCC). That's because min_aspect/max_aspect are only type declarations. The D structure should look like:
struct XSizeHints {
c_long flags;
int x, y;
int width, height;
int min_width, min_height;
int max_width, max_height;
int width_inc, height_inc;
struct aspect {
int x, y;
}
aspect min_aspect, max_aspect;
int base_width, base_height;
int win_gravity;
}
There may be similar issues with other sub-struct types in Deimos/libX11, but I haven't searched for them yet.
The result is two main() and failed build.
I am on 32-bit ubuntu 11.04 and libX11 refuses to build at xlibint.d it says undefined identifier long64. I am using a completely vanilla version of dmd 2.058
Building a file which shows Hello World (hiworld.d) in Mac OS 10.7:
$ dmd hiworld.d -I'libX11' libX11/lib/libDX11-dmd.a
ld: warning: ignoring file libX11/lib/libDX11-dmd.a, file was built for archive which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_XCloseDisplay", referenced from:
__Dmain in hiworld.o
"_XMapWindow", referenced from:
__Dmain in hiworld.o
"_D6deimos3X114Xlib6XEvent6__initZ", referenced from:
__Dmain in hiworld.o
"_XOpenDisplay", referenced from:
__Dmain in hiworld.o
"_RootWindow", referenced from:
__Dmain in hiworld.o
"_XDrawString", referenced from:
__Dmain in hiworld.o
"_DefaultScreen", referenced from:
__Dmain in hiworld.o
"_BlackPixel", referenced from:
__Dmain in hiworld.o
"_DefaultGC", referenced from:
__Dmain in hiworld.o
"_WhitePixel", referenced from:
__Dmain in hiworld.o
"_XFillRectangle", referenced from:
__Dmain in hiworld.o
"_XCreateSimpleWindow", referenced from:
__Dmain in hiworld.o
--- errorlevel 1
"_XSelectInput", referenced from:
__Dmain in hiworld.o
"_XNextEvent", referenced from:
__Dmain in hiworld.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
When building with dmd 2.0.66.1 I get the following errors:
deimos/X11/Xproto.d(967): Deprecation: variable deimos.X11.Xproto._xEvent.u.enterLeave.ELFlagFocus const field with initializer should be static, __gshared, or an enum
deimos/X11/Xproto.d(968): Deprecation: variable eimos.X11.Xproto._xEvent.u.enterLeave.ELFlagSameScreen const field with initializer should be static, __gshared, or an enum
Using gdc-4.6 from Ubuntu 11.10 repos.
$ make DC=gdc
Makefile:159: warning: overriding commands for target install' Makefile:156: warning: ignoring old commands for target
install'
gdc -O2 -fdeprecated -m64 -Xlinker-ldl -m64 -c deimos/X11/Xlib.d -obuild/deimos/X11/Xlib.o
gdc: error: unrecognized option โ-Xlinker-ldlโ
make: *** [build/deimos/X11/Xlib.o] Error 1
Adding platform="linux"
to the dub file does not make it skip on non-Linux targets, and will ask for "x11.lib".
This should be a trivial fix that I'll submit soon.
In Xproto.d some types from X.d and Xatom.d are redefined using alias which causes conflicts.
This works in Xproto.h because the alias is a #define and the types are all #undef at the end of the include file.
The following snippet is from Xproto.d, which lists the conflicting types.
/* For the purpose of the structure definitions in this file,
we must redefine the following types in terms of Xmd.h's types, which may
include bit fields. All of these are #undef'd at the end of this file,
restoring the definitions in X.h. */
alias CARD32 Window;
alias CARD32 Drawable;
alias CARD32 Font;
alias CARD32 Pixmap;
alias CARD32 Cursor;
alias CARD32 Colormap;
alias CARD32 GContext;
alias CARD32 Atom;
alias CARD32 VisualID;
alias CARD32 Time;
alias CARD8 KeyCode;
alias CARD32 KeySym;
I get this error:
deimos/X11/Xlibint.d(895): Error: Function type does not match
previously declared function with the same mangled name: Data
while building with the latest ldc2 as default compiler. Building with dmd 2.063.2 works fine.
see more in this thread: http://forum.dlang.org/thread/[email protected]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.