On Thu, Jun 09, 2011 at 08:57:33PM +0100, Daniel Stone wrote: > Instead of a combined variable declaration with two ternary expressions > using raw hex values, expand it to have two genuine if statements, > setting with a more clear bitshift. > > Signed-off-by: Daniel Stone <[email protected]> > --- > src/synaptics.c | 8 ++++++-- > 1 files changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/synaptics.c b/src/synaptics.c > index d732f8a..488354f 100644 > --- a/src/synaptics.c > +++ b/src/synaptics.c > @@ -2500,8 +2500,12 @@ repeat_scrollbuttons(const InputInfoPtr pInfo, > SynapticsPrivate *priv = (SynapticsPrivate *) (pInfo->private); > SynapticsParameters *para = &priv->synpara; > int repeat_delay, timeleft; > - int rep_buttons = ((para->updown_button_repeat ? 0x18 : 0) | > - (para->leftright_button_repeat ? 0x60 : 0)); > + int rep_buttons = 0; > + > + if (para->updown_button_repeat) > + rep_buttons |= (1 << (4 - 1) | (1 << 5 - 1)); > + if (para->leftright_button_repeat) > + rep_buttons |= (1 << (6 - 1) | (1 << 7 - 1));
The original version had the advantage of being correct though ;) rep_buttons |= (1 << (4 - 1)) | (1 << (5 - 1)); rep_buttons |= (1 << (6 - 1)) | (1 << (7 - 1)); Reviewed-by: Peter Hutterer <[email protected]> with this change I do have to wonder if this part has seen any testing given that you'd always set buttons with this code. but then again, I guess none of us still have touchpads with hardware scrollbuttons, so... Cheers, Peter > > /* Handle auto repeat buttons */ > repeat_delay = clamp(para->scroll_button_repeat, SBR_MIN, SBR_MAX); > -- > 1.7.5.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
