[Xcb] use of value_mask and value_list parameters
Ian Osgood
iano at quirkster.com
Wed Jul 26 08:13:01 PDT 2006
On Jul 24, 2006, at 1:28 PM, Vincent Torri wrote:
>
> Hey,
>
> I would like a precision about how to usethese 2 parameters.
>
> Suppose that one has 5 possible flags (f0, ..., f4, with value
> 1<<0,... 1<<4) and one wants to set only 2 of them (f1 and f3) to 0
> and 1 respectively.
>
> I would do that :
>
> CARD32 value_mask;
> CARD32 value_list[2]; /* because I want to set 2 flags */
>
> value_mask = f1 | f3;
> value_list[0] = 0;
> value_list[1] = 1;
>
> is it correct ? that is, xcb will check all the set flag (f1 and
> f3) and will use the values in value_list in that precise order.
>
> Now, another question: Suppose that I already have a value for
> value_mask (i don't know which flags are set a priori). Is there an
> easy way to declare correctly value_list and set its values as I
> want (I have all the 5 possible values for f0,...f4, but I want to
> set only those defined in value_mask)
>
> thank you
>
> Vincent
You could take a look at the convenience functions I put in xcb-util
to use structures instead of value lists.
http://gitweb.freedesktop.org/?
p=xcb;a=commitdiff;h=3f9c5d60321237c16e1c855a77ae9b193bd5948d
Ian
More information about the Xcb
mailing list