2014-03-01 20:42 GMT+07:00 Uli Schlachter <[email protected]>:
> 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.
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to