Skip to content

Commit

Permalink
Generate the class given in class if not explicitly given (libwacom#790)
Browse files Browse the repository at this point in the history
This is still a part of the API, and thus have required even new .tablet
files to fill this out even though it's superseded by IntegratedIn. So
let's generate them programmatically.

This turns devices that are IntegratedIn=Display to the Cintiq class,
IntegratedIn=Display;System into the ISDV4 class, and everything else
into the Bamboo class.
  • Loading branch information
redstrate committed Oct 16, 2024
1 parent 34bd864 commit 583ec69
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion data/wacom-cintiq-24hd-touch.tablet
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Name=Wacom Cintiq 24HD touch
ModelName=DTH-2400
DeviceMatch=usb|056a|00f8
PairedID=usb|056a|00f6
Class=Cintiq
Width=21
Height=13
Layout=wacom-cintiq-24hd.svg
Expand Down
1 change: 0 additions & 1 deletion data/wacom-cintiq-27hdt.tablet
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Name=Wacom Cintiq 27QHD touch
ModelName=DTH-2700
DeviceMatch=usb|056a|032b
PairedID=usb|056a|032c
Class=Cintiq
Width=24
Height=12
Styli=@intuos5;@propengen2;
Expand Down
12 changes: 11 additions & 1 deletion libwacom/libwacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,17 @@ libwacom_get_height(const WacomDevice *device)
LIBWACOM_EXPORT WacomClass
libwacom_get_class(const WacomDevice *device)
{
return device->cls;
if (device->cls != WCLASS_UNKNOWN) {
return device->cls;
}
if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY &&
device->integration_flags & WACOM_DEVICE_INTEGRATED_SYSTEM) {
return WCLASS_ISDV4;
}
if (device->integration_flags & WACOM_DEVICE_INTEGRATED_DISPLAY) {
return WCLASS_CINTIQ;
}
return WCLASS_BAMBOO;
}

LIBWACOM_EXPORT int
Expand Down
1 change: 1 addition & 0 deletions test/test-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ test_cintiq24hdt(struct fixture *f, gconstpointer user_data)
const WacomMatch *match;

g_assert_nonnull(device);
g_assert_cmpint(libwacom_get_class(device), ==, WCLASS_CINTIQ);

/* 24HDT has one paired device */
match = libwacom_get_paired_device(device);
Expand Down

0 comments on commit 583ec69

Please sign in to comment.