os: change Input::Touch_id from int to unsigned

There no sensible meaning for negative touch IDs.

Issue #3669
This commit is contained in:
Norman Feske 2022-02-01 13:26:04 +01:00
parent 8e9cabf819
commit 024b987e4c
4 changed files with 5 additions and 5 deletions

View File

@ -281,7 +281,7 @@ void Driver::input_callback(Input_event type, unsigned code,
case EVENT_TYPE_WHEEL: submit(Wheel{rx, ry}); break;
case EVENT_TYPE_TOUCH:
{
Touch_id const id { (int)code };
Touch_id const id { code };
if (rx == -1 && ry == -1)
submit(Touch_release{id});

View File

@ -23,7 +23,7 @@ namespace Input {
typedef Genode::Codepoint Codepoint;
struct Touch_id { int value; };
struct Touch_id { unsigned value; };
/*
* Event attributes

View File

@ -77,7 +77,7 @@ struct Synaptics
_i2c.send(I2C_ADDR, _buf, 1);
_i2c.recv(I2C_ADDR, (uint8_t *)fingers, sizeof(fingers));
for (int i = 0; i < FINGERS; i++) {
for (unsigned i = 0; i < FINGERS; i++) {
Finger_data &current = fingers[i];
Input::Touch_id id { i };

View File

@ -75,7 +75,7 @@ namespace {
static void _touch(struct genode_event_submit *myself,
struct genode_event_touch_args const *args)
{
Input::Touch_id id { (int)args->finger };
Input::Touch_id id { args->finger };
_with_batch(myself, [&] (Event::Session_client::Batch &batch) {
batch.submit(Input::Touch { id, (float)args->xpos, (float)args->ypos }); });
@ -84,7 +84,7 @@ namespace {
static void _touch_release(struct genode_event_submit *myself,
unsigned finger)
{
Input::Touch_id id { (int)finger };
Input::Touch_id id { finger };
_with_batch(myself, [&] (Event::Session_client::Batch &batch) {
batch.submit(Input::Touch_release { id }); });