static void handle_gestures(LocalDevicePtr local, struct Gestures* gs) { struct MTouch *mt = local->private; static bitmask_t buttons_prev = 0U; int i; if(mt->absolute_mode == FALSE){ if (mt->cfg.scroll_smooth){ /* Copy states from button_prev into current buttons state */ MODBIT(gs->buttons, 3, GETBIT(buttons_prev, 3)); MODBIT(gs->buttons, 4, GETBIT(buttons_prev, 4)); MODBIT(gs->buttons, 5, GETBIT(buttons_prev, 5)); MODBIT(gs->buttons, 6, GETBIT(buttons_prev, 6)); set_and_post_mask(mt, local->dev, timertoms(&gs->dt)); } else{ // mt->absolute_mode == FALSE if (gs->move_dx != 0 || gs->move_dy != 0) xf86PostMotionEvent(local->dev, 0, 0, 2, gs->move_dx, gs->move_dy); } } else{ /* Give the HW coordinates to Xserver as absolute coordinates, these coordinates * are not scaled, this is oke if the touchscreen has the same resolution as the display. */ xf86PostMotionEvent(local->dev, 1, 0, 2, mt->state.touch[0].x + get_cap_xmid(&mt->caps), mt->state.touch[0].y + get_cap_ymid(&mt->caps)); } for (i = 0; i < 32; i++) { if (GETBIT(gs->buttons, i) == GETBIT(buttons_prev, i)) continue; if (GETBIT(gs->buttons, i)) { xf86PostButtonEvent(local->dev, FALSE, i+1, 1, 0, 0); #define DEBUG_DRIVER 0 #if DEBUG_DRIVER xf86Msg(X_INFO, "button %d down\n", i+1); #endif } else { xf86PostButtonEvent(local->dev, FALSE, i+1, 0, 0, 0); #if DEBUG_DRIVER xf86Msg(X_INFO, "button %d up\n", i+1); #endif #undef DEBUG_DRIVER } } buttons_prev = gs->buttons; }
static void handle_gestures(LocalDevicePtr local, const struct Gestures* gs) { const struct MTouch *mt = local->private; static bitmask_t buttons_prev = 0U; int i; int sendMotionEvent = FALSE; for (i = 0; i < 32; i++) { if (GETBIT(gs->buttons, i) == GETBIT(buttons_prev, i)) continue; if (GETBIT(gs->buttons, i)) { xf86PostButtonEvent(local->dev, FALSE, i+1, 1, 0, 0); sendMotionEvent = TRUE; #if DEBUG_DRIVER xf86Msg(X_INFO, "button %d down\n", i+1); #endif } else { xf86PostButtonEvent(local->dev, FALSE, i+1, 0, 0, 0); sendMotionEvent = TRUE; #if DEBUG_DRIVER xf86Msg(X_INFO, "button %d up\n", i+1); #endif } } buttons_prev = gs->buttons; if (gs->move_dx != 0 || gs->move_dy != 0){ sendMotionEvent = TRUE; if(mt->cfg.absolute_mode == FALSE) xf86PostMotionEvent(local->dev, 0, 0, 2, gs->move_dx, gs->move_dy); } /* Give the HW coordinates to Xserver as absolute coordinates, these coordinates * are not scaled, this is oke if the touchscreen has the same resolution as the display. */ if(mt->cfg.absolute_mode == TRUE && sendMotionEvent == TRUE) xf86PostMotionEvent(local->dev, 1, 0, 2, mt->state.touch[0].x, mt->state.touch[0].y); }
static void CommitResult(InputInfoPtr pInfo, SynaptixResultPtr result) { int i; unsigned char bit; result->left = CommitButtonWithBitField(pInfo,1,result->left); result->right = CommitButtonWithBitField(pInfo,3,result->right); result->middle = CommitButtonWithBitField(pInfo,2,result->middle); if (pInfo->dev->valuator->mode == Relative && ( result->delta_x || result->delta_y )) { xf86PostMotionEvent(pInfo->dev, FALSE, 0, 2, result->delta_x, result->delta_y); } else if (pInfo->dev->valuator->mode == Absolute && result->abs_x >= 0 && result->abs_y >= 0) { xf86PostMotionEvent(pInfo->dev, TRUE, 0, 2, result->abs_x, result->abs_y); } result->abs_x = result->abs_y = -1; result->delta_x = result->delta_y = 0; CommitScrollEvent(pInfo,result->delta_z,5,4); CommitScrollEvent(pInfo,result->delta_w,7,6); result->delta_z = result->delta_w = 0; bit=1; for (i=0; i<8;i++) { xf86PostButtonEvent(pInfo->dev, FALSE, 0, 8+i, result->extra&bit? 1 : 0, 0, 0); bit<<=1; } result->handled_level=0; // TODO : commit extra buttons. }