summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0fd4d0c)
raw | patch | inline | side by side (parent: 0fd4d0c)
author | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:40:29 +0000 (17:40 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 25 Sep 2008 15:40:29 +0000 (17:40 +0200) |
Without clearing previous screen contents, there may be corruptions,
make this mandatory and optimize screen clearing.
make this mandatory and optimize screen clearing.
diff --git a/src/list_window.c b/src/list_window.c
index 5a4ccf36d7906d7f9cffa8d0bb8e34d2313e96b3..e69f6ac04ee3d17885434b062fd83f747ae7aff3 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
lw->w = w;
lw->cols = width;
lw->rows = height;
- lw->clear = 1;
return lw;
}
lw->selected = 0;
lw->xoffset = 0;
lw->start = 0;
- lw->clear = 1;
}
void
lw->start = 0;
}
- lw->repaint = lw->clear = 1;
+ lw->repaint = 1;
}
void
int show_cursor = !(lw->flags & LW_HIDE_CURSOR);
if (show_cursor) {
- if (lw->selected < lw->start) {
+ if (lw->selected < lw->start)
lw->start = lw->selected;
- lw->clear=1;
- }
- if (lw->selected >= lw->start + lw->rows) {
+ if (lw->selected >= lw->start + lw->rows)
lw->start = lw->selected - lw->rows + 1;
- lw->clear=1;
- }
}
for (i = 0; i < lw->rows; i++) {
label = callback(lw->start + i, &highlight, callback_data);
wmove(lw->w, i, 0);
- if( lw->clear && (!fill || !label) )
- wclrtoeol(lw->w);
if (label) {
int selected = lw->start + i == lw->selected;
if (selected)
wattroff(lw->w, A_REVERSE);
- }
- }
- lw->clear=0;
+ if (!fill && len < lw->cols)
+ wclrtoeol(lw->w);
+ } else
+ wclrtoeol(lw->w);
+ }
}
int
return 0;
}
- lw->repaint = lw->clear = 1;
+ lw->repaint = 1;
return 1;
}
diff --git a/src/list_window.h b/src/list_window.h
index 25f5362f9b82f7ca771f4d592619b7a47fa234cd..9a348a26ab2db53050b4e51741e817c6e89b9b9f 100644 (file)
--- a/src/list_window.h
+++ b/src/list_window.h
unsigned start;
unsigned selected;
unsigned xoffset;
- int clear;
int repaint;
int flags;
} list_window_t;
/* destroy a list window (returns NULL) */
void list_window_free(struct list_window *lw);
-/* reset a list window (selected=0, start=0, clear=1) */
+/* reset a list window (selected=0, start=0) */
void list_window_reset(struct list_window *lw);
/* paint a list window */
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 4abd585c01dda3a42d27421d99d86f2d99588208..bf7e54df09034017c87a13dbb68becbed8185d6b 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
mode = LIST_ARTISTS;
}
metalist_length = g_list_length(metalist);
- browser.lw->clear = TRUE;
}
/* db updated */
switch(event) {
case BROWSE_DB_UPDATED:
D("screen_artist.c> browse_callback() [BROWSE_DB_UPDATED]\n");
- browser.lw->clear = 1;
update_metalist(c, g_strdup(artist), g_strdup(album));
break;
default:
static void
paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- browser.lw->clear = 1;
-
if (browser.filelist) {
list_window_paint(browser.lw, browser_lw_callback,
browser.filelist);
diff --git a/src/screen_file.c b/src/screen_file.c
index f2384ecb72c70650c3a3385364b14896c4314ece..8f9c6c89724d142e65755b73f057baacb2dca68d 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
static void
browse_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- browser.lw->clear = 1;
-
list_window_paint(browser.lw, browser_lw_callback, browser.filelist);
wnoutrefresh(browser.lw->w);
}
diff --git a/src/screen_help.c b/src/screen_help.c
index e440672d278036f312b168fa3205d0a874b635af..eec76d18ad62088db76339efeed5472950cef0b4 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
static void
help_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- lw->clear = 1;
list_window_paint(lw, list_callback, NULL);
wrefresh(lw->w);
}
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index 3dda0ec72554b0a3ed55b92c7c4e2cf8d212e018..38ba315c33099993b9f6de34ac012f84cd177bc1 100644 (file)
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
cmds[cmd_index].keys[key_index] = 0;
cmds[cmd_index].flags |= COMMAND_KEY_MODIFIED;
check_subcmd_length();
- lw->clear = 1;
lw->repaint = 1;
/* update key conflict flags */
check_key_bindings(cmds, NULL, 0);
static void
keydef_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- lw->clear = 1;
list_window_paint(lw, list_callback, NULL);
wrefresh(lw->w);
}
lw->selected - STATIC_SUB_ITEMS);
}
lw->repaint = 1;
- lw->clear = 1;
return 1;
case CMD_DELETE:
if (subcmd >= 0 && lw->selected >= STATIC_SUB_ITEMS)
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 9b9ea03a2f505145dcb31b51dc818cdb96518854..15258009274cffdcaff845c92c637dac658fc61a 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
/* paint new data */
if (get_cur_mode_id() == 104) { /* XXX don't use the literal number */
- lw->clear = 1;
list_window_paint(lw, list_callback, NULL);
wrefresh(lw->w);
static void
lyrics_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c)
{
- lw->clear = 1;
list_window_paint(lw, list_callback, NULL);
wrefresh(lw->w);
}
diff --git a/src/screen_play.c b/src/screen_play.c
index 6df8c9f81a7f8408924070408117576178626a5e..579d4f4ca98de25062ac9c37e4c187f96bca12d5 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
default:
break;
}
- /* make shure the playlist is repainted */
- lw->clear = 1;
+
list_window_check_selected(lw, c->playlist.list->len);
}
completion_callback_data_t *tmp = (completion_callback_data_t *)data;
screen_t *screen = tmp->screen;
- if (g_list_length(items) >= 1) {
+ if (g_list_length(items) >= 1)
screen_display_completion_list(screen, items);
- lw->clear = 1;
- }
}
int
screen_t *screen = tmp->screen;
D("post_completion()...\n");
- if (g_list_length(items) >= 1) {
+ if (g_list_length(items) >= 1)
screen_display_completion_list(screen, items);
- lw->clear = 1;
- }
if (line && line[0] && line[strlen(line) - 1] == '/' &&
string_list_find(*dir_list, line) == NULL) {
static void
play_paint(mpd_unused screen_t *screen, mpdclient_t *c)
{
- lw->clear = 1;
-
list_window_paint(lw, list_callback, (void *) c);
wnoutrefresh(lw->w);
}
diff --git a/src/screen_search.c b/src/screen_search.c
index 8242f1350088382827df26b22d8610f892bf6c8c..5995b79765a2acffc732b93605ec26ee3eb015c3 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
static void
paint(mpd_unused screen_t *screen, mpdclient_t *c)
{
- browser.lw->clear = 1;
-
if (browser.filelist) {
browser.lw->flags = 0;
list_window_paint(browser.lw, browser_lw_callback, browser.filelist);