/* send a button event */ static void wcmSendButtonClick(WacomDevicePtr priv, int button, int state) { int mode = is_absolute(priv->pInfo); /* send button event in state */ xf86PostButtonEventP(priv->pInfo->dev, mode,button, state,0,0,0); /* We have changed the button state (from down to up) for the device * so we need to update the record */ if (button == 1) priv->oldState.buttons = 0; }
static void process_state(InputInfoPtr local, const struct mtev_mtouch *mt) { const struct mtev_touch_point *tp; static int pdown = 0; int valuators[MAX_VALUATORS]; int down; int valix; int contacts; contacts = valix = down = 0; while ((tp = mtouch_get_contact(mt, contacts)) != NULL) { contacts++; // We don't do remapping of tracking id's so // make sure clients don't see too high tracking_id numbers if (tp->tracking_id < MT_NUM_FINGERS) { int x; int y; x = tp->position_x; y = tp->position_y; if (mt->swap_xy) { const int tmp = y; y = x; x = tmp; } if (mt->invert_x) x = mt->max_x - x + mt->min_x; if (mt->invert_y) y = mt->max_y - y + mt->min_y; valuators[valix++] = x; valuators[valix++] = y; valuators[valix++] = tp->touch_major; if (mt->caps.has_touch_minor) valuators[valix++] = tp->touch_minor; else valuators[valix++] = tp->touch_major; valuators[valix++] = tp->tracking_id; down++; } // Don't deliver more than MaxContacts if (down >= MT_NUM_FINGERS) break; } /* Some x-clients assume they get motion events before button down */ if (down) xf86PostMotionEventP(local->dev, TRUE, 0, down * MT_AXIS_PER_FINGER, valuators); if(down && pdown == 0) xf86PostButtonEventP(local->dev, TRUE, 1, 1, 0, down * MT_AXIS_PER_FINGER, valuators); else if (down == 0 && pdown) xf86PostButtonEvent(local->dev, TRUE, 1, 0, 0, 0); pdown = !!down; }