|
|
@ -219,36 +219,38 @@ static bool set_calibration_matrix(struct libinput_device *dev, float mat[6]) {
|
|
|
|
return changed;
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool sway_input_configure_libinput_device(struct sway_input_device *input_device) {
|
|
|
|
static bool configure_send_events(struct libinput_device *device,
|
|
|
|
struct input_config *ic = input_device_get_config(input_device);
|
|
|
|
struct input_config *ic) {
|
|
|
|
if (!ic || !wlr_input_device_is_libinput(input_device->wlr_device)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct libinput_device *device =
|
|
|
|
|
|
|
|
wlr_libinput_get_device_handle(input_device->wlr_device);
|
|
|
|
|
|
|
|
sway_log(SWAY_DEBUG, "sway_input_configure_libinput_device('%s' on '%s')",
|
|
|
|
|
|
|
|
ic->identifier, input_device->identifier);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool changed = false;
|
|
|
|
|
|
|
|
if (ic->mapped_to_output &&
|
|
|
|
if (ic->mapped_to_output &&
|
|
|
|
strcmp("*", ic->mapped_to_output) != 0 &&
|
|
|
|
strcmp("*", ic->mapped_to_output) != 0 &&
|
|
|
|
!output_by_name_or_id(ic->mapped_to_output)) {
|
|
|
|
!output_by_name_or_id(ic->mapped_to_output)) {
|
|
|
|
sway_log(SWAY_DEBUG,
|
|
|
|
sway_log(SWAY_DEBUG,
|
|
|
|
"%s '%s' is mapped to offline output '%s'; disabling input",
|
|
|
|
"%s '%s' is mapped to offline output '%s'; disabling input",
|
|
|
|
ic->input_type, ic->identifier, ic->mapped_to_output);
|
|
|
|
ic->input_type, ic->identifier, ic->mapped_to_output);
|
|
|
|
changed |= set_send_events(device,
|
|
|
|
return set_send_events(device, LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
|
|
|
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED);
|
|
|
|
|
|
|
|
} else if (ic->send_events != INT_MIN) {
|
|
|
|
} else if (ic->send_events != INT_MIN) {
|
|
|
|
changed |= set_send_events(device, ic->send_events);
|
|
|
|
return set_send_events(device, ic->send_events);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Have to reset to the default mode here, otherwise if ic->send_events
|
|
|
|
// Have to reset to the default mode here, otherwise if ic->send_events
|
|
|
|
// is unset and a mapped output just came online after being disabled,
|
|
|
|
// is unset and a mapped output just came online after being disabled,
|
|
|
|
// we'd remain stuck sending no events.
|
|
|
|
// we'd remain stuck sending no events.
|
|
|
|
changed |= set_send_events(device,
|
|
|
|
return set_send_events(device,
|
|
|
|
libinput_device_config_send_events_get_default_mode(device));
|
|
|
|
libinput_device_config_send_events_get_default_mode(device));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool sway_input_configure_libinput_device(struct sway_input_device *input_device) {
|
|
|
|
|
|
|
|
struct input_config *ic = input_device_get_config(input_device);
|
|
|
|
|
|
|
|
if (!ic || !wlr_input_device_is_libinput(input_device->wlr_device)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct libinput_device *device =
|
|
|
|
|
|
|
|
wlr_libinput_get_device_handle(input_device->wlr_device);
|
|
|
|
|
|
|
|
sway_log(SWAY_DEBUG, "sway_input_configure_libinput_device('%s' on '%s')",
|
|
|
|
|
|
|
|
ic->identifier, input_device->identifier);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool changed = configure_send_events(device, ic);
|
|
|
|
if (ic->tap != INT_MIN) {
|
|
|
|
if (ic->tap != INT_MIN) {
|
|
|
|
changed |= set_tap(device, ic->tap);
|
|
|
|
changed |= set_tap(device, ic->tap);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -304,6 +306,22 @@ bool sway_input_configure_libinput_device(struct sway_input_device *input_device
|
|
|
|
return changed;
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void sway_input_configure_libinput_device_send_events(
|
|
|
|
|
|
|
|
struct sway_input_device *input_device) {
|
|
|
|
|
|
|
|
struct input_config *ic = input_device_get_config(input_device);
|
|
|
|
|
|
|
|
if (!ic || !wlr_input_device_is_libinput(input_device->wlr_device)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct libinput_device *device =
|
|
|
|
|
|
|
|
wlr_libinput_get_device_handle(input_device->wlr_device);
|
|
|
|
|
|
|
|
bool changed = configure_send_events(device, ic);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (changed) {
|
|
|
|
|
|
|
|
ipc_event_input("libinput_config", input_device);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sway_input_reset_libinput_device(struct sway_input_device *input_device) {
|
|
|
|
void sway_input_reset_libinput_device(struct sway_input_device *input_device) {
|
|
|
|
if (!wlr_input_device_is_libinput(input_device->wlr_device)) {
|
|
|
|
if (!wlr_input_device_is_libinput(input_device->wlr_device)) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|