Comment 43 for bug 1026046

Revision history for this message
Bryan (poli0048) wrote :

Hi Pierre. Thank you for taking the time to create a patch.

My biggest change was moving the following up in the HandleState function, so the low level state is corrected *before* doing button detection (this removed the quirk that depended on the order in which fingers hit the touchpad):

//Correct HW state by throwing out fingers outside of the active area
    inside_active_area = FALSE;
    hw->numFingers = 0;
    for (int i = 0; i < hw->num_mt_mask; i++) {
        ValuatorMask *f1;
        Bool mt_inside;
        double x1, y1;

        if (hw->slot_state[i] == SLOTSTATE_EMPTY || hw->slot_state[i] == SLOTSTATE_CLOSE)
            continue;

        f1 = hw->mt_mask[i];
        x1 = valuator_mask_get_double(f1, 0);
        y1 = valuator_mask_get_double(f1, 1);
        mt_inside = is_inside_active_area(priv, x1, y1);
        if (!mt_inside) {
            hw->slot_state[i] = SLOTSTATE_EMPTY;
            continue;
        }
        if (!inside_active_area) {
            inside_active_area = TRUE;
            hw->x = x1;
            hw->y = y1;
        }
        hw->numFingers++;
    }

You may notice that I removed the check to see if the touchpad is a clickpad - I did this because it did not look like the code was being executed. You could put that back in (turned out I was not actually replacing the installed driver when I did "make install").

Secondly, I also removed something odd from is_inside_active_area. That function now looks like:

static Bool is_inside_active_area(SynapticsPrivate * priv, int x, int y) {
 if ((priv->synpara.area_left_edge != 0) && (x < priv->synpara.area_left_edge))
  return FALSE;
 else if ((priv->synpara.area_right_edge != 0) && (x > priv->synpara.area_right_edge))
  return FALSE;

 if ((priv->synpara.area_top_edge != 0) && (y < priv->synpara.area_top_edge))
  return FALSE;
 else if ((priv->synpara.area_bottom_edge != 0) && (y > priv->synpara.area_bottom_edge))
  return FALSE;

 return TRUE;
}

I did this mainly because the code that was there was not consistent with how the function is being used now - it would return true in circumstances when the source finger was NOT in the active area but if something else was (which could mess up the finger count). I don't think I tried the first change without the second, but it is certainly plausible that the second change could fix the type of behavior you are talking about. I have not seen such behavior on my machine with these changes.

It seems suspicious that the patched driver would result in no changes. I would make sure that you are actually running your custom version of the driver and not the stock version. Try to break something deliberately - I would suggest putting:

if (hw->numFingers > 1) hw->numFingers = 1;

After the first change and try to run the new driver. If two-finger scroll still works you know that you are running the old driver.

Bryan