summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 91ea956)
raw | patch | inline | side by side (parent: 91ea956)
author | Max Kellermann <max@duempel.org> | |
Sun, 14 Jun 2009 16:12:03 +0000 (18:12 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Sun, 14 Jun 2009 16:12:03 +0000 (18:12 +0200) |
This option makes ncurses look a little bit ugly, but it is important
for blind ncmpc users who depend on a braille display. The braille
display shows the position of the hardware cursor, but is unable to
display the "inverse colors" of the traditional ncmpc cursor.
for blind ncmpc users who depend on a braille display. The braille
display shows the position of the hardware cursor, but is unable to
display the "inverse colors" of the traditional ncmpc cursor.
NEWS | patch | blob | history | |
doc/config.sample | patch | blob | history | |
doc/ncmpc.1 | patch | blob | history | |
src/conf.c | patch | blob | history | |
src/list_window.c | patch | blob | history | |
src/options.h | patch | blob | history | |
src/screen.c | patch | blob | history |
index 36916584404fad56281e096a2bacb9707f8168ee..2adcc440f3c2a775a367a2e59a2a046835cba5bf 100644 (file)
--- a/NEWS
+++ b/NEWS
ncmpc 0.15 - not yet released
* added CMD_SELECT_PLAYING
* display song duration in the playlist
+* added the "hardware_cursor" option
ncmpc 0.14 - 2009-04-21
diff --git a/doc/config.sample b/doc/config.sample
index f123bb1237de7c2fcc9102fc25f64dd9ca9a5472..ba37c98fae04a4cd41dd5b22423163df68b4a656 100644 (file)
--- a/doc/config.sample
+++ b/doc/config.sample
## Make the cursor as wide as the screen.
#wide-cursor = yes
+## Use the terminal's hardware cursor instead of inverse colors
+#hardware-cursor = yes
+
## Hide playlist cursor after x seconds (0 disables this feature).
#hide-cursor = 5
diff --git a/doc/ncmpc.1 b/doc/ncmpc.1
index 2bca04def84363d37a7063b93cc76a49c79f704a..c0006635e114b4f16a55fbe697c2c0a774ae6089 100644 (file)
--- a/doc/ncmpc.1
+++ b/doc/ncmpc.1
.TP
.B wide\-cursor = yes|no
Make the cursor as wide as the screen.
+.TP
+.B hardware\-cursor = yes|no
+Use the terminal's hardware cursor instead of inverse colors.
.TP
.B hide\-cursor = NUM
Hide the playlist cursor after NUM seconds of inactivity.
diff --git a/src/conf.c b/src/conf.c
index 4f171082dec34c03ca5ab1a16bbc85f7826cf3e3..e60fb8f952de4cbbff24bd1fbb53055385206b91 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
/* wide cursor */
else if (!strcasecmp(CONF_WIDE_CURSOR, name))
options.wide_cursor = str2bool(value);
+ else if (strcasecmp(name, "hardware-cursor") == 0)
+ options.hardware_cursor = str2bool(value);
/* welcome screen list */
else if (!strcasecmp(CONF_WELCOME_SCREEN_LIST, name))
options.welcome_screen_list = str2bool(value);
diff --git a/src/list_window.c b/src/list_window.c
index 9421db3744e9b472a43fcbf8e1a72b1c48baa29b..9f3bfc7065cb7508d8b9be0e82a61665e4fa6539 100644 (file)
--- a/src/list_window.c
+++ b/src/list_window.c
else
colors_use(lw->w, COLOR_LIST);
- if (show_cursor && selected)
+ if (show_cursor && selected &&
+ (!options.hardware_cursor || lw->range_selection))
wattron(lw->w, A_REVERSE);
//waddnstr(lw->w, label, lw->cols);
} else
wclrtoeol(lw->w);
}
+
+ if (options.hardware_cursor && lw->selected >= lw->start &&
+ lw->selected < lw->start + lw->rows) {
+ curs_set(1);
+ wmove(lw->w, lw->selected - lw->start, 0);
+ }
}
bool
diff --git a/src/options.h b/src/options.h
index cc42493a9a46d614e408b58496383019e6e00556..5927d4c443b8d9e84727709ccc20f33e1275bf62 100644 (file)
--- a/src/options.h
+++ b/src/options.h
int scroll_offset;
bool auto_center;
bool wide_cursor;
+ bool hardware_cursor;
+
#ifdef ENABLE_COLORS
bool enable_colors;
#endif
diff --git a/src/screen.c b/src/screen.c
index c4e156acd2cf44deba4b7ec4936c48a8f469500f..e540fec303a145f0cc721d1d85aa48ed77f1c9c8 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
else
paint_top_window("", c, 1);
+ /* paint the bottom window */
+
+ paint_progress_window(c);
+ paint_status_window(c);
+
/* paint the main window */
+
wclear(screen.main_window.w);
if (mode_fn->paint != NULL)
mode_fn->paint();
- paint_progress_window(c);
- paint_status_window(c);
- wmove(screen.main_window.w, 0, 0);
+ /* move the cursor to the origin */
+
+ if (!options.hardware_cursor)
+ wmove(screen.main_window.w, 0, 0);
+
wnoutrefresh(screen.main_window.w);
/* tell curses to update */
} else
paint_top_window("", c, 0);
- /* update the main window */
- if (mode_fn->update != NULL)
- mode_fn->update(c);
-
/* update progress window */
paint_progress_window(c);
/* update status window */
paint_status_window(c);
+ /* update the main window */
+ if (mode_fn->update != NULL)
+ mode_fn->update(c);
+
/* move the cursor to the origin */
- wmove(screen.main_window.w, 0, 0);
+
+ if (!options.hardware_cursor)
+ wmove(screen.main_window.w, 0, 0);
+
wnoutrefresh(screen.main_window.w);
/* tell curses to update */