Skip to content

Commit

Permalink
Add an option to disable tap-and-drag gesture (#2593)
Browse files Browse the repository at this point in the history
  • Loading branch information
jihem-el authored Mar 1, 2025
1 parent 2ff6b3b commit aec7453
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions metadata/input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@
<_long>Enables or disables natural (inverted) scrolling.</_long>
<default>false</default>
</option>
<option name="tap_and_drag" type="bool">
<_short>Tap and drag</_short>
<_long>Enables or disables tap-and-drag.</_long>
<default>true</default>
</option>
<option name="drag_lock" type="bool">
<_short>Drag lock</_short>
<_long>Enables or disables drag lock.</_long>
Expand Down
6 changes: 6 additions & 0 deletions src/core/seat/pointing-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void wf::pointing_device_t::load_options()
touchpad_dwt_enabled.load_option(section_name + "/disable_touchpad_while_typing");
touchpad_dwmouse_enabled.load_option(section_name + "/disable_touchpad_while_mouse");
touchpad_natural_scroll_enabled.load_option(section_name + "/natural_scroll");
touchpad_tap_and_drag_enabled.load_option(section_name + "/tap_and_drag");
touchpad_drag_lock_enabled.load_option(section_name + "/drag_lock");

mouse_accel_profile.load_option(section_name + "/mouse_accel_profile");
Expand Down Expand Up @@ -136,6 +137,11 @@ void wf::pointing_device_t::update_options()
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE :
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED);

libinput_device_config_tap_set_drag_enabled(dev,
touchpad_tap_and_drag_enabled ?
LIBINPUT_CONFIG_DRAG_ENABLED :
LIBINPUT_CONFIG_DRAG_DISABLED);

libinput_device_config_tap_set_drag_lock_enabled(dev,
touchpad_drag_lock_enabled ?
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED :
Expand Down
1 change: 1 addition & 0 deletions src/core/seat/pointing-device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct pointing_device_t : public input_device_impl_t
wf::option_wrapper_t<bool> touchpad_dwmouse_enabled;
wf::option_wrapper_t<bool> touchpad_natural_scroll_enabled;
wf::option_wrapper_t<bool> mouse_natural_scroll_enabled;
wf::option_wrapper_t<bool> touchpad_tap_and_drag_enabled;
wf::option_wrapper_t<bool> touchpad_drag_lock_enabled;
};
}
Expand Down

0 comments on commit aec7453

Please sign in to comment.