mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-08 07:33:53 +01:00
When setting a button action, update our internal state on success
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
This commit is contained in:
@@ -952,6 +952,9 @@ ratbag_button_set_button(struct ratbag_button *button, unsigned int btn)
|
||||
|
||||
rc = button->profile->device->driver->write_button(button, &action);
|
||||
|
||||
if (rc == 0)
|
||||
button->action = action;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -981,6 +984,9 @@ ratbag_button_set_special(struct ratbag_button *button,
|
||||
|
||||
rc = button->profile->device->driver->write_button(button, &action);
|
||||
|
||||
if (rc == 0)
|
||||
button->action = action;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1017,6 +1023,9 @@ ratbag_button_set_key(struct ratbag_button *button,
|
||||
action.action.key.key = key;
|
||||
rc = button->profile->device->driver->write_button(button, &action);
|
||||
|
||||
if (rc == 0)
|
||||
button->action = action;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1032,6 +1041,9 @@ ratbag_button_disable(struct ratbag_button *button)
|
||||
action.type = RATBAG_BUTTON_ACTION_TYPE_NONE;
|
||||
rc = button->profile->device->driver->write_button(button, &action);
|
||||
|
||||
if (rc == 0)
|
||||
button->action = action;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user