Skip to content

Commit 428334d

Browse files
Save settings when we change shortcuts
Since I removed the save button, need to make sure we save each time something changes.
1 parent ddcd356 commit 428334d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/gui.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,10 @@ static bool slider_float(float *v, float minv, float maxv, const char *format)
968968
static void update_activation_state(void)
969969
{
970970
int i;
971+
972+
gui->item_activated = false;
973+
gui->item_deactivated = false;
974+
971975
if (ImGui::IsItemActivated()) {
972976
gui->item_activated = true;
973977
for (i = 0; i < gui->groups_count; i++) {
@@ -1468,7 +1472,11 @@ bool gui_button_right(const char *label, int icon)
14681472

14691473
bool gui_input_text(const char *label, char *txt, int size)
14701474
{
1471-
return ImGui::InputText(label, txt, size);
1475+
bool ret;
1476+
ret = ImGui::InputText(label, txt, size);
1477+
update_activation_state();
1478+
return ret;
1479+
14721480
}
14731481

14741482
bool gui_input_text_multiline(const char *label, char *buf, int size,

src/gui/settings.c

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ static int shortcut_callback(action_t *action, void *user)
3434
gui_next_column();
3535
// XXX: need to check if the inputs are valid!
3636
gui_input_text("", action->shortcut, sizeof(action->shortcut));
37+
if (gui_is_item_deactivated()) settings_save();
3738
gui_next_column();
3839
gui_pop_id();
3940
return 0;

0 commit comments

Comments
 (0)