summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1230f84)
raw | patch | inline | side by side (parent: 1230f84)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:41:01 +0000 (17:41 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:41:01 +0000 (17:41 +0200) |
Automatically redraw the list on demand, whenever data has changed.
src/screen_keydef.c | patch | blob | history |
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index fbd9905cb4b23ac43762486ea5f5efcf5a7c130d..ad547147600168feb4614759d20a2581578039ca 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
subcmd_length += STATIC_SUB_ITEMS;
}
+static void
+keydef_paint(mpdclient_t *c);
+
+static void
+keydef_repaint(void)
+{
+ keydef_paint(NULL);
+ wrefresh(lw->w);
+}
+
static void
delete_key(int cmd_index, int key_index)
{
cmds[cmd_index].keys[key_index] = 0;
cmds[cmd_index].flags |= COMMAND_KEY_MODIFIED;
check_subcmd_length();
- lw->repaint = 1;
+
+ /* repaint */
+ keydef_repaint();
+
/* update key conflict flags */
check_key_bindings(cmds, NULL, 0);
}
screen_status_printf(_("Assigned %s to %s"),
key2str(key),cmds[cmd_index].name);
check_subcmd_length();
- lw->repaint = 1;
+
+ /* repaint */
+ keydef_repaint();
+
/* update key conflict flags */
check_key_bindings(cmds, NULL, 0);
}
list_window_paint(lw, list_callback, NULL);
}
-static void
-keydef_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
-{
- if (lw->repaint) {
- list_window_paint(lw, list_callback, NULL);
- lw->repaint = 0;
- }
-}
-
static int
keydef_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd)
{
if (subcmd >= 0)
length = subcmd_length;
+ if (list_window_cmd(lw, length, cmd)) {
+ keydef_repaint();
+ return 1;
+ }
+
switch(cmd) {
case CMD_PLAY:
if (subcmd < 0) {
subcmd = lw->selected;
lw->selected=0;
check_subcmd_length();
+
+ keydef_repaint();
}
} else {
if (lw->selected == 0) { /* up */
lw->selected = subcmd;
subcmd = -1;
+
+ keydef_repaint();
} else
assign_new_key(screen->status_window.w,
subcmd,
lw->selected - STATIC_SUB_ITEMS);
}
- lw->repaint = 1;
return 1;
case CMD_DELETE:
if (subcmd >= 0 && lw->selected >= STATIC_SUB_ITEMS)
case CMD_LIST_RFIND:
case CMD_LIST_FIND_NEXT:
case CMD_LIST_RFIND_NEXT:
- return screen_find(screen,
- lw, length,
- cmd, list_callback, NULL);
+ screen_find(screen,
+ lw, length,
+ cmd, list_callback, NULL);
+ keydef_repaint();
+ return 1;
default:
break;
}
- return list_window_cmd(lw, length, cmd);
+ return 0;
}
const struct screen_functions screen_keydef = {
.close = keydef_close,
.resize = keydef_resize,
.paint = keydef_paint,
- .update = keydef_update,
.cmd = keydef_cmd,
.get_title = keydef_title,
};