Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mouse scroll #1962

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions metadata/input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,29 @@
<default>1.0</default>
<min>0.0</min>
</option>
<option name="mouse_scroll_button" type="int">
<_short>Mouse scroll button</_short>
<_long>Changes the mouse scroll button.</_long>
<default>0</default>
<min>0</min>
</option>
<option name="mouse_scroll_method" type="string">
<_short>Mouse Scroll method</_short>
<_long>Changes the mouse scroll method.</_long>
<default>default</default>
<desc>
<value>default</value>
<_name>Default</_name>
</desc>
<desc>
<value>none</value>
<_name>None</_name>
</desc>
<desc>
<value>on-button-down</value>
<_name>On-button-down</_name>
</desc>
</option>
</group>
<!-- Touchpad -->
<group>
Expand Down
19 changes: 19 additions & 0 deletions src/core/seat/pointing-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ void wf::pointing_device_t::config_t::load()

mouse_scroll_speed.load_option("input/mouse_scroll_speed");
mouse_cursor_speed.load_option("input/mouse_cursor_speed");
mouse_scroll_button.load_option("input/mouse_scroll_button");
mouse_scroll_method.load_option("input/mouse_scroll_method");
touchpad_cursor_speed.load_option("input/touchpad_cursor_speed");
touchpad_scroll_speed.load_option("input/touchpad_scroll_speed");

Expand Down Expand Up @@ -64,6 +66,23 @@ void wf::pointing_device_t::update_options()

libinput_device_config_left_handed_set(dev, config.left_handed_mode);

if ((std::string)config.mouse_scroll_method == "default")
{
libinput_device_config_scroll_set_method(dev,
libinput_device_config_scroll_get_default_method(dev));
} else if ((std::string)config.mouse_scroll_method == "none")
{
libinput_device_config_scroll_set_method(dev,
LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
} else if ( ((std::string)config.mouse_scroll_method == "on-button-down") &&
((int)config.mouse_scroll_button != 0))
{
libinput_device_config_scroll_set_method(dev,
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN);
libinput_device_config_scroll_set_button(dev,
(int)config.mouse_scroll_button);
}

libinput_device_config_middle_emulation_set_enabled(dev,
config.middle_emulation ?
LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED :
Expand Down
2 changes: 2 additions & 0 deletions src/core/seat/pointing-device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ struct pointing_device_t : public input_device_impl_t
wf::option_wrapper_t<bool> middle_emulation;
wf::option_wrapper_t<double> mouse_cursor_speed;
wf::option_wrapper_t<double> mouse_scroll_speed;
wf::option_wrapper_t<int> mouse_scroll_button;
wf::option_wrapper_t<std::string> mouse_scroll_method;
wf::option_wrapper_t<std::string> tablet_motion_mode;
wf::option_wrapper_t<double> touchpad_cursor_speed;
wf::option_wrapper_t<double> touchpad_scroll_speed;
Expand Down