/* This file is part of Furui. Furui is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Furui is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Furui. If not, see . */ #include #include "padkey_pointer.h" void padkey_pointer_initialize(struct padkey_pointer *pointer) { pointer->x_code = ABS_X; pointer->y_code = ABS_Y; pointer->vx = 0; pointer->vy = 0; pointer->charge = 0; pointer->left_code = BTN_TOP; pointer->center_code = BTN_THUMB2; pointer->right_code = BTN_TRIGGER; pointer->wheel_code = BTN_THUMB; pointer->wheel_mode = 0; } void padkey_pointer_update(struct padkey_pointer *pointer, unsigned int type, unsigned int code, int value) { if (type != EV_ABS) { return; } if (code == pointer->x_code) { pointer->vx = (value - 128) * 256; } else if (code == pointer->y_code) { pointer->vy = (value - 128) * 256; } }