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