summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d2ac8d2)
raw | patch | inline | side by side (parent: d2ac8d2)
author | Kalle Wallin <kaw@linux.se> | |
Fri, 3 Jun 2005 16:20:42 +0000 (16:20 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Fri, 3 Jun 2005 16:20:42 +0000 (16:20 +0000) |
ChangeLog | patch | blob | history | |
doc/config.sample | patch | blob | history | |
src/conf.c | patch | blob | history | |
src/list_window.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen_play.c | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index 4a2ac87b1f9a525f6a5c3f4b93839a30de3aaaa6..e6fb3077ddf32476cd793f7cad1a32816bd3b499 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2005-06-03: Kalle Wallin <kaw@linux.se>
+ * Added a "hide cursor" feature #0000417
+
2005-06-01: Kalle Wallin <kaw@linux.se>
* main.c: Fixes #0000406, patch from René van Bevern
* po/de.po: Updates from René van Bevern
diff --git a/doc/config.sample b/doc/config.sample
index 5d53e39d21c7ec50d23b57a9302f9fb74008bc45..8dd3176fe8eb89d84aaf3aa3090a69d3af3aa3bf 100644 (file)
--- a/doc/config.sample
+++ b/doc/config.sample
## enable visible bell on alerts
#visible-bell = no
+## hide playlist cursor after x seconds (0 disables this feature)
+#hide-cursor = 5
+
## change the xterm title
#set-xterm-title = no
diff --git a/src/conf.c b/src/conf.c
index 11dba99933b1967a04f8ce0927d8346c9ab3146f..9222ed18ed70f3aa1e843fa4847ba266f62627b6 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
#define CONF_ENABLE_MOUSE "enable-mouse"
#define CONF_CROSSFADE_TIME "crossfade-time"
#define CONF_SEARCH_MODE "search-mode"
+#define CONF_HIDE_CURSOR "hide-cursor"
typedef enum {
KEY_PARSER_UNKNOWN,
{
options->search_mode = atoi(value);
}
+ else if( !strcasecmp(CONF_HIDE_CURSOR, name) )
+ {
+ options->hide_cursor = atoi(value);
+ }
else
{
match_found = 0;
diff --git a/src/list_window.c b/src/list_window.c
index c6f5375a12a6c159864fc09b7b64b6d4d7ad6a74..7bbc6e193ac0dbc7fc67dfeaa74628e989c47020 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
{
int i;
int fill = options.wide_cursor;
+ int show_cursor = !(lw->flags & LW_HIDE_CURSOR);
- if( lw->flags & LW_HIDE_CURSOR )
- {
- lw->selected = -1;
- }
- else
+ if( show_cursor )
{
while( lw->selected < lw->start )
{
lw->clear=1;
}
}
-
+
for(i=0; i<lw->rows; i++)
{
int highlight = 0;
else
colors_use(lw->w, COLOR_LIST);
- if( selected )
+ if( show_cursor && selected )
wattron(lw->w, A_REVERSE);
waddnstr(lw->w, label, lw->cols);
diff --git a/src/options.h b/src/options.h
index d264dd1fa01cb78de3dcfe5aee2fc802c5736bb4..c3395bbc4e7da2633ff5467102a42f7bbd17bbc9 100644 (file)
--- a/src/options.h
+++ b/src/options.h
int port;
int crossfade_time;
int search_mode;
+ int hide_cursor;
gboolean reconnect;
gboolean debug;
gboolean find_wrap;
diff --git a/src/screen_play.c b/src/screen_play.c
index b86c876de7f0e5959683b2c410f061c5b24ce0f6..51c722df54478f9d2cdb25453a5dd1dee6a1cb48 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <glib.h>
#include <ncurses.h>
#include <panel.h>
static void
play_update(screen_t *screen, mpdclient_t *c)
{
+ /* hide the cursor when mpd are playing and the user are inactive */
+ if( options.hide_cursor>0 && c->status->state == MPD_STATUS_STATE_PLAY &&
+ time(NULL)-screen->input_timestamp >= options.hide_cursor )
+ {
+ lw->flags |= LW_HIDE_CURSOR;
+ }
+ else
+ {
+ lw->flags &= ~LW_HIDE_CURSOR;
+ }
+
+ /* center the cursor */
if( options.auto_center )
{
static int prev_song_id = 0;