From 9791d3094719f1ed6c3c8ecf9c006b81d0de5370 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 25 Sep 2008 21:21:00 +0200 Subject: screen: pass screen_functions pointer to switch_screen_mode() Trying to get rid of the screen ids. A pointer to screen_functions is better for identifying a screen. --- src/screen_list.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/screen_list.c') diff --git a/src/screen_list.c b/src/screen_list.c index 46e624418..76ae8b155 100644 --- a/src/screen_list.c +++ b/src/screen_list.c @@ -86,14 +86,6 @@ screen_list_resize(unsigned cols, unsigned rows) } } -int -screen_get_id_by_index(unsigned i) -{ - assert(i < NUM_SCREENS); - - return screens[i].id; -} - const char * screen_get_name(unsigned i) { @@ -102,16 +94,16 @@ screen_get_name(unsigned i) return screens[i].name; } -int -screen_get_id(const char *name) +const struct screen_functions * +screen_lookup_name(const char *name) { unsigned i; for (i = 0; i < NUM_SCREENS; ++i) if (strcmp(name, screens[i].name) == 0) - return screens[i].id; + return screens[i].functions; - return -1; + return NULL; } const struct screen_functions * @@ -123,12 +115,12 @@ screen_get_functions(unsigned i) } int -lookup_mode(int id) +lookup_mode(const struct screen_functions *sf) { unsigned i; for (i = 0; i < NUM_SCREENS; ++i) - if (screens[i].id == id) + if (screens[i].functions == sf) return i; return -1; -- cgit v1.2.3