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

Miscelaneous fixups #348

Merged
merged 5 commits into from
Aug 8, 2024
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
18 changes: 15 additions & 3 deletions man/xsetwacom.man
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,22 @@ The set is defined device's native orientation, regardless of the actual rotatio
applied.
.TP
\fBButton\fR button-number [mapping]
Set a mapping for the specified button-number. Mappings take the form of
.TQ
\fBAbsWheelUp\fR [mapping]
.TQ
\fBAbsWheelDown\fR [mapping]
.TQ
\fBAbsWheel2Up\fR [mapping]
.TQ
\fBAbsWheel2Down\fR [mapping]
.TQ
\fBRelWheelUp\fR [mapping]
.TQ
\fBRelWheelDown\fR [mapping]
Set a mapping for the specified control. Mappings take the form of
either a single numeric button or an 'action' to be performed. If no mapping
is provided, the default mapping is restored. If button-number is mapped
to 0, the Button event is ignored.
is provided, the default mapping is restored. If a control is mapped
to 0, the event is ignored.

Numeric button mappings indicate what X11 button number the given button-number
should correspond to. For example, a mapping of "3" means a press of the given
Expand Down
4 changes: 1 addition & 3 deletions src/wcmCommon.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,7 @@ static int getWheelButton(int delta, int action_up, int action_dn)
/**
* Send button or actions for a scrolling axis.
*
* @param button X button number to send if no action is defined
* @param action Action to send
* @param nactions Length of action array
*/
static void sendWheelStripEvent(WacomDevicePtr priv, const WacomAction *action,
const WacomDeviceState* ds, const WacomAxisData *axes)
Expand Down Expand Up @@ -1077,7 +1075,7 @@ static Bool check_arbitrated_control(WacomDevicePtr priv, WacomDeviceStatePtr ds

if (IsPad(priv)) {
/* Pad may never be the "active" pointer controller */
DBG(6, priv, "Event from pad; not yielding pointer control\n.");
DBG(6, priv, "Event from pad; not yielding pointer control.\n");
return FALSE;
}

Expand Down
20 changes: 12 additions & 8 deletions src/wcmUSB.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,9 +1787,9 @@ static int usbInitToolType(WacomDevicePtr priv, int fd,
{
int i, device_type = 0;

for (i = 0; (i < nevents) && !device_type; ++i, event_ptr++)
for (i = 0; (i < nevents) && !device_type; ++i)
{
device_type = deviceTypeFromEvent(priv, event_ptr->type, event_ptr->code, event_ptr->value);
device_type = deviceTypeFromEvent(priv, event_ptr[i].type, event_ptr[i].code, event_ptr[i].value);
}

if (!device_type)
Expand All @@ -1799,8 +1799,8 @@ static int usbInitToolType(WacomDevicePtr priv, int fd,
device_type = refreshDeviceType(priv, fd);

if (!device_type) /* expresskey pressed at startup or missing type */
for (i = 0; (i < nevents) && !device_type; ++i, event_ptr++)
device_type = deriveDeviceTypeFromButtonEvent(priv, event_ptr);
for (i = 0; (i < nevents) && !device_type; ++i)
device_type = deriveDeviceTypeFromButtonEvent(priv, &event_ptr[i]);

return device_type;
}
Expand Down Expand Up @@ -1917,17 +1917,21 @@ static void usbDispatchEvents(WacomDevicePtr priv)
}
else if (event->type == EV_REL)
{
if (event->code == REL_WHEEL)
{
switch (event->code) {
case REL_WHEEL:
ds->relwheel = -event->value;
ds->time = wcmTimeInMillis();
common->wcmChannel[channel].dirty |= TRUE;
}
else
break;
case REL_WHEEL_HI_RES:
/* unsupported */
break;
default:
wcmLogSafe(priv, W_ERROR,
"%s: rel event recv'd (%d)!\n",
priv->name,
event->code);
}
}
else if (event->type == EV_KEY)
{
Expand Down
4 changes: 2 additions & 2 deletions tools/xsetwacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ static param_t parameters[] =
},
{
.name = "AbsWheel2Up",
.desc = "X11 event to which absolute wheel up should be mapped. ",
.desc = "X11 event to which 2nd absolute wheel up should be mapped. ",
.prop_name = WACOM_PROP_WHEELBUTTONS,
.prop_format = 8,
.prop_offset = 4,
Expand All @@ -342,7 +342,7 @@ static param_t parameters[] =
},
{
.name = "AbsWheel2Down",
.desc = "X11 event to which absolute wheel down should be mapped. ",
.desc = "X11 event to which 2nd absolute wheel down should be mapped. ",
.prop_name = WACOM_PROP_WHEELBUTTONS,
.prop_format = 8,
.prop_offset = 5,
Expand Down
Loading