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

Alexander Mezin mezin.alexander at gmail.com
Sat Mar 1 09:04:07 PST 2014


2014-03-01 20:42 GMT+07:00 Uli Schlachter <psychon at znc.in>:
> 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

Last time I've seen it there weren't any generic "wrapper" class.
There was support only for calls with xcb_window_t* as first argument,
or something like this. This (with "no more Xlib" rule) stopped me
from working on my latest patch for KWin.

When I tried writing template-based wrapper, I came up with almost the
same code. However, I didn't like the result, and used raw xcb C api
with smart pointers (for replies) in my project.

> 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. :-)
Of course :)
At least, KWin isn't the only C++ project that uses xcb. Reinventing
these wrappers again and again in every project doesn't look good.


More information about the xorg-devel mailing list