Code

screen: export the global variable "screen"
authorMax Kellermann <max@duempel.org>
Fri, 3 Oct 2008 12:31:00 +0000 (14:31 +0200)
committerMax Kellermann <max@duempel.org>
Fri, 3 Oct 2008 12:31:00 +0000 (14:31 +0200)
screen_t is a singleton.  We do not have to pass it around
everywhere.  Export the one global variable.

14 files changed:
src/screen.c
src/screen.h
src/screen_artist.c
src/screen_browser.c
src/screen_browser.h
src/screen_file.c
src/screen_help.c
src/screen_keydef.c
src/screen_lyrics.c
src/screen_play.c
src/screen_play.h
src/screen_search.c
src/screen_utils.c
src/screen_utils.h

index 5345f49ef8665bca530a20689d533742797d1a64..ea6d5d4bad36e2c88f9eec0c23cfd0ee76d1bc89 100644 (file)
@@ -51,7 +51,7 @@ static const int SCREEN_MIN_ROWS = 5;
 /* screens */
 
 static gboolean welcome = TRUE;
-static struct screen screen;
+struct screen screen;
 static const struct screen_functions *mode_fn = &screen_playlist;
 static int seek_id = -1;
 static int seek_target_time = 0;
@@ -79,7 +79,7 @@ screen_switch(const struct screen_functions *sf, struct mpdclient *c)
 
        /* open the new mode */
        if (mode_fn->open != NULL)
-               mode_fn->open(&screen, c);
+               mode_fn->open(c);
 
        screen_paint(c);
 }
@@ -522,7 +522,7 @@ screen_init(mpdclient_t *c)
                         screen.main_window.cols, screen.main_window.rows);
 
        if (mode_fn->open != NULL)
-               mode_fn->open(&screen, c);
+               mode_fn->open(c);
 
        /* initialize wreadln */
        wrln_wgetch = my_wgetch;
@@ -764,7 +764,7 @@ screen_cmd(mpdclient_t *c, command_t cmd)
        screen.last_cmd = cmd;
        welcome = FALSE;
 
-       if (mode_fn->cmd != NULL && mode_fn->cmd(&screen, c, cmd))
+       if (mode_fn->cmd != NULL && mode_fn->cmd(c, cmd))
                return;
 
        if (screen_client_cmd(c, cmd))
index 976c75c9012dc0bce8b1fdfce39f0767f0da2715..ef7940a31e45dfcda744f6d2633065b3c479d039 100644 (file)
@@ -19,7 +19,7 @@ struct window {
        unsigned rows, cols;
 };
 
-typedef struct screen {
+struct screen {
        struct window top_window;
        struct window main_window;
        struct window progress_window;
@@ -38,7 +38,9 @@ typedef struct screen {
 
        char *findbuf;
        GList *find_history;
-} screen_t;
+};
+
+extern struct screen screen;
 
 extern const struct screen_functions screen_playlist;
 extern const struct screen_functions screen_browse;
@@ -59,12 +61,12 @@ extern const struct screen_functions screen_lyrics;
 typedef struct screen_functions {
        void (*init)(WINDOW *w, int cols, int rows);
        void (*exit)(void);
-       void (*open)(struct screen *screen, mpdclient_t *c);
+       void (*open)(mpdclient_t *c);
        void (*close)(void);
        void (*resize)(int cols, int rows);
        void (*paint)(void);
        void (*update)(mpdclient_t *c);
-       int (*cmd)(struct screen *scr, mpdclient_t *c, command_t cmd);
+       int (*cmd)(mpdclient_t *c, command_t cmd);
        const char *(*get_title)(char *s, size_t size);
 } screen_functions_t;
 
index 52b7eeee8727753ec4ffd92d9edf3d998f8e4dff..846902e0a4807d09cfcc0216be595887d359ec45 100644 (file)
@@ -331,7 +331,7 @@ quit(void)
 }
 
 static void
-open(mpd_unused screen_t *screen, mpdclient_t *c)
+open(mpdclient_t *c)
 {
        static gboolean callback_installed = FALSE;
 
@@ -434,7 +434,7 @@ metalist_length(void)
 }
 
 static int
