Lines Matching refs:tool

239 	/* tool_id is the identifier for the tool we can use in libwacom
320 enum libinput_tablet_tool_type tool,
323 assert(tool != LIBINPUT_TOOL_NONE);
326 tablet->current_tool.type = tool;
353 struct libinput_tablet_tool *tool)
366 int base = tool->pressure.threshold.lower;
485 struct libinput_tablet_tool *tool,
494 /* When tool contact changes, we probably got a cursor jump. Don't
521 tool,
528 struct libinput_tablet_tool *tool)
538 tablet->axes.pressure = normalize_pressure(absinfo, tool);
639 * already normalized and set if we have the mouse/lens tool */
706 struct libinput_tablet_tool *tool,
720 tablet_update_pressure(tablet, device, tool);
726 * already normalized and set if we have the mouse/lens tool */
741 /* The tool position often jumps to a different spot when contact changes.
742 * If tool contact changes, clear the history to prevent axis smoothing
753 axes.delta = tablet_tool_process_delta(tablet, tool, device, &axes, time);
829 "Invalid tool 'finger' on tablet interface\n");
917 struct libinput_tablet_tool *tool,
921 set_bit(tool->axis_caps, axis);
926 struct libinput_tablet_tool *tool,
931 set_bit(tool->buttons, button);
937 struct libinput_tablet_tool *tool)
950 s = libwacom_stylus_get_for_id(db, tool->tool_id);
959 copy_button_cap(tablet, tool, code);
962 copy_button_cap(tablet, tool, BTN_STYLUS2);
964 copy_button_cap(tablet, tool, BTN_STYLUS);
968 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL);
975 set_bit(tool->axis_caps,
979 tool,
982 tool,
987 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
989 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE);
991 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER);
993 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE);
1003 struct libinput_tablet_tool *tool)
1005 enum libinput_tablet_tool_type type = tool->type;
1007 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_X);
1008 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_Y);
1011 if (tool_set_bits_from_libwacom(tablet, tool) == 0)
1015 tablet onto the tool. Except we know that mice only have rotation
1024 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE);
1025 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE);
1026 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_X);
1027 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y);
1028 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER);
1039 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
1043 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
1044 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL);
1058 copy_button_cap(tablet, tool, BTN_STYLUS);
1059 copy_button_cap(tablet, tool, BTN_STYLUS2);
1063 copy_button_cap(tablet, tool, BTN_LEFT);
1064 copy_button_cap(tablet, tool, BTN_MIDDLE);
1065 copy_button_cap(tablet, tool, BTN_RIGHT);
1066 copy_button_cap(tablet, tool, BTN_SIDE);
1067 copy_button_cap(tablet, tool, BTN_EXTRA);
1082 struct libinput_tablet_tool *tool)
1091 tool->pressure.offset = 0;
1092 tool->pressure.has_offset = false;
1103 tool->pressure.offset = pressure->minimum;
1104 tool->pressure.heuristic_state = PRESSURE_HEURISTIC_STATE_DONE;
1106 tool->pressure.offset = pressure->maximum;
1107 tool->pressure.heuristic_state = PRESSURE_HEURISTIC_STATE_PROXIN1;
1124 tool->pressure.threshold.upper = hi;
1125 tool->pressure.threshold.lower = lo;
1137 struct libinput_tablet_tool *tool = NULL, *t;
1142 /* Check if we already have the tool in our list of tools */
1145 tool = t;
1151 /* If we get a tool with a delayed serial number, we already created
1152 * a 0-serial number tool for it earlier. Re-use that, even though
1153 * it means we can't distinguish this tool from others.
1156 if (!tool) {
1160 * into proximity of instead of storing them in the global tool
1166 tool = t;
1171 /* Didn't find the tool but we have a serial. Switch
1173 if (!tool && serial)
1179 if (!tool) {
1180 tool = zalloc(sizeof *tool);
1182 *tool = (struct libinput_tablet_tool) {
1189 tool_set_pressure_thresholds(tablet, tool);
1190 tool_set_bits(tablet, tool);
1192 list_insert(tool_list, &tool->link);
1195 return tool;
1202 struct libinput_tablet_tool *tool,
1222 tool,
1234 struct libinput_tablet_tool *tool,
1247 tool,
1254 struct libinput_tablet_tool *tool)
1275 tool_in_contact = (pressure->value > tool->pressure.threshold.lower);
1314 struct libinput_tablet_tool *tool)
1316 sanitize_pressure_distance(tablet, tool);
1321 set_pressure_offset(struct libinput_tablet_tool *tool, int offset)
1323 tool->pressure.offset = offset;
1324 tool->pressure.has_offset = true;
1330 int gap = tool->pressure.threshold.upper - tool->pressure.threshold.lower;
1331 tool->pressure.threshold.lower = offset;
1332 tool->pressure.threshold.upper = offset + gap;
1338 struct libinput_tablet_tool *tool)
1356 if (tool->pressure.has_offset) {
1357 if (offset < tool->pressure.offset)
1358 set_pressure_offset(tool, offset);
1359 } else if (tool->pressure.heuristic_state != PRESSURE_HEURISTIC_STATE_DONE) {
1360 tool->pressure.offset = min(offset, tool->pressure.offset);
1367 struct libinput_tablet_tool *tool)
1372 if (tool->pressure.has_offset ||
1399 tool->pressure.offset = min(offset, tool->pressure.offset);
1401 switch (tool->pressure.heuristic_state) {
1404 tool->pressure.heuristic_state++;
1407 tool->pressure.heuristic_state++;
1408 offset = tool->pressure.offset;
1420 "Ignoring pressure offset greater than 50%% detected on tool %s (serial %#x). "
1422 tablet_tool_type_to_string(tool->type),
1423 tool->serial,
1429 "Pressure offset detected on tool %s (serial %#x). "
1431 tablet_tool_type_to_string(tool->type),
1432 tool->serial,
1435 set_pressure_offset(tool, offset);
1441 struct libinput_tablet_tool *tool)
1446 if (!bit_is_set(tool->axis_caps, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE))
1466 if (pressure <= tool->pressure.threshold.lower &&
1469 } else if (pressure >= tool->pressure.threshold.upper &&
1477 struct libinput_tablet_tool *tool)
1480 sizeof(tool->axis_caps),
1484 tool->axis_caps,
1491 struct libinput_tablet_tool *tool)
1514 tablet_mark_all_axes_changed(tablet, tool);
1610 struct libinput_tablet_tool *tool,
1620 tool,
1636 struct libinput_tablet_tool *tool,
1646 tool,
1663 struct libinput_tablet_tool *tool,
1671 tool,
1689 tool,
1709 struct libinput_tablet_tool *tool,
1727 tool,
1739 struct libinput_tablet_tool *tool,
1747 tool,
1756 tool,
1764 struct libinput_tablet_tool *tool,
1781 if (tablet_check_notify_axes(tablet, device, tool, &axes, time))
1788 tablet_send_proximity_in(tablet, tool, device, &axes, time);
1789 if (!tablet_send_tip(tablet, tool, device, &axes, time))
1790 tablet_send_axes(tablet, tool, device, &axes, time);
1795 tablet_send_buttons(tablet, tool, device, time);
1797 if (tablet_send_proximity_out(tablet, tool, device, &axes, time)) {
1842 /* we were already out of proximity but now got a tool update but
1843 * our tool state is zero - i.e. we got a valid prox out from the
1856 * BTN_TOOL_PEN and the state for the tool was 0, this device will
1895 /* The new tool is the pen. Ignore it */
1901 /* The new tool is some tool other than pen (usually eraser).
1902 * We set the current tool state to zero, thus setting
1903 * everything up for a prox out on the tool. Once that is set
1904 * up, we change the tool state to be the new one we just got.
1905 * When we re-process this function we now get the new tool
1962 struct libinput_tablet_tool *tool;
1968 tool = tablet_get_current_tool(tablet);
1969 if (!tool)
1972 if (tool->type == LIBINPUT_TABLET_TOOL_TYPE_MOUSE ||
1973 tool->type == LIBINPUT_TABLET_TOOL_TYPE_LENS)
1974 tablet_update_proximity_state(tablet, device, tool);
1989 tablet_mark_all_axes_changed(tablet, tool);
1990 update_pressure_offset(tablet, device, tool);
1991 detect_pressure_offset(tablet, device, tool);
1992 detect_tool_contact(tablet, device, tool);
1993 sanitize_tablet_axes(tablet, tool);
1995 update_pressure_offset(tablet, device, tool);
1996 detect_tool_contact(tablet, device, tool);
1997 sanitize_tablet_axes(tablet, tool);
2000 tablet_send_events(tablet, tool, device, time);
2184 struct libinput_tablet_tool *tool;
2190 list_for_each_safe(tool, &tablet->tool_list, link) {
2191 libinput_tablet_tool_unref(tool);
2300 enum libinput_tablet_tool_type tool;
2302 for (tool = LIBINPUT_TABLET_TOOL_TYPE_PEN;
2303 tool <= LIBINPUT_TABLET_TOOL_TYPE_MAX;
2304 tool++) {
2305 code = tablet_tool_to_evcode(tool);
2307 /* we only expect one tool to be in proximity at a time */
2312 tablet->tool_state = bit(tool);
2313 tablet->prev_tool_state = bit(tool);
2321 tablet_update_tool(tablet, device, tool, state);
2400 * wanting to use the mouse/lens cursor tool is small enough to not