Skip to content

Commit

Permalink
fix and update input calibration code
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed May 15, 2024
1 parent 240828e commit 8691e08
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions calibration.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ static void manager_send_device(struct input_calibration_manager_v1 *manager,
ext_input_calibration_manager_v1_send_add(manager_resource, device_resource);

ext_input_device_v1_send_name(device_resource, input_device->device->name);
ext_input_device_v1_send_product(device_resource, input_device->device->product);
ext_input_device_v1_send_vendor(device_resource, input_device->device->vendor);
ext_input_device_v1_send_type(device_resource, input_device->device->type);

Expand Down
3 changes: 2 additions & 1 deletion protocol/input_calibration.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ static const struct wl_message ext_input_device_v1_events[] = {
{ "removed", "", ext_input_device_calibration_unstable_v1_types + 0 },
{ "name", "s", ext_input_device_calibration_unstable_v1_types + 0 },
{ "vendor", "u", ext_input_device_calibration_unstable_v1_types + 0 },
{ "product", "u", ext_input_device_calibration_unstable_v1_types + 0 },
{ "type", "i", ext_input_device_calibration_unstable_v1_types + 0 },
};

WL_PRIVATE const struct wl_interface ext_input_device_v1_interface = {
"ext_input_device_v1", 1,
3, ext_input_device_v1_requests,
4, ext_input_device_v1_events,
5, ext_input_device_v1_events,
};

19 changes: 18 additions & 1 deletion protocol/input_calibration.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ struct ext_input_device_v1_interface {
#define EXT_INPUT_DEVICE_V1_REMOVED 0
#define EXT_INPUT_DEVICE_V1_NAME 1
#define EXT_INPUT_DEVICE_V1_VENDOR 2
#define EXT_INPUT_DEVICE_V1_TYPE 3
#define EXT_INPUT_DEVICE_V1_PRODUCT 3
#define EXT_INPUT_DEVICE_V1_TYPE 4

/**
* @ingroup iface_ext_input_device_v1
Expand All @@ -262,6 +263,10 @@ struct ext_input_device_v1_interface {
* @ingroup iface_ext_input_device_v1
*/
#define EXT_INPUT_DEVICE_V1_VENDOR_SINCE_VERSION 1
/**
* @ingroup iface_ext_input_device_v1
*/
#define EXT_INPUT_DEVICE_V1_PRODUCT_SINCE_VERSION 1
/**
* @ingroup iface_ext_input_device_v1
*/
Expand Down Expand Up @@ -315,6 +320,18 @@ ext_input_device_v1_send_vendor(struct wl_resource *resource_, uint32_t vendor)
wl_resource_post_event(resource_, EXT_INPUT_DEVICE_V1_VENDOR, vendor);
}

/**
* @ingroup iface_ext_input_device_v1
* Sends an product event to the client owning the resource.
* @param resource_ The client's resource
* @param vendor input product
*/
static inline void
ext_input_device_v1_send_product(struct wl_resource *resource_, uint32_t vendor)
{
wl_resource_post_event(resource_, EXT_INPUT_DEVICE_V1_PRODUCT, vendor);
}

/**
* @ingroup iface_ext_input_device_v1
* Sends an type event to the client owning the resource.
Expand Down
7 changes: 7 additions & 0 deletions protocol/input_calibration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@
<arg name="vendor" type="uint" summary="input vendor"/>
</event>

<event name="product">
<description summary="The input device product identifier">
An input device will have a USB Bus product ID.
</description>
<arg name="vendor" type="uint" summary="input product"/>
</event>

<event name="type">
<description summary="The input device's type">
An input device will have a type, such as "touch" or "pointer"
Expand Down

0 comments on commit 8691e08

Please sign in to comment.