summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4535215)
raw | patch | inline | side by side (parent: 4535215)
author | Max Kellermann <max@duempel.org> | |
Thu, 27 Nov 2008 17:05:28 +0000 (18:05 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 27 Nov 2008 17:05:28 +0000 (18:05 +0100) |
Currently, there is only one known list_window flag ("hide_cursor").
Replace the "flags" bit field with a boolean variable. If we run out
of space some day, we can convert that to bool:1.
Replace the "flags" bit field with a boolean variable. If we run out
of space some day, we can convert that to bool:1.
diff --git a/src/list_window.c b/src/list_window.c
index b12e8eb8cff56ca1644405f7303fddc16e7ac753..ea4b3c28e9366edbb8fe09ddcec0548dab305ef2 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
{
unsigned i;
bool fill = options.wide_cursor;
- bool show_cursor = !(lw->flags & LW_HIDE_CURSOR);
+ bool show_cursor = !lw->hide_cursor;
if (show_cursor) {
if (lw->selected < lw->start)
diff --git a/src/list_window.h b/src/list_window.h
index bcf3e3228913df012a59ad25ac2749d1c155869b..8e9411acbc8fe4d274f99fae391bcec97d57dac5 100644 (file)
--- a/src/list_window.h
+++ b/src/list_window.h
#include <ncurses.h>
#endif
-#define LW_HIDE_CURSOR 0x01
-
typedef const char *(*list_window_callback_fn_t)(unsigned index,
bool *highlight,
void *data);
unsigned start;
unsigned selected;
unsigned xoffset;
- int flags;
+
+ bool hide_cursor;
} list_window_t;
diff --git a/src/screen_help.c b/src/screen_help.c
index 0cc15a37a2e302800e6e7233b9a848005398aa38..c8a3d84eb83145c16423f06fa680bc868c721309 100644 (file)
--- a/src/screen_help.c
+++ b/src/screen_help.c
help_init(WINDOW *w, int cols, int rows)
{
lw = list_window_init(w, cols, rows);
- lw->flags = LW_HIDE_CURSOR;
+ lw->hide_cursor = true;
}
static void
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index d54333d0cb2b20cf412de6baadc2821eaeaf0021..e5635bd3282425f1ab888e7f48d895292c6fa843 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
{
current.lines = g_ptr_array_new();
lw = list_window_init(w, cols, rows);
- lw->flags = LW_HIDE_CURSOR;
+ lw->hide_cursor = true;
}
static void
diff --git a/src/screen_play.c b/src/screen_play.c
index 7ee0a9ff487817967d9957e100eab7111a553bbc..5acde45680fd8a16a5653ea6afea2eabad2b91c0 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
/* hide the cursor when mpd is playing and the user is inactive */
if (c->status != NULL && c->status->state == MPD_STATUS_STATE_PLAY) {
- lw->flags |= LW_HIDE_CURSOR;
+ lw->hide_cursor = true;
playlist_repaint();
} else
timer_hide_cursor_id = g_timeout_add(options.hide_cursor * 1000,
assert(timer_hide_cursor_id == 0);
if (options.hide_cursor > 0) {
- lw->flags &= ~LW_HIDE_CURSOR;
+ lw->hide_cursor = false;
timer_hide_cursor_id = g_timeout_add(options.hide_cursor * 1000,
timer_hide_cursor, c);
}
static bool
play_cmd(mpdclient_t *c, command_t cmd)
{
- lw->flags &= ~LW_HIDE_CURSOR;
+ lw->hide_cursor = false;
if (options.hide_cursor > 0) {
if (timer_hide_cursor_id != 0)
diff --git a/src/screen_search.c b/src/screen_search.c
index 3c0a18bf9ee6d6ad3afafbe59dee7008267e1427..235eeeecccec1749c84291e762fadae5db437707 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
paint(void)
{
if (browser.filelist) {
- browser.lw->flags = 0;
+ browser.lw->hide_cursor = false;
list_window_paint(browser.lw, browser_lw_callback, browser.filelist);
} else {
- browser.lw->flags = LW_HIDE_CURSOR;
+ browser.lw->hide_cursor = true;
list_window_paint(browser.lw, lw_search_help_callback, NULL);
}
}
diff --git a/src/screen_song.c b/src/screen_song.c
index 2c73ea6f5ff5c436a6e3b875cd7f9dcbac67c7c0..4a8f7169f4a08ee4e3778e6e12e85a168d54f576 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
{
current.lines = g_ptr_array_new();
lw = list_window_init(w, cols, rows);
- lw->flags = LW_HIDE_CURSOR;
+ lw->hide_cursor = true;
}
static void