-
-
Notifications
You must be signed in to change notification settings - Fork 839
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
Improve fallback behavior for unset device config values #3184
Improve fallback behavior for unset device config values #3184
Conversation
db5db2e
to
a9a3e51
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.
oh, and conflict
a9a3e51
to
e36efe0
Compare
Fixed, what do you think about using the same key structure for device configs as the global config? |
not sure what you mean by that |
Nevermind, pr is ready from my side. |
I don't think this will compile xD |
It did (hold on) on my machine :), but we'll see |
also #3189 got merged in the meantime so if you could rebase against master and fix that up |
told you it wont compile :P header: you can't have |
e36efe0
to
e5b6ecd
Compare
Yeah, that's what happens when you do your first C++ coding. |
e5b6ecd
to
32a3838
Compare
Fixed, compiles, starts (tested for the latest changes this time), fixes my touchpad issue, rebased and ready for merging. |
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.
some typos.
As a next step (for the future) since we have fallbacks, we could drop the HASCONFIG and move it to CConfigManager::getConfigValueSafeDevice
I'll make another branch ready. |
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.
h
ya |
Describe your PR, what does it fix/add?
This should improve the fallback process for device specific, unset config values. It replaces the touchpad bool parameter for
getDevice...
functions with an optional fallback configuration key that describes the global configuration key to fall back to if the device specific key is unset. The previous implementation didn't quite work for me, as it would resetnatural_scroll
to disabled even when just enabling/disabling my touchpad. This should also handle conflicts between the fallback configsinput:touchdevice:transform
andinput:tablet:transform
andinput:touchdevice:output
andinput:tablet:output
better as the current implementation has a hardcoded order which preferstouchdevice:*
keys overtablet:*
keys, even for tablet devices.Alternative solution
An alternative solution would be to use the same key structure as the normal keys for device config keys. This could improve intuitiveness for users (the keys aren't just the last section and potentially conflicting) and it would make the extra fallback argument unnecessary.
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
CConfigManager::getConfigValueSafeDevice
is overloaded and spreads toCConfigManager::getDevice...
, so I originally tried to usestd::optional
(I have very little C++ experience). Is there a better way to describe an optional string reference?Is it ready for merging, or does it need work?
If it looks good and the alternative solution is not something to be implemented, it's ready 😃 .