@@ -170,6 +170,16 @@ pub enum DragLockState {
170170 EnabledSticky ,
171171}
172172
173+ /// A config status to distinguish or set 3-finger dragging on a device.
174+ pub enum ThreeFingerDragState {
175+ /// Drag is to be disabled, or is currently disabled
176+ Disabled ,
177+ /// Drag is to be enabled for 3 fingers, or is currently enabled
178+ EnabledThreeFinger ,
179+ /// Drag is to be enabled for 4 fingers, or is currently enabled
180+ EnabledFourFinger ,
181+ }
182+
173183/// Whenever scroll button lock is enabled or not
174184#[ cfg( feature = "libinput_1_15" ) ]
175185#[ allow( missing_docs) ]
@@ -1965,6 +1975,82 @@ impl Device {
19651975 /// See `config_tap_set_enabled` for more information.
19661976 pub fn config_tap_finger_count, ffi:: libinput_device_config_tap_get_finger_count, u32 ) ;
19671977
1978+ #[ cfg( feature = "libinput_1_28" ) ]
1979+ ffi_func ! (
1980+ /// Returns the maximum number of fingers available for 3-finger dragging.
1981+ pub fn config_3fg_drag_get_finger_count, ffi:: libinput_device_config_3fg_drag_get_finger_count, u32 ) ;
1982+
1983+ /// Enable or disable 3-finger drag on this device.
1984+ ///
1985+ /// When enabled, three fingers down will result in a button down event,
1986+ /// subsequent finger motion triggers a drag. The button is released shortly
1987+ /// after all fingers are logically up.
1988+ ///
1989+ /// See [Three-finger drag](https://wayland.freedesktop.org/libinput/doc/latest/configuration.html#three-finger-drag) for details.
1990+ #[ cfg( feature = "libinput_1_28" ) ]
1991+ pub fn config_3fg_drag_set_enabled ( & self , state : ThreeFingerDragState ) -> DeviceConfigResult {
1992+ match unsafe {
1993+ ffi:: libinput_device_config_3fg_drag_set_enabled (
1994+ self . as_raw_mut ( ) ,
1995+ match state {
1996+ ThreeFingerDragState :: Disabled => {
1997+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_DISABLED
1998+ }
1999+ ThreeFingerDragState :: EnabledThreeFinger => {
2000+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_ENABLED_3FG
2001+ }
2002+ ThreeFingerDragState :: EnabledFourFinger => {
2003+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_ENABLED_4FG
2004+ }
2005+ } ,
2006+ )
2007+ } {
2008+ ffi:: libinput_config_status_LIBINPUT_CONFIG_STATUS_SUCCESS => Ok ( ( ) ) ,
2009+ ffi:: libinput_config_status_LIBINPUT_CONFIG_STATUS_UNSUPPORTED => {
2010+ Err ( DeviceConfigError :: Unsupported )
2011+ }
2012+ ffi:: libinput_config_status_LIBINPUT_CONFIG_STATUS_INVALID => {
2013+ Err ( DeviceConfigError :: Invalid )
2014+ }
2015+ _ => panic ! ( "libinput returned invalid 'libinput_config_status'" ) ,
2016+ }
2017+ }
2018+
2019+ /// Return whether 3-finger drag is enabled or disabled on this device.
2020+ #[ cfg( feature = "libinput_1_28" ) ]
2021+ pub fn config_3fg_drag_get_enabled ( & self ) -> ThreeFingerDragState {
2022+ match unsafe { ffi:: libinput_device_config_3fg_drag_get_enabled ( self . as_raw_mut ( ) ) } {
2023+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_DISABLED => {
2024+ ThreeFingerDragState :: Disabled
2025+ }
2026+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_ENABLED_3FG => {
2027+ ThreeFingerDragState :: EnabledThreeFinger
2028+ }
2029+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_ENABLED_4FG => {
2030+ ThreeFingerDragState :: EnabledFourFinger
2031+ }
2032+ _ => panic ! ( "libinput returned invalid 'libinput_config_3fg_drag_state'" ) ,
2033+ }
2034+ }
2035+
2036+ /// Return whether 3-finger drag is enabled or disabled by default on this device.
2037+ #[ cfg( feature = "libinput_1_28" ) ]
2038+ pub fn config_3fg_drag_get_default_enabled ( & self ) -> ThreeFingerDragState {
2039+ match unsafe { ffi:: libinput_device_config_3fg_drag_get_default_enabled ( self . as_raw_mut ( ) ) }
2040+ {
2041+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_DISABLED => {
2042+ ThreeFingerDragState :: Disabled
2043+ }
2044+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_ENABLED_3FG => {
2045+ ThreeFingerDragState :: EnabledThreeFinger
2046+ }
2047+ ffi:: libinput_config_3fg_drag_state_LIBINPUT_CONFIG_3FG_DRAG_ENABLED_4FG => {
2048+ ThreeFingerDragState :: EnabledFourFinger
2049+ }
2050+ _ => panic ! ( "libinput returned invalid 'libinput_config_3fg_drag_state'" ) ,
2051+ }
2052+ }
2053+
19682054 /// Set the finger number to button number mapping for
19692055 /// tap-to-click.
19702056 ///
0 commit comments