-artist_lw_cmd(struct screen *screen, struct mpdclient *c, command_t cmd)
+artist_lw_cmd(struct mpdclient *c, command_t cmd)
 {
        switch (mode) {
        case LIST_ARTISTS:
@@ -442,7 +442,7 @@ artist_lw_cmd(struct screen *screen, struct mpdclient *c, command_t cmd)
                return list_window_cmd(browser.lw, metalist_length(), cmd);
 
        case LIST_SONGS:
-               return browser_cmd(&browser, screen, c, cmd);
+               return browser_cmd(&browser, c, cmd);
        }
 
        assert(0);
@@ -463,7 +463,7 @@ string_array_find(GPtrArray *array, const char *value)
 }
 
 static int
-artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
+artist_cmd(mpdclient_t *c, command_t cmd)
 {
        char *selected;
        char *old;
@@ -641,15 +641,13 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
        case CMD_LIST_RFIND_NEXT:
                switch (mode) {
                case LIST_ARTISTS:
-                       screen_find(screen,
-                                   browser.lw, artist_list->len,
+                       screen_find(browser.lw, artist_list->len,
                                    cmd, artist_lw_callback, artist_list);
                        artist_repaint();
                        return 1;
 
                case LIST_ALBUMS:
-                       screen_find(screen,
-                                   browser.lw, album_list->len + 2,
+                       screen_find(browser.lw, album_list->len + 2,
                                    cmd, artist_lw_callback, album_list);
                        artist_repaint();
                        return 1;
@@ -665,7 +663,7 @@ artist_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
                break;
        }
 
-       if (artist_lw_cmd(screen, c, cmd)) {
+       if (artist_lw_cmd(c, cmd)) {
                artist_repaint();
                return 1;
        }
index e68e7028556ac27feac7825754b4b09f99e7d40a..00965edb0e07e493f61ac4ef07d34da79525ad60 100644 (file)
@@ -453,7 +453,7 @@ browser_handle_mouse_event(struct screen_browser *browser, mpdclient_t *c)
 #endif
 
 bool
-browser_cmd(struct screen_browser *browser, struct screen *screen,
+browser_cmd(struct screen_browser *browser,
            struct mpdclient *c, command_t cmd)
 {
        struct filelist_entry *entry;
@@ -487,8 +487,7 @@ browser_cmd(struct screen_browser *browser, struct screen *screen,
        case CMD_LIST_RFIND:
        case CMD_LIST_FIND_NEXT:
        case CMD_LIST_RFIND_NEXT:
-               screen_find(screen,
-                           browser->lw, filelist_length(browser->filelist),
+               screen_find(browser->lw, filelist_length(browser->filelist),
                            cmd, browser_lw_callback,
                            browser->filelist);
                return true;
index 17e41f6ec06094bce455693c90ce88cf5af179c6..802886aa0b75b8e167c9b222a9245782a6ecbe3c 100644 (file)
@@ -49,7 +49,7 @@ browser_change_directory(struct screen_browser *browser, mpdclient_t *c,
                         filelist_entry_t *entry, const char *new_path);
 
 bool
-browser_cmd(struct screen_browser *browser, struct screen *screen,
+browser_cmd(struct screen_browser *browser,
            struct mpdclient *c, command_t cmd);
 
 #endif
index 9dfe4ac6892d8822c7b4e0aded8326237384b353..bef155f5948e10669e9c728c56b54bc2c2efa979 100644 (file)
@@ -75,7 +75,7 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
 }
 
 static int
-handle_save(screen_t *screen, mpdclient_t *c)
+handle_save(mpdclient_t *c)
 {
        filelist_entry_t *entry;
        char *defaultname = NULL;
@@ -92,11 +92,11 @@ handle_save(screen_t *screen, mpdclient_t *c)
                }
        }
 
-       return playlist_save(screen, c, NULL, defaultname);
+       return playlist_save(c, NULL, defaultname);
 }
 
 static int
-handle_delete(screen_t *screen, mpdclient_t *c)
+handle_delete(mpdclient_t *c)
 {
        filelist_entry_t *entry;
        mpd_InfoEntity *entity;
@@ -123,7 +123,7 @@ handle_delete(screen_t *screen, mpdclient_t *c)
        str = utf8_to_locale(g_basename(plf->path));
        buf = g_strdup_printf(_("Delete playlist %s [%s/%s] ? "), str, YES, NO);
        g_free(str);
-       key = tolower(screen_getch(screen->status_window.w, buf));
+       key = tolower(screen_getch(screen.status_window.w, buf));
        g_free(buf);
        if( key != YES[0] ) {
                screen_status_printf(_("Aborted!"));
@@ -159,7 +159,7 @@ browse_exit(void)
 }
 
 static void
-browse_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
+browse_open(mpd_unused mpdclient_t *c)
 {
        if (browser.filelist == NULL) {
                browser.filelist = mpdclient_filelist_get(c, "");
@@ -196,7 +196,7 @@ browse_paint(void)
 }
 
 static int
-browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
+browse_cmd(mpdclient_t *c, command_t cmd)
 {
        switch(cmd) {
        case CMD_GO_ROOT_DIRECTORY:
@@ -209,11 +209,11 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
                return 1;
 
        case CMD_DELETE:
-               handle_delete(screen, c);
+               handle_delete(c);
                file_repaint();
                break;
        case CMD_SAVE_PLAYLIST:
-               handle_save(screen, c);
+               handle_save(c);
                break;
        case CMD_SCREEN_UPDATE:
                browser.filelist = mpdclient_filelist_update(c, browser.filelist);
@@ -249,7 +249,7 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
                break;
        }
 
-       if (browser_cmd(&browser, screen, c, cmd)) {
+       if (browser_cmd(&browser, c, cmd)) {
                file_repaint();
                return 1;
        }
index fbcbf2b820f4fc40200415c93708fb2f292fea3d..3b66403d7c88202be2245ae69ed69e1781107e99 100644 (file)
@@ -213,7 +213,7 @@ help_paint(void)
 }
 
 static int
-help_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd)
+help_cmd(mpd_unused mpdclient_t *c, command_t cmd)
 {
        if (list_window_scroll_cmd(lw, help_text_rows, cmd)) {
                list_window_paint(lw, list_callback, NULL);
@@ -222,8 +222,7 @@ help_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd)
        }
 
        lw->selected = lw->start+lw->rows;
-       if (screen_find(screen,
-                       lw,  help_text_rows,
+       if (screen_find(lw,  help_text_rows,
                        cmd, list_callback, NULL)) {
                /* center the row */
                list_window_center(lw, help_text_rows, lw->selected);
index b84289d5bb1e8bdcee6767125685e7d4db9c54fb..86faabaf403da448279f67e8f994095571e12604 100644 (file)
@@ -246,7 +246,7 @@ keydef_exit(void)
 }
 
 static void
-keydef_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
+keydef_open(mpd_unused mpdclient_t *c)
 {
        if (cmds == NULL) {
                command_definition_t *current_cmds = get_command_definitions();
@@ -294,7 +294,7 @@ keydef_paint(void)
 }
 
 static int
-keydef_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd)
+keydef_cmd(mpd_unused mpdclient_t *c, command_t cmd)
 {
        int length = LIST_LENGTH();
 
@@ -328,7 +328,7 @@ keydef_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd)
 
                                keydef_repaint();
                        } else
-                               assign_new_key(screen->status_window.w,
+                               assign_new_key(screen.status_window.w,
                                               subcmd,
                                               lw->selected - STATIC_SUB_ITEMS);
                }
@@ -346,8 +346,7 @@ keydef_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd)
        case CMD_LIST_RFIND:
        case CMD_LIST_FIND_NEXT:
        case CMD_LIST_RFIND_NEXT:
-               screen_find(screen,
-                           lw, length,
+               screen_find(lw, length,
                            cmd, list_callback, NULL);
                keydef_repaint();
                return 1;
index be99e6b750847a511484f37be22053f164ce4d30..2a8e10b67fad0f6bc4c180994bdc37d17492c006 100644 (file)
@@ -264,7 +264,7 @@ lyrics_exit(void)
 }
 
 static void
-lyrics_open(mpd_unused screen_t *screen, mpdclient_t *c)
+lyrics_open(mpdclient_t *c)
 {
        if (next_song == NULL)
                next_song = c->song;
@@ -297,7 +297,7 @@ lyrics_paint(void)
 }
 
 static int
-lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
+lyrics_cmd(mpdclient_t *c, command_t cmd)
 {
        if (list_window_scroll_cmd(lw, current.lines->len, cmd)) {
                lyrics_repaint();
@@ -327,8 +327,7 @@ lyrics_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
        }
 
        lw->selected = lw->start+lw->rows;
-       if (screen_find(screen,
-                       lw, current.lines->len,
+       if (screen_find(lw, current.lines->len,
                        cmd, list_callback, NULL)) {
                /* center the row */
                list_window_center(lw, current.lines->len, lw->selected);
index 4b285c533c52b9add633fc33900e49841d24517d..37705c559d4a8800df1903d575b93b4c2e19200a 100644 (file)
@@ -44,7 +44,6 @@ typedef struct
 {
        GList **list;
        GList **dir_list;
-       screen_t *screen;
        mpdclient_t *c;
 } completion_callback_data_t;
 
@@ -145,17 +144,14 @@ save_pre_completion_cb(GCompletion *gcmp, mpd_unused gchar *line, void *data)
 
 static void
 save_post_completion_cb(mpd_unused GCompletion *gcmp, mpd_unused gchar *line,
-                       GList *items, void *data)
+                       GList *items, mpd_unused void *data)
 {
-       completion_callback_data_t *tmp = (completion_callback_data_t *)data;
-       screen_t *screen = tmp->screen;
-
        if (g_list_length(items) >= 1)
-               screen_display_completion_list(screen, items);
+               screen_display_completion_list(items);
 }
 
 int
-playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
+playlist_save(mpdclient_t *c, char *name, char *defaultname)
 {
        gchar *filename;
        gint error;
@@ -169,7 +165,6 @@ playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
                g_completion_set_compare(gcmp, strncmp);
                data.list = &list;
                data.dir_list = NULL;
-               data.screen = screen;
                data.c = c;
                wrln_completion_callback_data = &data;
                wrln_pre_completion_callback = save_pre_completion_cb;
@@ -177,7 +172,7 @@ playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
 
 
                /* query the user for a filename */
-               filename = screen_readln(screen->status_window.w,
+               filename = screen_readln(screen.status_window.w,
                                         _("Save playlist as: "),
                                         defaultname,
                                         NULL,
@@ -207,7 +202,7 @@ playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
 
                        buf = g_strdup_printf(_("Replace %s [%s/%s] ? "),
                                              filename, YES, NO);
-                       key = tolower(screen_getch(screen->status_window.w,
+                       key = tolower(screen_getch(screen.status_window.w,
                                                   buf));
                        g_free(buf);
 
@@ -217,7 +212,7 @@ playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
                                        return -1;
                                }
 
-                               error = playlist_save(screen, c, filename, NULL);
+                               error = playlist_save(c, filename, NULL);
                                g_free(filename);
                                return error;
                        }
@@ -270,10 +265,9 @@ static void add_post_completion_cb(GCompletion *gcmp, gchar *line,
        GList **dir_list = tmp->dir_list;
        GList **list = tmp->list;
        mpdclient_t *c = tmp->c;
-       screen_t *screen = tmp->screen;
 
        if (g_list_length(items) >= 1)
-               screen_display_completion_list(screen, items);
+               screen_display_completion_list(items);
 
        if (line && line[0] && line[strlen(line) - 1] == '/' &&
            string_list_find(*dir_list, line) == NULL) {
@@ -283,7 +277,7 @@ static void add_post_completion_cb(GCompletion *gcmp, gchar *line,
 }
 
 static int
-handle_add_to_playlist(screen_t *screen, mpdclient_t *c)
+handle_add_to_playlist(mpdclient_t *c)
 {
        gchar *path;
        GCompletion *gcmp;
@@ -296,14 +290,13 @@ handle_add_to_playlist(screen_t *screen, mpdclient_t *c)
        g_completion_set_compare(gcmp, strncmp);
        data.list = &list;
        data.dir_list = &dir_list;
-       data.screen = screen;
        data.c = c;
        wrln_completion_callback_data = &data;
        wrln_pre_completion_callback = add_pre_completion_cb;
        wrln_post_completion_callback = add_post_completion_cb;
 
        /* get path */
-       path = screen_readln(screen->status_window.w,
+       path = screen_readln(screen.status_window.w,
                             _("Add: "),
                             NULL,
                             NULL,
@@ -353,7 +346,7 @@ timer_hide_cursor(gpointer data)
 }
 
 static void
-play_open(mpd_unused screen_t *screen, mpdclient_t *c)
+play_open(mpdclient_t *c)
 {
        static gboolean install_cb = TRUE;
 
@@ -471,7 +464,7 @@ handle_mouse_event(struct mpdclient *c)
 #endif
 
 static int
-play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
+play_cmd(mpdclient_t *c, command_t cmd)
 {
        lw->flags &= ~LW_HIDE_CURSOR;
 
@@ -495,10 +488,10 @@ play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
                mpdclient_cmd_delete(c, lw->selected);
                return 1;
        case CMD_SAVE_PLAYLIST:
-               playlist_save(screen, c, NULL, NULL);
+               playlist_save(c, NULL, NULL);
                return 1;
        case CMD_ADD:
-               handle_add_to_playlist(screen, c);
+               handle_add_to_playlist(c);
                return 1;
        case CMD_SCREEN_UPDATE:
                center_playing_item(c);
@@ -515,8 +508,7 @@ play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
        case CMD_LIST_RFIND:
        case CMD_LIST_FIND_NEXT:
        case CMD_LIST_RFIND_NEXT:
-               screen_find(screen,
-                           lw, playlist_length(&c->playlist),
+               screen_find(lw, playlist_length(&c->playlist),
                            cmd, list_callback, NULL);
                playlist_repaint();
                return 1;
index 36d57a2fad07fb5335f4182407dce45c8ecd062b..3ff3cb02aa56f5c40eda22902e27e7bb24e6419c 100644 (file)
@@ -1,2 +1,2 @@
 
-int playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname);
+int playlist_save(mpdclient_t *c, char *name, char *defaultname);
index bf9278b53fa4c6280c946c486fad02ed8f042660..4e2f922ec0caa39c7bf669eedb10857732378a2c 100644 (file)
@@ -161,7 +161,7 @@ search_check_mode(void)
 }
 
 static void
-search_clear(mpd_unused screen_t *screen, mpdclient_t *c,
+search_clear(mpdclient_t *c,
             gboolean clear_pattern)
 {
        if (browser.filelist) {
@@ -300,11 +300,11 @@ search_advanced_query(char *query, mpdclient_t *c)
 }
 
 static void
-search_new(screen_t *screen, mpdclient_t *c)
+search_new(mpdclient_t *c)
 {
-       search_clear(screen, c, TRUE);
+       search_clear(c, TRUE);
 
-       pattern = screen_readln(screen->status_window.w,
+       pattern = screen_readln(screen.status_window.w,
                                _("Search: "),
                                NULL,
                                &search_history,
@@ -360,7 +360,7 @@ quit(void)
 }
 
 static void
-open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
+open(mpd_unused mpdclient_t *c)
 {
        //  if( pattern==NULL )
        //    search_new(screen, c);
@@ -408,7 +408,7 @@ get_title(char *str, size_t size)
 }
 
 static int
-search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
+search_cmd(mpdclient_t *c, command_t cmd)
 {
        switch (cmd) {
        case CMD_SEARCH_MODE:
@@ -420,7 +420,7 @@ search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
                /* continue and update... */
        case CMD_SCREEN_UPDATE:
                if (pattern) {
-                       search_clear(screen, c, FALSE);
+                       search_clear(c, FALSE);
                        browser.filelist = filelist_search(c,
                                                          FALSE,
                                                          mode[options.search_mode].table,
@@ -431,12 +431,12 @@ search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
                return 1;
 
        case CMD_SCREEN_SEARCH:
-               search_new(screen, c);
+               search_new(c);
                search_repaint();
                return 1;
 
        case CMD_CLEAR:
-               search_clear(screen, c, TRUE);
+               search_clear(c, TRUE);
                list_window_reset(browser.lw);
                search_repaint();
                return 1;
@@ -446,7 +446,7 @@ search_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
        }
 
        if (browser.filelist != NULL &&
-           browser_cmd(&browser, screen, c, cmd)) {
+           browser_cmd(&browser, c, cmd)) {
                search_repaint();
                return 1;
        }
index d83015503abd4310bdc268239fb4d2b694359e01..5134756163f4686865e96783d0a86844f9e3fbda 100644 (file)
@@ -143,8 +143,7 @@ screen_auth(struct mpdclient *c)
 
 /* query user for a string and find it in a list window */
 int
-screen_find(screen_t *screen,
-           list_window_t *lw,
+screen_find(list_window_t *lw,
            int rows,
            command_t findcmd,
            list_window_callback_fn_t callback_fn,
@@ -163,40 +162,41 @@ screen_find(screen_t *screen,
        switch (findcmd) {
        case CMD_LIST_FIND:
        case CMD_LIST_RFIND:
-               if (screen->findbuf) {
-                       g_free(screen->findbuf);
-                       screen->findbuf=NULL;
+               if (screen.findbuf) {
+                       g_free(screen.findbuf);
+                       screen.findbuf=NULL;
                }
                /* continue... */
 
        case CMD_LIST_FIND_NEXT:
        case CMD_LIST_RFIND_NEXT:
-               if (!screen->findbuf)
-                       screen->findbuf=screen_readln(screen->status_window.w,
-                                                     prompt,
-                                                     value,
-                                                     &screen->find_history,
-                                                     NULL);
-
-               if (!screen->findbuf || !screen->findbuf[0])
+               if (!screen.findbuf)
+                       screen.findbuf=screen_readln(screen.status_window.w,
+                                                    prompt,
+                                                    value,
+                                                    &screen.find_history,
+                                                    NULL);
+
+               if (!screen.findbuf || !screen.findbuf[0])
                        return 1;
 
                if (reversed)
                        retval = list_window_rfind(lw,
                                                   callback_fn,
                                                   callback_data,
-                                                  screen->findbuf,
+                                                  screen.findbuf,
                                                   options.find_wrap,
                                                   rows);
                else
                        retval = list_window_find(lw,
                                                  callback_fn,
                                                  callback_data,
-                                                 screen->findbuf,
+                                                 screen.findbuf,
                                                  options.find_wrap);
 
                if (retval != 0) {
-                       screen_status_printf(_("Unable to find \'%s\'"), screen->findbuf);
+                       screen_status_printf(_("Unable to find \'%s\'"),
+                                            screen.findbuf);
                        screen_bell();
                }
                return 1;
@@ -207,17 +207,17 @@ screen_find(screen_t *screen,
 }
 
 void
-screen_display_completion_list(screen_t *screen, GList *list)
+screen_display_completion_list(GList *list)
 {
        static GList *prev_list = NULL;
        static guint prev_length = 0;
        static guint offset = 0;
-       WINDOW *w = screen->main_window.w;
+       WINDOW *w = screen.main_window.w;
        guint length, y=0;
 
        length = g_list_length(list);
        if (list == prev_list && length == prev_length) {
-               offset += screen->main_window.rows;
+               offset += screen.main_window.rows;
                if (offset >= length)
                        offset = 0;
        } else {
@@ -227,7 +227,7 @@ screen_display_completion_list(screen_t *screen, GList *list)
        }
 
        colors_use(w, COLOR_STATUS_ALERT);
-       while (y < screen->main_window.rows) {
+       while (y < screen.main_window.rows) {
                GList *item = g_list_nth(list, y+offset);
 
                wmove(w, y++, 0);
index 74ca7d0126704707c9716ca4b3825d2cb3c6dff9..a550f17428301d6864bcd6da274ff3ebbe9fbd0f 100644 (file)
@@ -6,7 +6,6 @@
 
 #include <ncurses.h>
 
-struct screen;
 struct mpdclient;
 
 /* sound an audible and/or visible bell */
@@ -22,8 +21,7 @@ char *screen_readln(WINDOW *w, const char *prompt, const char *value,
 char *screen_readln_masked(WINDOW *w, const char *prompt);
 char *screen_read_pasword(WINDOW *w, const char *prompt);
 /* query user for a string and find it in a list window */
-int screen_find(struct screen *screen,
-               struct list_window *lw,
+int screen_find(struct list_window *lw,
                int rows,
                command_t findcmd,
                list_window_callback_fn_t callback_fn,
@@ -31,7 +29,7 @@ int screen_find(struct screen *screen,
 
 gint screen_auth(struct mpdclient *c);
 
-void screen_display_completion_list(struct screen *screen, GList *list);
+void screen_display_completion_list(GList *list);
 
 void set_xterm_title(const char *format, ...);