mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-21 23:20:24 +01:00
Rename scroll_mode to scroll_method
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
96493d6c26
commit
92d178f167
10 changed files with 152 additions and 152 deletions
|
|
@ -503,7 +503,7 @@ tp_post_scroll_events(struct tp_dispatch *tp, uint64_t time)
|
|||
struct tp_touch *t;
|
||||
int nfingers_down = 0;
|
||||
|
||||
if (tp->scroll.mode != LIBINPUT_CONFIG_SCROLL_2FG)
|
||||
if (tp->scroll.method != LIBINPUT_CONFIG_SCROLL_2FG)
|
||||
return 0;
|
||||
|
||||
/* No scrolling during tap-n-drag */
|
||||
|
|
@ -903,45 +903,45 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
tp_scroll_config_scroll_mode_get_modes(struct libinput_device *device)
|
||||
tp_scroll_config_scroll_method_get_methods(struct libinput_device *device)
|
||||
{
|
||||
struct evdev_device *evdev = (struct evdev_device*)device;
|
||||
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
||||
uint32_t modes = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
||||
uint32_t methods = LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
||||
|
||||
if (tp->ntouches >= 2)
|
||||
modes |= LIBINPUT_CONFIG_SCROLL_2FG;
|
||||
methods |= LIBINPUT_CONFIG_SCROLL_2FG;
|
||||
|
||||
return modes;
|
||||
return methods;
|
||||
}
|
||||
|
||||
static enum libinput_config_status
|
||||
tp_scroll_config_scroll_mode_set_mode(struct libinput_device *device,
|
||||
enum libinput_config_scroll_mode mode)
|
||||
tp_scroll_config_scroll_method_set_method(struct libinput_device *device,
|
||||
enum libinput_config_scroll_method method)
|
||||
{
|
||||
struct evdev_device *evdev = (struct evdev_device*)device;
|
||||
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
||||
|
||||
if (mode == tp->scroll.mode)
|
||||
if (method == tp->scroll.method)
|
||||
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
|
||||
evdev_stop_scroll(evdev, libinput_now(device->seat->libinput));
|
||||
tp->scroll.mode = mode;
|
||||
tp->scroll.method = method;
|
||||
|
||||
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static enum libinput_config_scroll_mode
|
||||
tp_scroll_config_scroll_mode_get_mode(struct libinput_device *device)
|
||||
static enum libinput_config_scroll_method
|
||||
tp_scroll_config_scroll_method_get_method(struct libinput_device *device)
|
||||
{
|
||||
struct evdev_device *evdev = (struct evdev_device*)device;
|
||||
struct tp_dispatch *tp = (struct tp_dispatch*)evdev->dispatch;
|
||||
|
||||
return tp->scroll.mode;
|
||||
return tp->scroll.method;
|
||||
}
|
||||
|
||||
static enum libinput_config_scroll_mode
|
||||
tp_scroll_config_scroll_mode_get_default_mode(struct libinput_device *device)
|
||||
static enum libinput_config_scroll_method
|
||||
tp_scroll_config_scroll_method_get_default_method(struct libinput_device *device)
|
||||
{
|
||||
return LIBINPUT_CONFIG_SCROLL_2FG;
|
||||
}
|
||||
|
|
@ -952,12 +952,12 @@ tp_init_scroll(struct tp_dispatch *tp, struct evdev_device *device)
|
|||
|
||||
evdev_init_natural_scroll(device);
|
||||
|
||||
tp->scroll.config_mode.get_modes = tp_scroll_config_scroll_mode_get_modes;
|
||||
tp->scroll.config_mode.set_mode = tp_scroll_config_scroll_mode_set_mode;
|
||||
tp->scroll.config_mode.get_mode = tp_scroll_config_scroll_mode_get_mode;
|
||||
tp->scroll.config_mode.get_default_mode = tp_scroll_config_scroll_mode_get_default_mode;
|
||||
tp->scroll.mode = tp_scroll_config_scroll_mode_get_default_mode(&tp->device->base);
|
||||
tp->device->base.config.scroll_mode = &tp->scroll.config_mode;
|
||||
tp->scroll.config_method.get_methods = tp_scroll_config_scroll_method_get_methods;
|
||||
tp->scroll.config_method.set_method = tp_scroll_config_scroll_method_set_method;
|
||||
tp->scroll.config_method.get_method = tp_scroll_config_scroll_method_get_method;
|
||||
tp->scroll.config_method.get_default_method = tp_scroll_config_scroll_method_get_default_method;
|
||||
tp->scroll.method = tp_scroll_config_scroll_method_get_default_method(&tp->device->base);
|
||||
tp->device->base.config.scroll_method = &tp->scroll.config_method;
|
||||
|
||||
/* In mm for touchpads with valid resolution, see tp_init_accel() */
|
||||
tp->device->scroll.threshold = 5.0;
|
||||
|
|
|
|||
|
|
@ -202,8 +202,8 @@ struct tp_dispatch {
|
|||
} buttons; /* physical buttons */
|
||||
|
||||
struct {
|
||||
struct libinput_device_config_scroll_mode config_mode;
|
||||
enum libinput_config_scroll_mode mode;
|
||||
struct libinput_device_config_scroll_method config_method;
|
||||
enum libinput_config_scroll_method method;
|
||||
} scroll;
|
||||
|
||||
enum touchpad_event queued;
|
||||
|
|
|
|||
56
src/evdev.c
56
src/evdev.c
|
|
@ -125,8 +125,8 @@ evdev_pointer_notify_button(struct evdev_device *device,
|
|||
device->buttons.change_to_left_handed(device);
|
||||
|
||||
if (state == LIBINPUT_BUTTON_STATE_RELEASED &&
|
||||
device->scroll.change_scroll_mode)
|
||||
device->scroll.change_scroll_mode(device);
|
||||
device->scroll.change_scroll_method)
|
||||
device->scroll.change_scroll_method(device);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
|
|||
device->rel.dy = 0;
|
||||
|
||||
/* Use unaccelerated deltas for pointing stick scroll */
|
||||
if (device->scroll.mode == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
|
||||
if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
|
||||
hw_is_key_down(device, device->scroll.button)) {
|
||||
if (device->scroll.button_scroll_active)
|
||||
evdev_post_scroll(device, time,
|
||||
|
|
@ -460,7 +460,7 @@ evdev_process_key(struct evdev_device *device,
|
|||
LIBINPUT_KEY_STATE_RELEASED);
|
||||
break;
|
||||
case EVDEV_KEY_TYPE_BUTTON:
|
||||
if (device->scroll.mode == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
|
||||
if (device->scroll.method == LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN &&
|
||||
e->code == device->scroll.button) {
|
||||
evdev_button_scroll_button(device, time, e->value);
|
||||
break;
|
||||
|
|
@ -848,49 +848,49 @@ evdev_init_left_handed(struct evdev_device *device,
|
|||
}
|
||||
|
||||
static uint32_t
|
||||
evdev_scroll_get_modes(struct libinput_device *device)
|
||||
evdev_scroll_get_methods(struct libinput_device *device)
|
||||
{
|
||||
return LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
|
||||
}
|
||||
|
||||
static void
|
||||
evdev_change_scroll_mode(struct evdev_device *device)
|
||||
evdev_change_scroll_method(struct evdev_device *device)
|
||||
{
|
||||
if (device->scroll.want_mode == device->scroll.mode &&
|
||||
if (device->scroll.want_method == device->scroll.method &&
|
||||
device->scroll.want_button == device->scroll.button)
|
||||
return;
|
||||
|
||||
if (evdev_any_button_down(device))
|
||||
return;
|
||||
|
||||
device->scroll.mode = device->scroll.want_mode;
|
||||
device->scroll.method = device->scroll.want_method;
|
||||
device->scroll.button = device->scroll.want_button;
|
||||
}
|
||||
|
||||
static enum libinput_config_status
|
||||
evdev_scroll_set_mode(struct libinput_device *device,
|
||||
enum libinput_config_scroll_mode mode)
|
||||
evdev_scroll_set_method(struct libinput_device *device,
|
||||
enum libinput_config_scroll_method method)
|
||||
{
|
||||
struct evdev_device *evdev = (struct evdev_device*)device;
|
||||
|
||||
evdev->scroll.want_mode = mode;
|
||||
evdev->scroll.change_scroll_mode(evdev);
|
||||
evdev->scroll.want_method = method;
|
||||
evdev->scroll.change_scroll_method(evdev);
|
||||
|
||||
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static enum libinput_config_scroll_mode
|
||||
evdev_scroll_get_mode(struct libinput_device *device)
|
||||
static enum libinput_config_scroll_method
|
||||
evdev_scroll_get_method(struct libinput_device *device)
|
||||
{
|
||||
struct evdev_device *evdev = (struct evdev_device *)device;
|
||||
|
||||
/* return the wanted configuration, even if it hasn't taken
|
||||
* effect yet! */
|
||||
return evdev->scroll.want_mode;
|
||||
return evdev->scroll.want_method;
|
||||
}
|
||||
|
||||
static enum libinput_config_scroll_mode
|
||||
evdev_scroll_get_default_mode(struct libinput_device *device)
|
||||
static enum libinput_config_scroll_method
|
||||
evdev_scroll_get_default_method(struct libinput_device *device)
|
||||
{
|
||||
struct evdev_device *evdev = (struct evdev_device *)device;
|
||||
|
||||
|
|
@ -907,7 +907,7 @@ evdev_scroll_set_button(struct libinput_device *device,
|
|||
struct evdev_device *evdev = (struct evdev_device*)device;
|
||||
|
||||
evdev->scroll.want_button = button;
|
||||
evdev->scroll.change_scroll_mode(evdev);
|
||||
evdev->scroll.change_scroll_method(evdev);
|
||||
|
||||
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
@ -935,23 +935,23 @@ evdev_scroll_get_default_button(struct libinput_device *device)
|
|||
|
||||
static int
|
||||
evdev_init_button_scroll(struct evdev_device *device,
|
||||
void (*change_scroll_mode)(struct evdev_device *))
|
||||
void (*change_scroll_method)(struct evdev_device *))
|
||||
{
|
||||
libinput_timer_init(&device->scroll.timer, device->base.seat->libinput,
|
||||
evdev_button_scroll_timeout, device);
|
||||
device->scroll.config.get_modes = evdev_scroll_get_modes;
|
||||
device->scroll.config.set_mode = evdev_scroll_set_mode;
|
||||
device->scroll.config.get_mode = evdev_scroll_get_mode;
|
||||
device->scroll.config.get_default_mode = evdev_scroll_get_default_mode;
|
||||
device->scroll.config.get_methods = evdev_scroll_get_methods;
|
||||
device->scroll.config.set_method = evdev_scroll_set_method;
|
||||
device->scroll.config.get_method = evdev_scroll_get_method;
|
||||
device->scroll.config.get_default_method = evdev_scroll_get_default_method;
|
||||
device->scroll.config.set_button = evdev_scroll_set_button;
|
||||
device->scroll.config.get_button = evdev_scroll_get_button;
|
||||
device->scroll.config.get_default_button = evdev_scroll_get_default_button;
|
||||
device->base.config.scroll_mode = &device->scroll.config;
|
||||
device->scroll.mode = evdev_scroll_get_default_mode((struct libinput_device *)device);
|
||||
device->scroll.want_mode = device->scroll.mode;
|
||||
device->base.config.scroll_method = &device->scroll.config;
|
||||
device->scroll.method = evdev_scroll_get_default_method((struct libinput_device *)device);
|
||||
device->scroll.want_method = device->scroll.method;
|
||||
device->scroll.button = evdev_scroll_get_default_button((struct libinput_device *)device);
|
||||
device->scroll.want_button = device->scroll.button;
|
||||
device->scroll.change_scroll_mode = change_scroll_mode;
|
||||
device->scroll.change_scroll_method = change_scroll_method;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1045,7 +1045,7 @@ fallback_dispatch_create(struct libinput_device *device)
|
|||
|
||||
if (evdev_device->scroll.want_button &&
|
||||
evdev_init_button_scroll(evdev_device,
|
||||
evdev_change_scroll_mode) == -1) {
|
||||
evdev_change_scroll_method) == -1) {
|
||||
free(dispatch);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
10
src/evdev.h
10
src/evdev.h
|
|
@ -100,16 +100,16 @@ struct evdev_device {
|
|||
|
||||
struct {
|
||||
struct libinput_timer timer;
|
||||
struct libinput_device_config_scroll_mode config;
|
||||
/* Currently enabled mode, button */
|
||||
enum libinput_config_scroll_mode mode;
|
||||
struct libinput_device_config_scroll_method config;
|
||||
/* Currently enabled method, button */
|
||||
enum libinput_config_scroll_method method;
|
||||
uint32_t button;
|
||||
/* set during device init, used at runtime to delay changes
|
||||
* until all buttons are up */
|
||||
enum libinput_config_scroll_mode want_mode;
|
||||
enum libinput_config_scroll_method want_method;
|
||||
uint32_t want_button;
|
||||
/* Checks if buttons are down and commits the setting */
|
||||
void (*change_scroll_mode)(struct evdev_device *device);
|
||||
void (*change_scroll_method)(struct evdev_device *device);
|
||||
bool button_scroll_active;
|
||||
double threshold;
|
||||
uint32_t direction;
|
||||
|
|
|
|||
|
|
@ -132,12 +132,12 @@ struct libinput_device_config_left_handed {
|
|||
int (*get_default)(struct libinput_device *device);
|
||||
};
|
||||
|
||||
struct libinput_device_config_scroll_mode {
|
||||
uint32_t (*get_modes)(struct libinput_device *device);
|
||||
enum libinput_config_status (*set_mode)(struct libinput_device *device,
|
||||
enum libinput_config_scroll_mode mode);
|
||||
enum libinput_config_scroll_mode (*get_mode)(struct libinput_device *device);
|
||||
enum libinput_config_scroll_mode (*get_default_mode)(struct libinput_device *device);
|
||||
struct libinput_device_config_scroll_method {
|
||||
uint32_t (*get_methods)(struct libinput_device *device);
|
||||
enum libinput_config_status (*set_method)(struct libinput_device *device,
|
||||
enum libinput_config_scroll_method method);
|
||||
enum libinput_config_scroll_method (*get_method)(struct libinput_device *device);
|
||||
enum libinput_config_scroll_method (*get_default_method)(struct libinput_device *device);
|
||||
enum libinput_config_status (*set_button)(struct libinput_device *device,
|
||||
uint32_t button);
|
||||
uint32_t (*get_button)(struct libinput_device *device);
|
||||
|
|
@ -151,7 +151,7 @@ struct libinput_device_config {
|
|||
struct libinput_device_config_accel *accel;
|
||||
struct libinput_device_config_natural_scroll *natural_scroll;
|
||||
struct libinput_device_config_left_handed *left_handed;
|
||||
struct libinput_device_config_scroll_mode *scroll_mode;
|
||||
struct libinput_device_config_scroll_method *scroll_method;
|
||||
};
|
||||
|
||||
struct libinput_device {
|
||||
|
|
|
|||
|
|
@ -1533,23 +1533,23 @@ libinput_device_config_buttons_get_default_left_handed(struct libinput_device *d
|
|||
}
|
||||
|
||||
LIBINPUT_EXPORT uint32_t
|
||||
libinput_device_config_scroll_get_modes(struct libinput_device *device)
|
||||
libinput_device_config_scroll_get_methods(struct libinput_device *device)
|
||||
{
|
||||
if (device->config.scroll_mode)
|
||||
return device->config.scroll_mode->get_modes(device);
|
||||
if (device->config.scroll_method)
|
||||
return device->config.scroll_method->get_methods(device);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT enum libinput_config_status
|
||||
libinput_device_config_scroll_set_mode(struct libinput_device *device,
|
||||
enum libinput_config_scroll_mode mode)
|
||||
libinput_device_config_scroll_set_method(struct libinput_device *device,
|
||||
enum libinput_config_scroll_method method)
|
||||
{
|
||||
if ((libinput_device_config_scroll_get_modes(device) & mode) != mode)
|
||||
if ((libinput_device_config_scroll_get_methods(device) & method) != method)
|
||||
return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
|
||||
|
||||
/* Check mode is a single valid mode */
|
||||
switch (mode) {
|
||||
/* Check method is a single valid method */
|
||||
switch (method) {
|
||||
case LIBINPUT_CONFIG_SCROLL_NO_SCROLL:
|
||||
case LIBINPUT_CONFIG_SCROLL_2FG:
|
||||
case LIBINPUT_CONFIG_SCROLL_EDGE:
|
||||
|
|
@ -1559,26 +1559,26 @@ libinput_device_config_scroll_set_mode(struct libinput_device *device,
|
|||
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||
}
|
||||
|
||||
if (device->config.scroll_mode)
|
||||
return device->config.scroll_mode->set_mode(device, mode);
|
||||
else /* mode must be _NO_SCROLL to get here */
|
||||
if (device->config.scroll_method)
|
||||
return device->config.scroll_method->set_method(device, method);
|
||||
else /* method must be _NO_SCROLL to get here */
|
||||
return LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT enum libinput_config_scroll_mode
|
||||
libinput_device_config_scroll_get_mode(struct libinput_device *device)
|
||||
LIBINPUT_EXPORT enum libinput_config_scroll_method
|
||||
libinput_device_config_scroll_get_method(struct libinput_device *device)
|
||||
{
|
||||
if (device->config.scroll_mode)
|
||||
return device->config.scroll_mode->get_mode(device);
|
||||
if (device->config.scroll_method)
|
||||
return device->config.scroll_method->get_method(device);
|
||||
else
|
||||
return LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT enum libinput_config_scroll_mode
|
||||
libinput_device_config_scroll_get_default_mode(struct libinput_device *device)
|
||||
LIBINPUT_EXPORT enum libinput_config_scroll_method
|
||||
libinput_device_config_scroll_get_default_method(struct libinput_device *device)
|
||||
{
|
||||
if (device->config.scroll_mode)
|
||||
return device->config.scroll_mode->get_default_mode(device);
|
||||
if (device->config.scroll_method)
|
||||
return device->config.scroll_method->get_default_method(device);
|
||||
else
|
||||
return LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
|
||||
}
|
||||
|
|
@ -1587,32 +1587,32 @@ LIBINPUT_EXPORT enum libinput_config_status
|
|||
libinput_device_config_scroll_set_button(struct libinput_device *device,
|
||||
uint32_t button)
|
||||
{
|
||||
if ((libinput_device_config_scroll_get_modes(device) &
|
||||
if ((libinput_device_config_scroll_get_methods(device) &
|
||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) == 0)
|
||||
return LIBINPUT_CONFIG_STATUS_UNSUPPORTED;
|
||||
|
||||
if (button && !libinput_device_has_button(device, button))
|
||||
return LIBINPUT_CONFIG_STATUS_INVALID;
|
||||
|
||||
return device->config.scroll_mode->set_button(device, button);
|
||||
return device->config.scroll_method->set_button(device, button);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT uint32_t
|
||||
libinput_device_config_scroll_get_button(struct libinput_device *device)
|
||||
{
|
||||
if ((libinput_device_config_scroll_get_modes(device) &
|
||||
if ((libinput_device_config_scroll_get_methods(device) &
|
||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) == 0)
|
||||
return 0;
|
||||
|
||||
return device->config.scroll_mode->get_button(device);
|
||||
return device->config.scroll_method->get_button(device);
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT uint32_t
|
||||
libinput_device_config_scroll_get_default_button(struct libinput_device *device)
|
||||
{
|
||||
if ((libinput_device_config_scroll_get_modes(device) &
|
||||
if ((libinput_device_config_scroll_get_methods(device) &
|
||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) == 0)
|
||||
return 0;
|
||||
|
||||
return device->config.scroll_mode->get_default_button(device);
|
||||
return device->config.scroll_method->get_default_button(device);
|
||||
}
|
||||
|
|
|
|||
106
src/libinput.h
106
src/libinput.h
|
|
@ -2043,10 +2043,10 @@ int
|
|||
libinput_device_config_buttons_get_default_left_handed(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* The scroll mode of a device selects when to generate scroll axis events
|
||||
* The scroll method of a device selects when to generate scroll axis events
|
||||
* instead of pointer motion events.
|
||||
*/
|
||||
enum libinput_config_scroll_mode {
|
||||
enum libinput_config_scroll_method {
|
||||
/**
|
||||
* Never send scroll events instead of pointer motion events.
|
||||
* Note scroll wheels, etc. will still send scroll events.
|
||||
|
|
@ -2071,104 +2071,104 @@ enum libinput_config_scroll_mode {
|
|||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Check which scroll modes a device supports. The mode defines when to
|
||||
* Check which scroll methods a device supports. The method defines when to
|
||||
* generate scroll axis events instead of pointer motion events.
|
||||
*
|
||||
* @param device The device to configure
|
||||
*
|
||||
* @return A bitmask of possible modes.
|
||||
* @return A bitmask of possible methods.
|
||||
*
|
||||
* @see libinput_device_config_scroll_set_mode
|
||||
* @see libinput_device_config_scroll_get_mode
|
||||
* @see libinput_device_config_scroll_get_default_mode
|
||||
* @see libinput_device_config_scroll_set_method
|
||||
* @see libinput_device_config_scroll_get_method
|
||||
* @see libinput_device_config_scroll_get_default_method
|
||||
* @see libinput_device_config_scroll_set_button
|
||||
* @see libinput_device_config_scroll_get_button
|
||||
* @see libinput_device_config_scroll_get_default_button
|
||||
*/
|
||||
uint32_t
|
||||
libinput_device_config_scroll_get_modes(struct libinput_device *device);
|
||||
libinput_device_config_scroll_get_methods(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Set the scroll mode for this device. The mode defines when to
|
||||
* Set the scroll method for this device. The method defines when to
|
||||
* generate scroll axis events instead of pointer motion events.
|
||||
*
|
||||
* @note Setting @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN enables
|
||||
* the scroll mode, but scrolling is only activated when the configured
|
||||
* the scroll method, but scrolling is only activated when the configured
|
||||
* button is held down. If no button is set, i.e.
|
||||
* libinput_device_config_scroll_get_button() returns 0, scrolling
|
||||
* cannot activate.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @param mode The scroll mode for this device.
|
||||
* @param method The scroll method for this device.
|
||||
*
|
||||
* @return A config status code.
|
||||
*
|
||||
* @see libinput_device_config_scroll_get_modes
|
||||
* @see libinput_device_config_scroll_get_mode
|
||||
* @see libinput_device_config_scroll_get_default_mode
|
||||
* @see libinput_device_config_scroll_get_methods
|
||||
* @see libinput_device_config_scroll_get_method
|
||||
* @see libinput_device_config_scroll_get_default_method
|
||||
* @see libinput_device_config_scroll_set_button
|
||||
* @see libinput_device_config_scroll_get_button
|
||||
* @see libinput_device_config_scroll_get_default_button
|
||||
*/
|
||||
enum libinput_config_status
|
||||
libinput_device_config_scroll_set_mode(struct libinput_device *device,
|
||||
enum libinput_config_scroll_mode mode);
|
||||
libinput_device_config_scroll_set_method(struct libinput_device *device,
|
||||
enum libinput_config_scroll_method method);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Get the scroll mode for this device. The mode defines when to
|
||||
* Get the scroll method for this device. The method defines when to
|
||||
* generate scroll axis events instead of pointer motion events.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @return The current scroll mode for this device.
|
||||
* @return The current scroll method for this device.
|
||||
*
|
||||
* @see libinput_device_config_scroll_get_modes
|
||||
* @see libinput_device_config_scroll_set_mode
|
||||
* @see libinput_device_config_scroll_get_default_mode
|
||||
* @see libinput_device_config_scroll_get_methods
|
||||
* @see libinput_device_config_scroll_set_method
|
||||
* @see libinput_device_config_scroll_get_default_method
|
||||
* @see libinput_device_config_scroll_set_button
|
||||
* @see libinput_device_config_scroll_get_button
|
||||
* @see libinput_device_config_scroll_get_default_button
|
||||
*/
|
||||
enum libinput_config_scroll_mode
|
||||
libinput_device_config_scroll_get_mode(struct libinput_device *device);
|
||||
enum libinput_config_scroll_method
|
||||
libinput_device_config_scroll_get_method(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Get the default scroll mode for this device. The mode defines when to
|
||||
* Get the default scroll method for this device. The method defines when to
|
||||
* generate scroll axis events instead of pointer motion events.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @return The default scroll mode for this device.
|
||||
* @return The default scroll method for this device.
|
||||
*
|
||||
* @see libinput_device_config_scroll_get_modes
|
||||
* @see libinput_device_config_scroll_set_mode
|
||||
* @see libinput_device_config_scroll_get_mode
|
||||
* @see libinput_device_config_scroll_get_methods
|
||||
* @see libinput_device_config_scroll_set_method
|
||||
* @see libinput_device_config_scroll_get_method
|
||||
* @see libinput_device_config_scroll_set_button
|
||||
* @see libinput_device_config_scroll_get_button
|
||||
* @see libinput_device_config_scroll_get_default_button
|
||||
*/
|
||||
enum libinput_config_scroll_mode
|
||||
libinput_device_config_scroll_get_default_mode(struct libinput_device *device);
|
||||
enum libinput_config_scroll_method
|
||||
libinput_device_config_scroll_get_default_method(struct libinput_device *device);
|
||||
|
||||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Set the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode
|
||||
* Set the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method
|
||||
* for this device.
|
||||
*
|
||||
* When the current scroll mode is set to @ref
|
||||
* When the current scroll method is set to @ref
|
||||
* LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN, no button press/release events
|
||||
* will be send for the configured button.
|
||||
*
|
||||
* When the configured button is pressed, any motion events along a
|
||||
* scroll-capable axis are turned into scroll axis events.
|
||||
*
|
||||
* @note Setting the button does not change the scroll mode. To change the
|
||||
* scroll mode call libinput_device_config_scroll_set_mode().
|
||||
* @note Setting the button does not change the scroll method. To change the
|
||||
* scroll method call libinput_device_config_scroll_set_method().
|
||||
*
|
||||
* If the button is 0, button scrolling is effectively disabled.
|
||||
*
|
||||
|
|
@ -2181,10 +2181,10 @@ libinput_device_config_scroll_get_default_mode(struct libinput_device *device);
|
|||
* @retval LIBINPUT_CONFIG_STATUS_INVALID the given button does not
|
||||
* exist on this device
|
||||
*
|
||||
* @see libinput_device_config_scroll_get_modes
|
||||
* @see libinput_device_config_scroll_set_mode
|
||||
* @see libinput_device_config_scroll_get_mode
|
||||
* @see libinput_device_config_scroll_get_default_mode
|
||||
* @see libinput_device_config_scroll_get_methods
|
||||
* @see libinput_device_config_scroll_set_method
|
||||
* @see libinput_device_config_scroll_get_method
|
||||
* @see libinput_device_config_scroll_get_default_method
|
||||
* @see libinput_device_config_scroll_get_button
|
||||
* @see libinput_device_config_scroll_get_default_button
|
||||
*/
|
||||
|
|
@ -2195,24 +2195,24 @@ libinput_device_config_scroll_set_button(struct libinput_device *device,
|
|||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Get the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode for
|
||||
* Get the button for the @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method for
|
||||
* this device.
|
||||
*
|
||||
* If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll mode is not supported,
|
||||
* If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not supported,
|
||||
* or no button is set, this function returns 0.
|
||||
*
|
||||
* @note The return value is independent of the currently selected
|
||||
* scroll-mode. For button scrolling to activate, a device must have the
|
||||
* @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode enabled, and a non-zero
|
||||
* scroll-method. For button scrolling to activate, a device must have the
|
||||
* @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method enabled, and a non-zero
|
||||
* button set as scroll button.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @return The button which when pressed switches to sending scroll events
|
||||
*
|
||||
* @see libinput_device_config_scroll_get_modes
|
||||
* @see libinput_device_config_scroll_set_mode
|
||||
* @see libinput_device_config_scroll_get_mode
|
||||
* @see libinput_device_config_scroll_get_default_mode
|
||||
* @see libinput_device_config_scroll_get_methods
|
||||
* @see libinput_device_config_scroll_set_method
|
||||
* @see libinput_device_config_scroll_get_method
|
||||
* @see libinput_device_config_scroll_get_default_method
|
||||
* @see libinput_device_config_scroll_set_button
|
||||
* @see libinput_device_config_scroll_get_default_button
|
||||
*/
|
||||
|
|
@ -2222,19 +2222,19 @@ libinput_device_config_scroll_get_button(struct libinput_device *device);
|
|||
/**
|
||||
* @ingroup config
|
||||
*
|
||||
* Get the default button for LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode
|
||||
* Get the default button for LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method
|
||||
* for this device.
|
||||
*
|
||||
* If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll mode is not supported,
|
||||
* If @ref LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN scroll method is not supported,
|
||||
* or no default button is set, this function returns 0.
|
||||
*
|
||||
* @param device The device to configure
|
||||
* @return The default button for LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN mode
|
||||
* @return The default button for LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN method
|
||||
*
|
||||
* @see libinput_device_config_scroll_get_modes
|
||||
* @see libinput_device_config_scroll_set_mode
|
||||
* @see libinput_device_config_scroll_get_mode
|
||||
* @see libinput_device_config_scroll_get_default_mode
|
||||
* @see libinput_device_config_scroll_get_methods
|
||||
* @see libinput_device_config_scroll_set_method
|
||||
* @see libinput_device_config_scroll_get_method
|
||||
* @see libinput_device_config_scroll_get_default_method
|
||||
* @see libinput_device_config_scroll_set_button
|
||||
* @see libinput_device_config_scroll_get_button
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ START_TEST(pointer_scroll_button)
|
|||
struct libinput *li = dev->libinput;
|
||||
|
||||
/* Make left button switch to scrolling mode */
|
||||
libinput_device_config_scroll_set_mode(dev->libinput_device,
|
||||
libinput_device_config_scroll_set_method(dev->libinput_device,
|
||||
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
|
||||
libinput_device_config_scroll_set_button(dev->libinput_device,
|
||||
BTN_LEFT);
|
||||
|
|
@ -639,8 +639,8 @@ START_TEST(pointer_scroll_button)
|
|||
litest_assert_empty_queue(li);
|
||||
|
||||
/* Restore default scroll behavior */
|
||||
libinput_device_config_scroll_set_mode(dev->libinput_device,
|
||||
libinput_device_config_scroll_get_default_mode(
|
||||
libinput_device_config_scroll_set_method(dev->libinput_device,
|
||||
libinput_device_config_scroll_get_default_method(
|
||||
dev->libinput_device));
|
||||
libinput_device_config_scroll_set_button(dev->libinput_device,
|
||||
libinput_device_config_scroll_get_default_button(
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ START_TEST(trackpoint_middlebutton_noscroll)
|
|||
struct libinput_event *event;
|
||||
|
||||
/* Disable middle button scrolling */
|
||||
libinput_device_config_scroll_set_mode(dev->libinput_device,
|
||||
libinput_device_config_scroll_set_method(dev->libinput_device,
|
||||
LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
|
@ -101,8 +101,8 @@ START_TEST(trackpoint_middlebutton_noscroll)
|
|||
litest_assert_empty_queue(li);
|
||||
|
||||
/* Restore default scroll behavior */
|
||||
libinput_device_config_scroll_set_mode(dev->libinput_device,
|
||||
libinput_device_config_scroll_get_default_mode(
|
||||
libinput_device_config_scroll_set_method(dev->libinput_device,
|
||||
libinput_device_config_scroll_get_default_method(
|
||||
dev->libinput_device));
|
||||
}
|
||||
END_TEST
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ print_device_notify(struct libinput_event *ev)
|
|||
struct libinput_device *dev = libinput_event_get_device(ev);
|
||||
struct libinput_seat *seat = libinput_device_get_seat(dev);
|
||||
double w, h;
|
||||
uint32_t scroll_modes;
|
||||
uint32_t scroll_methods;
|
||||
|
||||
printf("%-30s %s %s",
|
||||
libinput_device_get_name(dev),
|
||||
|
|
@ -276,14 +276,14 @@ print_device_notify(struct libinput_event *ev)
|
|||
if (libinput_device_config_calibration_has_matrix((dev)))
|
||||
printf(" calib");
|
||||
|
||||
scroll_modes = libinput_device_config_scroll_get_modes(dev);
|
||||
if (scroll_modes != LIBINPUT_CONFIG_SCROLL_NO_SCROLL) {
|
||||
scroll_methods = libinput_device_config_scroll_get_methods(dev);
|
||||
if (scroll_methods != LIBINPUT_CONFIG_SCROLL_NO_SCROLL) {
|
||||
printf(" scroll");
|
||||
if (scroll_modes & LIBINPUT_CONFIG_SCROLL_2FG)
|
||||
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_2FG)
|
||||
printf("-2fg");
|
||||
if (scroll_modes & LIBINPUT_CONFIG_SCROLL_EDGE)
|
||||
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_EDGE)
|
||||
printf("-edge");
|
||||
if (scroll_modes & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
|
||||
if (scroll_methods & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN)
|
||||
printf("-button");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue