Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a compilation error when DEBUG is undefined #215

Merged
merged 5 commits into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- clang
meson_options:
- ''
- '-Ddebug-messages=false'
# clang requires b_lundef=false for b_santize, see
# https://github.com/mesonbuild/meson/issues/764
- '-Db_sanitize=address,undefined -Db_lundef=false'
Expand Down
28 changes: 13 additions & 15 deletions src/wcmCommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ void wcmSendEvents(WacomDevicePtr priv, const WacomDeviceState* ds)
int z = ds->pressure;
int tx = ds->tiltx;
int ty = ds->tilty;
int v3, v4, v5, v6;
int v[7] = {0};
WacomAxisData axes = {0};

if (priv->serial && serial != priv->serial)
Expand Down Expand Up @@ -872,25 +872,23 @@ void wcmSendEvents(WacomDevicePtr priv, const WacomDeviceState* ds)
wcmAxisSet(&axes, WACOM_AXIS_STRIP_Y, ds->stripy);
wcmAxisSet(&axes, WACOM_AXIS_RING, ds->abswheel);
wcmAxisSet(&axes, WACOM_AXIS_RING2, ds->abswheel2);
v3 = ds->stripx;
v4 = ds->stripy;
v5 = ds->abswheel;
v6 = ds->abswheel2;
v[3] = ds->stripx;
v[4] = ds->stripy;
/* use tx and ty to report stripx and stripy for the DBG below */
tx = ds->stripx;
ty = ds->stripy;
} else if (IsCursor(priv))
{
wcmAxisSet(&axes, WACOM_AXIS_ROTATION, ds->rotation);
wcmAxisSet(&axes, WACOM_AXIS_THROTTLE, ds->throttle);
v3 = ds->rotation;
v4 = ds->throttle;
v[3] = ds->rotation;
v[4] = ds->throttle;
} else
{
wcmAxisSet(&axes, WACOM_AXIS_TILT_X, tx);
wcmAxisSet(&axes, WACOM_AXIS_TILT_Y, ty);
v3 = tx;
v4 = ty;
v[3] = tx;
v[4] = ty;
}


Expand All @@ -907,27 +905,27 @@ void wcmSendEvents(WacomDevicePtr priv, const WacomDeviceState* ds)
if (ds->proximity)
wcmRotateAndScaleCoordinates(priv, &x, &y);

v5 = ds->abswheel;
v6 = ds->abswheel2;
v[5] = ds->abswheel;
v[6] = ds->abswheel2;
if (IsStylus(priv) && !IsArtPen(ds))
{
/* Normalize abswheel airbrush data to Art Pen rotation range.
* We do not normalize Art Pen. They are already at the range.
*/
v5 = ds->abswheel * MAX_ROTATION_RANGE/
v[5] = ds->abswheel * MAX_ROTATION_RANGE/
(double)MAX_ABS_WHEEL + MIN_ROTATION;
wcmAxisSet(&axes, WACOM_AXIS_WHEEL, v5);
wcmAxisSet(&axes, WACOM_AXIS_WHEEL, v[5]);
} else if (IsStylus(priv) && IsArtPen(ds))
{
wcmAxisSet(&axes, WACOM_AXIS_WHEEL, v5);
wcmAxisSet(&axes, WACOM_AXIS_WHEEL, v[5]);
}

DBG(6, priv, "%s prox=%d\tx=%d"
"\ty=%d\tz=%d\tv3=%d\tv4=%d\tv5=%d\tv6=%d\tid=%d"
"\tserial=%u\tbutton=%s\tbuttons=%d\n",
is_absolute(priv) ? "abs" : "rel",
ds->proximity,
x, y, z, v3, v4, v5, v6, id, serial,
x, y, z, v[3], v[4], v[5], v[6], id, serial,
is_button ? "true" : "false", ds->buttons);

/* when entering prox, replace the zeroed-out oldState with a copy of
Expand Down
8 changes: 3 additions & 5 deletions src/wcmConfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ static int wcmInitAxes(WacomDevicePtr priv)
Bool wcmDevInit(WacomDevicePtr priv)
{
WacomCommonPtr common = priv->common;
int nbaxes, nbbuttons, nbkeys;
int nbaxes, nbbuttons;

/* Detect tablet configuration, if possible */
if (priv->common->wcmModel->DetectConfig)
Expand All @@ -1002,12 +1002,10 @@ Bool wcmDevInit(WacomDevicePtr priv)
/* if more than 3 buttons, offset by the four scroll buttons,
* otherwise, alloc 7 buttons for scroll wheel. */
nbbuttons = min(max(nbbuttons + 4, 7), WCM_MAX_BUTTONS);
nbkeys = nbbuttons; /* Same number of keys since any button may be
* configured as an either mouse button or key */

DBG(10, priv,
"(type %d) %d buttons, %d keys, %d axes\n",
priv->type, nbbuttons, nbkeys, nbaxes);
"(type %d) %d buttons, %d axes\n",
priv->type, nbbuttons, nbaxes);

if (!wcmInitButtons(priv, nbbuttons))
{
Expand Down
8 changes: 2 additions & 6 deletions src/x11/xf86Wacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,7 @@ void wcmClose(WacomDevicePtr priv)

static int wcmReady(WacomDevicePtr priv)
{
#ifdef DEBUG
InputInfoPtr pInfo = priv->frontend;
#endif
int n = xf86WaitForInput(pInfo->fd, 0);
if (n < 0) {
int saved_errno = errno;
Expand Down Expand Up @@ -842,12 +840,10 @@ static int wcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode)
{
InputInfoPtr pInfo = (InputInfoPtr)dev->public.devicePrivate;
Bool is_absolute = TRUE;
#ifdef DEBUG
WacomDevicePtr priv = (WacomDevicePtr)pInfo->private;

DBG(3, priv, "dev=%p mode=%d\n",
(void *)dev, mode);
#endif
DBG(3, priv, "dev=%p mode=%d\n", (void *)dev, mode);

if (mode != Absolute) {
if (mode != Relative)
return XI_BadMode;
Expand Down
2 changes: 2 additions & 0 deletions src/x11/xf86WacomProperties.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,15 @@ static int wcmSetActionProperty(DeviceIntPtr dev, Atom property,

rc = wcmCheckActionProperty(priv, property, prop);
if (rc != Success) {
#ifdef DEBUG
const char *msg = NULL;
switch (rc) {
case BadMatch: msg = "BadMatch"; break;
case BadValue: msg = "BadValue"; break;
default: msg = "UNKNOWN"; break;
}
DBG(3, priv, "Action validation failed with code %d (%s)\n", rc, msg);
#endif
return rc;
}

Expand Down