static void clutter_input_device_xi2_finalize (GObject *object) { #ifdef HAVE_LIBWACOM ClutterInputDeviceXI2 *device_xi2 = CLUTTER_INPUT_DEVICE_XI2 (object); if (device_xi2->wacom_device) libwacom_destroy (device_xi2->wacom_device); if (device_xi2->group_modes) g_array_unref (device_xi2->group_modes); #endif G_OBJECT_CLASS (clutter_input_device_xi2_parent_class)->finalize (object); }
int main(int argc, char **argv) { WacomDeviceDatabase *db; WacomDevice *device; const WacomMatch *match; const char *str; db = libwacom_database_new_for_path(TOPSRCDIR"/data"); if (!db) printf("Failed to load data from %s", TOPSRCDIR"/data"); assert(db); device = libwacom_new_from_usbid(db, 0, 0, NULL); assert(!device); device = libwacom_new_from_usbid(db, 0x56a, 0x00bc, NULL); assert(device); str = libwacom_get_name(device); assert(strcmp(str, "Wacom Intuos4 WL") == 0); assert(libwacom_get_class(device) == WCLASS_INTUOS4); assert(libwacom_get_vendor_id(device) == 0x56a); assert(libwacom_get_product_id(device) == 0xbc); assert(libwacom_get_bustype(device) == WBUSTYPE_USB); assert(libwacom_get_num_buttons(device) == 9); assert(libwacom_has_stylus(device)); assert(libwacom_is_reversible(device)); assert(!libwacom_has_touch(device)); assert(libwacom_has_ring(device)); assert(!libwacom_has_ring2(device)); assert(!libwacom_has_touchswitch(device)); assert(libwacom_get_num_strips(device) == 0); assert(libwacom_get_integration_flags (device) == WACOM_DEVICE_INTEGRATED_NONE); assert(libwacom_get_width(device) == 8); assert(libwacom_get_height(device) == 5); /* I4 WL has two matches */ check_multiple_match(device); libwacom_destroy(device); device = libwacom_new_from_usbid(db, 0x56a, 0x00b9, NULL); assert(device); assert(libwacom_get_button_flag(device, 'A') & WACOM_BUTTON_RING_MODESWITCH); assert(libwacom_get_button_flag(device, 'I') & WACOM_BUTTON_OLED); /* * I4 WL has only 9 buttons, asking for a 10th button will raise a warning * in libwacom_get_button_flag() which is expected. */ printf("Following critical warning in libwacom_get_button_flag() is expected\n"); assert(libwacom_get_button_flag(device, 'J') == WACOM_BUTTON_NONE); assert(libwacom_get_ring_num_modes(device) == 4); libwacom_destroy(device); device = libwacom_new_from_usbid(db, 0x56a, 0x00f4, NULL); assert(device); assert(libwacom_get_ring_num_modes(device) == 3); assert(libwacom_get_ring2_num_modes(device) == 3); libwacom_destroy(device); device = libwacom_new_from_usbid(db, 0x056a, 0x00cc, NULL); assert(libwacom_get_num_strips(device) == 2); libwacom_destroy(device); device = libwacom_new_from_name(db, "Wacom Serial Tablet WACf004", NULL); assert(device); assert(libwacom_get_integration_flags (device) & WACOM_DEVICE_INTEGRATED_DISPLAY); assert(libwacom_get_integration_flags (device) & WACOM_DEVICE_INTEGRATED_SYSTEM); libwacom_destroy(device); /* 24HDT has one paired device */ device = libwacom_new_from_usbid(db, 0x56a, 0x00f8, NULL); assert(device); match = libwacom_get_paired_device(device); assert(match != NULL); assert(libwacom_match_get_vendor_id(match) == 0x56a); assert(libwacom_match_get_product_id(match) == 0xf6); assert(libwacom_match_get_bustype(match) == WBUSTYPE_USB); libwacom_database_destroy (db); return 0; }