[GSoC] Project idea: C++ bindings for XCB

Uli Schlachter psychon at znc.in
Sat Mar 1 05:42:10 PST 2014


Hi,

On 01.03.2014 10:06, Alexander Mezin wrote:
[...]
> I have my own idea for project, not listed on ideas page.
> I want to write C++ binding/wrapper for XCB.
> When I worked on another GSoC project previous year (touchpad
> configuration utility for KDE [1]), I had to work with libxcb from C++
> code.
> I've noticed that libxcb's interface nicely maps to RAII idiom, but
> working with libxcb C API requires a lot of boilerplate code.
> I've found some C++ wrappers for libxcb, but it seems that they aren't
> actively developed.
> 
> I think that the best way is to use xcb protocol descriptions to
> generate C++ wrappers, which will internally use libxcb.
> I don't like templates as much as Boost developers do, so I try to
> avoid them when possible.
> Maybe it would be good to write C++ wrappers for utility libraries also.
[...]

I like this idea. The "nicely maps to RAII idiom" made me remember something
nice that I saw in kwin's source code. They have a "Wrapper" template which does
exactly that:

https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/7bacb97404d9a55194da2490d7266b3264d6638c/entry/kwin/xcbutils.h#L50

I know that your proposal goes way beyond this, but I just wanted to mention the
API that they came up with. Of course, yours will be much nicer. :-)

Good luck and have fun,
Uli
-- 
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.


More information about the xorg-devel mailing list