[Xcb] Re: very first attempt of the keybinding

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Fri May 6 22:18:28 PDT 2005



On Fri, 6 May 2005, Jamey Sharp wrote:

> On Fri, 2005-05-06 at 21:09 +0200, Vincent Torri wrote:
> > I create a tagged XCBKeySymbolsCookie structure
> > XCBKeySymbols is a function that returns it. It calls
> > XCBGetKeyboardMapping and init the structure.
> >
> > but what would return XCBKeySymbolsReply ? the XCBKeySymbolsCookie ? this
> > one appears in the prototype and should not be passed as a reference
> > (like a standard reply prototype).
> > So, returning it is the only way that i have to get the reply. But then,
> > the "cookie" would appear twice (in the prototype and as the returned
> > value). In addition, the name is not good for the reply function.
>
> I was suggesting exposing only one structure: no distinction between
> "cookie" and "reply". Note that the tagged unions I mentioned each can
> hold both a cookie and a reply (just not at the same time).
>
> This structure would hold the state of the KeySymbols library, and a
> pointer to it would be passed to each of the calls. Maybe it'd help to
> think of it like the 'this' pointer in languages like C++ and Java?
>
> So I'd propose function signatures like these:
>
> XCBKeySymbols *XCBKeySymbolsAlloc(XCBConnection *c);
> void XCBKeySymbolsFree(XCBKeySymbols *syms);
>
> XCBKEYSYM XCBKeySymbolsGetKeysym(XCBKeySymbols *syms,
>                                  XCBKEYCODE     keycode,
>                                  int            col);
> void XCBRefreshKeyboardMapping(XCBKeySymbols         *syms,
>                                XCBMappingNotifyEvent *event);
>

yes, it does. I see what i was missing. Thank you !

Vincent


More information about the xcb mailing list