mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-08 07:33:53 +01:00
Add a "none" button type for disabled buttons
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user