[Xcb] second attempt of the keybinding

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Sat May 7 08:33:39 PDT 2005

On Sat, 7 May 2005, Jamey Sharp wrote:

> On Sat, 2005-05-07 at 08:15 +0200, Vincent Torri wrote:
> > Here is my second attempt. If you think it looks good, i can ad it into
> > the cvs
> The xcb-util module is all highly experimental stuff, at least for the
> moment. Commit anything you want to it; that's what we gave you commit
> rights for. :-)
> That said, I'd encourage a couple more little adjustments, which I'll
> list here.
> Currently keybinding.h declares enum tag_t and struct _XCBKeySymbols.
> I'd move both declarations to the .c file, as no caller of this library
> needs them. (The "typedef struct _XCBKeySymbols XCBKeySymbols;"
> obviously still needs to be in the .h file.)
> The Alloc function should have a corresponding Free function.
> The XCBKeySymbolsGetReply isn't needed now, at least not as a public
> function. It may make sense to just turn it into a static function and
> call it from the other public functions though.
> The trouble with that is what to do with the XCBGenericError return; but
> the answer is that the only error the server is specified to return is
> BadValue, and that only if we query the mapping of a keycode outside the
> range specified in the server connection setup data. As long as we just
> don't do that, all errors may just as well be reported straight to the
> application; we won't be interested in trapping any of them. So you
> should ignore X errors everywhere in this code.
> Functions like XCBKeySymbolsGetKeysym shouldn't fail when handed a
> KeySymbols object with a cookie in it; instead they should convert the
> cookie to a reply and process that.
> Finally, XCBRefreshKeyboardMapping won't work as coded. It should
> contain code more like this:
> 	if(syms->tag == TAG_VALUE)
> 	{
> 		free(syms->u.reply);
> 		syms->tag = TAG_COOKIE;
> 		syms->u.cookie = /* same as in Alloc function */
> 	}
> That's how you transition back into having a cookie instead of a reply.
> That's it! Your code looks good. Like I said, commit whenever you
> want. :-)

Well, it's commited, in xcb-utils/keysyms



More information about the xcb mailing list