[PATCH v2 1/4] xkb: factor out the StateNotify flag check

Daniel Stone daniel at fooishbar.org
Mon Mar 3 06:10:56 PST 2014


Hi,

On 3 March 2014 05:44, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> +static int
> +_XkbWantStateNotify(XkbSrvInfoPtr xkbi)
> +{
> +    Bool genStateNotify;
> +
> +    /* The state may change, so if we're not in the middle of sending a state
> +     * notify, prepare for it */
> +    if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) {
> +        xkbi->prev_state = xkbi->state;
> +        xkbi->flags |= _XkbStateNotifyInProgress;
> +        genStateNotify = TRUE;
> +    }
> +    else
> +        genStateNotify = FALSE;
> +
> +    return genStateNotify;
> +}

This would be better with early return, and the function name is also
misleading: something like _XkbEnsureStateChange() or similar would be
nice.

Cheers,
Daniel


More information about the xorg-devel mailing list