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