-
Notifications
You must be signed in to change notification settings - Fork 104
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
Make key repeat and delay configurable #3730
base: main
Are you sure you want to change the base?
Conversation
4712763
to
9299fb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tests for the new code?
A few things need shuffling around.
Also, it would be nice to split the ConfigFile changes into a separate, precursor, PR. (They should be uncontentious and quick to land)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty reasonable! I've got a few points for improvement
9299fb6
to
a6b1793
Compare
a6b1793
to
55c6cb7
Compare
Shells can now set the repeat rate and delay based on their config file format.
55c6cb7
to
384afb6
Compare
f6f04ce
to
6a0f1b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more questions, but looking good!
|
||
auto miral::InputConfiguration::Keyboard::operator=(Keyboard that) -> Keyboard& | ||
{ | ||
std::swap(self, that.self); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would operator=
be a swap? Shouldn't there be an overrided operator=
on self
so that we copy all of its values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I copied and pasted the touchpad code to keep everything consistent, so they also do the same thing...
I'm not sure why that is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the canonical way to write an assignment operator in c++: copy into the parameter and swap with *this
.
for(auto const& helper: keyboard_helpers) | ||
helper->repeat_info_changed(repeat_rate_, repeat_delay_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If enable_key_repeat
is false, should repeat_rate_
be std::nullopt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to: https://wayland.app/protocols/wayland#wl_keyboard:event:repeat_info, "rate of zero will disable any repeating (regardless of the value of delay).". My interpretation was that we can just deliver the rate as an optional and the delay can be a normal value. It's then up to the user to interpret it. Which reminds me that I should use repeat_rate()
here as well
Note to self: Just came across this while working on something else, might be a good idea to check out mir/src/server/input/default_configuration.cpp Lines 144 to 164 in 5e15fde
|
Co-authored-by: Matthew Kosarek <matt.kosarek@canonical.com>
f66af7f
to
d484803
Compare
Very confused what this does since repeat on both wayland and X seem to work without any modification to it. Edit: From a quick skim, this seems to implement key repeat on the server. For wayland and X(wayland), the code changes here suffice. |
Initially, the config file is loaded before the server starts. The changes need some server components to be applied, so they aren't applied at that stage. The few lines added store the changes and apply them once the server starts.
miral::InputConfiguration input_configuration; | ||
auto mouse = input_configuration.mouse(); | ||
auto touchpad = input_configuration.touchpad(); | ||
auto keyboard = input_configuration.keyboard(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could grow a utility class that combines these and the repeated "apply" logic?
Also, we need to be careful: we're now accessing mouse
, touchpad
and keyboard
on multiple threads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having said that, I like the revised approach
How to test:
~/.config/mir_demo_server.input
with the following content:kgx
), or and X application (xterm
)repeat_rate
to a higher or lower value and watch as the repeat rate speeds or slows downrepeat_delay
to a higher or lower value and watch as the duration you need to hold the key down increases or decreases.