summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f776336)
raw | patch | inline | side by side (parent: f776336)
author | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 10:06:14 +0000 (12:06 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Wed, 17 Sep 2008 10:06:14 +0000 (12:06 +0200) |
src/screen.c | patch | blob | history |
diff --git a/src/screen.c b/src/screen.c
index 797eae2ac9a2d69fbb8801b7f25152cd5b827730..91b4c26a1bcb4a8f33aaca09f793ac019c00b095 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
mode_fn->open(screen, c);
}
+static int
+find_configured_screen(const char *name)
+{
+ unsigned i;
+
+ for (i = 0; options.screen_list[i] != NULL; ++i)
+ if (strcmp(options.screen_list[i], name) == 0)
+ return i;
+
+ return -1;
+}
+
static void
screen_next_mode(mpdclient_t *c, int offset)
{
int max = g_strv_length(options.screen_list);
int current, next;
- int i;
/* find current screen */
- current = -1;
- i = 0;
- while (options.screen_list[i]) {
- if (strcmp(options.screen_list[i],
- screens[screen->mode].name) == 0)
- current = i;
- i++;
- }
-
+ current = find_configured_screen(screens[screen->mode].name);
next = current + offset;
if (next<0)
next = max-1;