Add a "none" button type for disabled buttons

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2015-08-19 14:10:32 -04:00
parent ace830eb91
commit e3f9e0ffc0
3 changed files with 12 additions and 7 deletions

View File

@@ -115,6 +115,7 @@ struct etekcity_button_mapping {
};
static struct etekcity_button_mapping etekcity_button_mapping[] = {
{ 0, RATBAG_BUTTON_TYPE_NONE },
{ 1, RATBAG_BUTTON_TYPE_LEFT },
{ 2, RATBAG_BUTTON_TYPE_RIGHT },
{ 3, RATBAG_BUTTON_TYPE_MIDDLE },
@@ -290,13 +291,11 @@ etekcity_read_button(struct ratbag_device *device, struct ratbag_profile *profil
unsigned index = etekcity_button_to_index(button->index);
data = drv_data->profiles[profile->index][3 + index * 3];
if (data) {
log_debug(device->ratbag,
" - button%d: %s (%02x) %s:%d\n",
button->index, print_key(data), data, __FILE__, __LINE__);
button->type = etekcity_raw_to_button_type(data);
button->action_type = etekcity_raw_to_action(data, button->type);
}
log_debug(device->ratbag,
" - button%d: %s (%02x) %s:%d\n",
button->index, print_key(data), data, __FILE__, __LINE__);
button->type = etekcity_raw_to_button_type(data);
button->action_type = etekcity_raw_to_action(data, button->type);
}
static int

View File

@@ -500,6 +500,9 @@ enum ratbag_button_type {
RATBAG_BUTTON_TYPE_KEY_REFRESH,
RATBAG_BUTTON_TYPE_KEY_HOMEPAGE,
RATBAG_BUTTON_TYPE_KEY_SEARCH,
/* disabled button */
RATBAG_BUTTON_TYPE_NONE,
};
/**

View File

@@ -174,6 +174,9 @@ button_type_to_str(enum ratbag_button_type type)
case RATBAG_BUTTON_TYPE_KEY_REFRESH: str = "key refresh"; break;
case RATBAG_BUTTON_TYPE_KEY_HOMEPAGE: str = "key homepage"; break;
case RATBAG_BUTTON_TYPE_KEY_SEARCH: str = "key search"; break;
/* disabled button */
case RATBAG_BUTTON_TYPE_NONE: str = "none"; break;
}
return str;