wayland: Fix label lookup on >1 strips/rings

We assumed that each group could only have 1 strip and/or ring, because
accounting is performed per group, so we could not assume the real
index for anything above 1. Get rid of this restriction, now that
MetaWaylandTabletPad does its own accounting of rings/strips, alongside
groups.
This commit is contained in:
Carlos Garnacho 2016-06-30 18:48:44 +02:00
parent 138a47b8f9
commit 2f492c133c

View File

@ -588,28 +588,18 @@ meta_wayland_tablet_pad_get_label (MetaWaylandTabletPad *pad,
break; break;
case META_PAD_ACTION_RING: case META_PAD_ACTION_RING:
{ {
MetaWaylandTabletPadGroup *group;
MetaWaylandTabletPadRing *ring; MetaWaylandTabletPadRing *ring;
/* FIXME: Assuming each group gets 1 */ ring = g_list_nth_data (pad->rings, action);
group = g_list_nth_data (pad->groups, action);
if (!group)
break;
ring = g_list_nth_data (group->rings, 0);
if (ring) if (ring)
label = ring->feedback; label = ring->feedback;
break; break;
} }
case META_PAD_ACTION_STRIP: case META_PAD_ACTION_STRIP:
{ {
MetaWaylandTabletPadGroup *group;
MetaWaylandTabletPadStrip *strip; MetaWaylandTabletPadStrip *strip;
/* FIXME: Assuming each group gets 1 */ strip = g_list_nth_data (pad->strips, action);
group = g_list_nth_data (pad->groups, action);
if (!group)
break;
strip = g_list_nth_data (group->strips, 0);
if (strip) if (strip)
label = strip->feedback; label = strip->feedback;
break; break;