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:
Peter Hutterer
2016-02-25 15:52:08 +10:00
parent de08323609
commit f58b91a9b2

View File

@@ -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;
}