[libinput] Rework device config writing and save enum of ScrollMode as integer

Authored by romangg on Nov 22 2016, 3:48 PM.



This is a bigger patch rewriting some part of the config saving functionality in device.cpp in order to:

  1. Make it possible to save ScrollMode as integer instead of using three booleans
  2. Simplify the addition of new keys or types in the future

Changes in detail:
a) Added new ConfigKey ScrollMethod and removed now unnecessary keys per method
b) Added constructors to the ConfigData struct. This allows to create ConfigData entries for s_configData without the need of stating empty brackets and allows default values. I switched to plain member function pointers instead of std::function, because I had compile errors all the time with std::function. Adding a new ConfigKey is possible without touching the member function pointer though. Only when a new type is added, it is necessary to copy-paste one of the old pointer definitions as a new struct and its constructor.
c) Cleaned up ScrollMethod functions and added interface methods for transforming the saved integer into type enum libinput_config_scroll_method.
d) Adjusted auto test for loading the ScrollMethod value from the config file.

Test Plan

Adapted unit tests and tested manually in Wayland session via qdbus.

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
romangg updated this revision to Diff 8411.Nov 22 2016, 3:48 PM
romangg retitled this revision from to [libinput] Rework device config writing and save enum of ScrollMode as integer.
romangg updated this object.
romangg edited the test plan for this revision. (Show Details)
romangg added reviewers: KWin, graesslin.
romangg set the repository for this revision to R108 KWin.
romangg added a project: KWin.
romangg added a subscriber: KWin.
Restricted Application added a subscriber: kwin. · View Herald TranscriptNov 22 2016, 3:48 PM
graesslin accepted this revision.Nov 22 2016, 3:52 PM
graesslin edited edge metadata.
This revision is now accepted and ready to land.Nov 22 2016, 3:52 PM
This revision was automatically updated to reflect the committed changes.