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