Comment 6 for bug 986886

Revision history for this message
José Expósito (jose-exposito89) wrote :

Looks like the API is not retrocompatible. I can say that in the previous uTouch version (Oneiric) "gesture name" contains a valid value, but now with this code:

QHash<QString, QVariant> GestureCollector::getGestureAttrs(GeisEvent event)
{
    QHash<QString, QVariant> ret;

    GeisAttr attr = geis_event_attr_by_name(event,
            GEIS_EVENT_ATTRIBUTE_GROUPSET);
    GeisGroupSet groupset = (GeisGroupSet)geis_attr_value_to_pointer(attr);

    for (GeisSize i = 0; i < geis_groupset_group_count(groupset); ++i) {
        GeisSize j;
        GeisGroup group = geis_groupset_group(groupset, i);

        for (j = 0; j < geis_group_frame_count(group); ++j) {
            GeisSize k;
            GeisFrame frame = geis_group_frame(group, j);
            GeisSize attr_count = geis_frame_attr_count(frame);

            for (k = 0; k < attr_count; ++k) {
                GeisAttr gestureAttr = geis_frame_attr(frame, k);
                QString attrName = geis_attr_name(gestureAttr);
                QVariant value;

                switch (geis_attr_type(gestureAttr)) {
                case GEIS_ATTR_TYPE_BOOLEAN:
                    value = geis_attr_value_to_boolean(gestureAttr);
                    break;
                case GEIS_ATTR_TYPE_FLOAT:
                    value = geis_attr_value_to_float(gestureAttr);
                    break;
                case GEIS_ATTR_TYPE_INTEGER:
                    value = geis_attr_value_to_integer(gestureAttr);
                    break;
                case GEIS_ATTR_TYPE_STRING:
                    value = geis_attr_value_to_string(gestureAttr);
                    break;
                default:
                    break;
                }

                qDebug() << attrName << value;

                if (!value.isNull()) {
                    ret.insert(attrName, value);
                }
            }
        }
    }

    return ret;
}

I get this output: (for a three touches tap)

"timestamp" QVariant(int, 608258)
"device id" QVariant(int, 20240)
"root window id" QVariant(int, 172)
"event window id" QVariant(int, 172)
"child window id" QVariant(int, 172)
"touches" QVariant(int, 3)
"focus x" QVariant(float, 471)
"focus y" QVariant(float, 563)
"boundingbox x1" QVariant(float, -2279)
"boundingbox y1" QVariant(float, 2018)
"boundingbox x2" QVariant(float, 1429)
"boundingbox y2" QVariant(float, 4332)
"gesture name" QVariant(QString, "n/a")

In addition looks like the "* window id" is always the root window. How to fix this two errors?