Make _c_button_names private

This commit is contained in:
dokutan 2020-07-20 20:28:10 +02:00
parent 885b31f22b
commit 3f60b28c21
4 changed files with 18 additions and 8 deletions

View file

@ -239,20 +239,25 @@ class mouse_m709 : public rd_mouse{
int dump_settings( std::ostream& output );
/**
* \brief Read the settings and print the configuration in .ini format to output.
* This does not alter the internal settings of the mouse_m908 class.
* This does not alter the internal settings of the mouse_m709 class.
*/
int read_and_print_settings( std::ostream& output );
/**
* \brief Read the settings and print the configuration in .ini format to output.
* This updates the internal settings of the mouse_m908 class.
* This updates the internal settings of the mouse_m709 class.
*/
int read_settings();
/// Names of the physical buttons
static std::map< int, std::string > _c_button_names;
/// Returns a reference to _c_button_names (physical button names)
std::map< int, std::string >& button_names(){ return _c_button_names; }
private:
/// Names of the physical buttons
static std::map< int, std::string > _c_button_names;
/// whether to detach kernel driver
bool _i_detach_kernel_driver = true;

View file

@ -248,11 +248,16 @@ class mouse_m908 : public rd_mouse{
*/
int read_settings();
/// Names of the physical buttons
static std::map< int, std::string > _c_button_names;
/// Returns a reference to _c_button_names (physical button names)
std::map< int, std::string >& button_names(){ return _c_button_names; }
private:
/// Names of the physical buttons
static std::map< int, std::string > _c_button_names;
/// whether to detach kernel driver
bool _i_detach_kernel_driver = true;

View file

@ -380,7 +380,7 @@ int mouse_m908::read_and_print_settings( std::ostream& output ){
}
if( !found_name ){
output << "# unknown, please report as bug: ";
output << "unknown, please report as bug: ";
output << " " << std::hex << (int)b1 << " ";
output << " " << std::hex << (int)b2 << " ";
output << " " << std::hex << (int)b3 << " ";

View file

@ -357,7 +357,7 @@ std::string string_dump, std::string string_read ){
if( pt.get("profile"+std::to_string(i)+".report_rate", "") == "1000" ){ m.set_report_rate( profile_lut[i-1], mouse_m908::r_1000Hz ); }
// button mapping
for( auto& key : m._c_button_names ){
for( auto key : m.button_names() ){
if( pt.get("profile"+std::to_string(i)+"."+key.second, "").length() != 0 ){ m.set_key_mapping( profile_lut[i-1], key.first, pt.get("profile"+std::to_string(i)+"."+key.second, "") ); }
}