INSTALL: mention C99 compiler requirements
ncmpc uses C99 features.
ncmpc uses C99 features.
INSTALL: replaced generic instructions
Removed the generic GNU installation instructions, nobody will ever
bother to read this lengthy document. Moved installation instructions
from README.
Removed the generic GNU installation instructions, nobody will ever
bother to read this lengthy document. Moved installation instructions
from README.
NEWS update for 0.12~alpha1
configure.ac: enable artist screen by default
The artist screen has matured, and everybody should have it by
default.
The artist screen has matured, and everybody should have it by
default.
Makefile.am: added screen_play.h to $(ncmpc_headers)
screen_play.h was missing in the tarball.
screen_play.h was missing in the tarball.
po: regenerated ncmpc.pot
po: updated POTFILES.in
Added new sources, removed screen_clock.c.
Added new sources, removed screen_clock.c.
po: improved russian translation
screen_utils: check for NULL password
Fix a NULL pointer dereference and a memory leak: check if
screen_read_password() returns NULL, and don't call
mpd_sendPasswordCommand(NULL) in this case. Free the password
when done.
Fix a NULL pointer dereference and a memory leak: check if
screen_read_password() returns NULL, and don't call
mpd_sendPasswordCommand(NULL) in this case. Free the password
when done.
lirc: refactored event handler
* moved lirc_event to lirc.c and split out the parts that depend on
variables in main.c into three separate functions
* changed keyboard_event accordingly to avoid duplicate code
* merged lirc_event with ncmpc_lirc_get_command
* moved lirc_event to lirc.c and split out the parts that depend on
variables in main.c into three separate functions
* changed keyboard_event accordingly to avoid duplicate code
* merged lirc_event with ncmpc_lirc_get_command
configure.ac: require autoconf 2.60
mpdclient: use g_utf8_collate()
Use one g_utf8_collate() call instead of g_utf8_collate_key() twice
plus strcmp().
Use one g_utf8_collate() call instead of g_utf8_collate_key() twice
plus strcmp().
wreadln: return NULL instead of empty string
No wreadln() caller cares about an empty string. Simplify the callers
by returning NULL instead of an allocated empty string. This fixes
several memory leaks.
No wreadln() caller cares about an empty string. Simplify the callers
by returning NULL instead of an allocated empty string. This fixes
several memory leaks.
mpdclient: removed _utf8 suffix from function names
All functions must receive UTF-8 file names. Delete all which still
work with locale strings, and remove the _utf8 suffix from the others.
All functions must receive UTF-8 file names. Delete all which still
work with locale strings, and remove the _utf8 suffix from the others.
mpdclient: expect UTF-8 strings
Don't convert the character set of strings to and from the current
locale. This library cannot know what the strings are going to be
used for, so it should not mess with them.
Don't convert the character set of strings to and from the current
locale. This library cannot know what the strings are going to be
used for, so it should not mess with them.
screen_search: fixed 2 memory leaks
Free the old pattern before prompting for a new one. Free the old
filelist object before retrieving the new one.
Free the old pattern before prompting for a new one. Free the old
filelist object before retrieving the new one.
screen_play: free the wreadln() return value
screen_browser: free g_path_get_dirname() return value
The function browser_change_directory() did not free the return value
of g_path_get_dirname().
The function browser_change_directory() did not free the return value
of g_path_get_dirname().
screen_file: optimized title formula
Don't allocate and copy memory.
Don't allocate and copy memory.
main: optimized error_msg()
The pointer has already been checked for NULL, eliminate that check.
The pointer has already been checked for NULL, eliminate that check.
Makefile.am: added custom rule with -fwhole-program
To make the ncmpc binary even smaller, you can compile all sources at
once with "--combine -fwhole-program". Unfortunately, automake does
not support this mode. For further experiments, this patch adds a
custom rule which creates the binary named "ncmpc-tiny" this way.
To make the ncmpc binary even smaller, you can compile all sources at
once with "--combine -fwhole-program". Unfortunately, automake does
not support this mode. For further experiments, this patch adds a
custom rule which creates the binary named "ncmpc-tiny" this way.
configure.ac, Makefile.am: removed subversion keywords
Removed $Id$.
Removed $Id$.
disable more features with --enable-mini
Disable lots of smaller features which don't have a separate configure
option:
- xterm title
- screen list
- horizontal scrolling
- MPD version number check
- key binding checks
- character set conversion
- bitrate display
- highlighting in the file browser
- completion / history
Disable lots of smaller features which don't have a separate configure
option:
- xterm title
- screen list
- horizontal scrolling
- MPD version number check
- key binding checks
- character set conversion
- bitrate display
- highlighting in the file browser
- completion / history
configure.ac: remove misplaced comma
command.h: include config.h
The source command.h checks for configure.ac options, so it needs to
include config.h.
The source command.h checks for configure.ac options, so it needs to
include config.h.
charset: don't allocate GError
Since the GError return value of g_convert_*() is ignored by ncmpc, we
don't need to retrieve it at all.
Since the GError return value of g_convert_*() is ignored by ncmpc, we
don't need to retrieve it at all.
options: don't store disabled options
Options which are disabled at compile time shouldn't reserve space for
their values in the options struct.
Options which are disabled at compile time shouldn't reserve space for
their values in the options struct.
options: static initialization if possible
Initialize the options struct statically.
Initialize the options struct statically.
options: removed deprecated options
"reconnect" is always enabled. "debug" code has been removed.
"reconnect" is always enabled. "debug" code has been removed.
configure.ac: added --disable-help-screen
configure.ac: added --disable-nls
Option --disable-nls disables all NLS features, even if the system
supports it.
Option --disable-nls disables all NLS features, even if the system
supports it.
configure.ac: added option --enable-mini
The option --enable-mini disables lots of features, and tries to
create a ncmpc binary which fits on very small machines.
The option --enable-mini disables lots of features, and tries to
create a ncmpc binary which fits on very small machines.
configure.ac: renamed $use_wide to $enable_wide
configure.ac: removed deprecated result line
configure.ac: added LIRC configure switch
Detect liblircclient with pkg-config.
Detect liblircclient with pkg-config.
lirc: pass writable string to lirc_init()
The "prog" argument of lirc_init() expects a non-const string.
Pass a local string variable.
The "prog" argument of lirc_init() expects a non-const string.
Pass a local string variable.
native LIRC support for ncmpc
The attachment includes the patch and a sample .lircrc config for
testing purposes (i. e. only a few commands are mapped to IR events).
The config is rather simple to write: For each button add a block like
this to ~/.lircrc:
begin
button = <button name from /etc/lircd.conf>
prog = ncmpc
config = <command name from src/command.c>
end
The patch is not finished, there are several problems that still need to
be solved:
1. the configure.ac modifications are just for testing purposes and
should be made optional with a parameter like --enable-lirc
for ./configure. Unfortunately I'm not an expert on autoconfig tools.
2. LIRC example code [1] suggests looping over lirc_code2char, probably
to have multiple actions that can be triggered from one button. Perhaps
lirc_event(...) should be moved to lirc.c and be heavily modified, no
longer being a mere copy of keyboard_event(...).
The attachment includes the patch and a sample .lircrc config for
testing purposes (i. e. only a few commands are mapped to IR events).
The config is rather simple to write: For each button add a block like
this to ~/.lircrc:
begin
button = <button name from /etc/lircd.conf>
prog = ncmpc
config = <command name from src/command.c>
end
The patch is not finished, there are several problems that still need to
be solved:
1. the configure.ac modifications are just for testing purposes and
should be made optional with a parameter like --enable-lirc
for ./configure. Unfortunately I'm not an expert on autoconfig tools.
2. LIRC example code [1] suggests looping over lirc_code2char, probably
to have multiple actions that can be triggered from one button. Perhaps
lirc_event(...) should be moved to lirc.c and be heavily modified, no
longer being a mere copy of keyboard_event(...).
Makefile.am: require automake 1.9
Makefile.am uses several features which are not available in the
ancient automake version 1.6. Let's just raise the bar to 1.9.
Makefile.am uses several features which are not available in the
ancient automake version 1.6. Let's just raise the bar to 1.9.
configure.ac: disable libtool
libtool isn't required for the ncmpc build process, it only causes
massive slowdown.
libtool isn't required for the ncmpc build process, it only causes
massive slowdown.
configure.ac: disabled the C++ and fortran checks
Why check for C++ and fortran compilers? This hack was borrowed from
Qball's gmpc git repository.
Why check for C++ and fortran compilers? This hack was borrowed from
Qball's gmpc git repository.
screen_browser: fix warning when lyrics screen is disabled
A local variable was only used by the lyrics screen code. Put #ifdef
around its declaration.
A local variable was only used by the lyrics screen code. Put #ifdef
around its declaration.
wreadln: support wide characters
wreadln() didn't distinguish narrow from wide characters, which
resulted in display corruption. This patch adds a lot of internal
conversions between byte positions, screen positions and character
position, which hopefully fixes all these bugs. Since these
conversions are quite expensive, the code should be revised and
optimized.
wreadln() didn't distinguish narrow from wide characters, which
resulted in display corruption. This patch adds a lot of internal
conversions between byte positions, screen positions and character
position, which hopefully fixes all these bugs. Since these
conversions are quite expensive, the code should be revised and
optimized.
wreadln: wait for complete multibyte sequence in wreadln_insert_byte()
For multibyte input, we should use wget_wch(), but this function isn't
supported properly on some platforms. Add a patch which completes a
multibyte character with multiple non-blocking reads. We'll see how
portable this hack is...
For multibyte input, we should use wget_wch(), but this function isn't
supported properly on some platforms. Add a patch which completes a
multibyte character with multiple non-blocking reads. We'll see how
portable this hack is...
wreadln: don't use cursor_move_right() in insert_byte()
After a byte has been inserted, move the cursor right by just one
byte, not one character. The byte may have been the first one in a
multibyte character.
After a byte has been inserted, move the cursor right by just one
byte, not one character. The byte may have been the first one in a
multibyte character.
configure.ac: added option --disable-wide
The configure option "--disable-wide" disables wide character support.
This simplifies lots of internal calculations and makes the ncmpc
binary leaner.
The configure option "--disable-wide" disables wide character support.
This simplifies lots of internal calculations and makes the ncmpc
binary leaner.
include ncursesw/ncurses.h if available
When compiling with libncursesw, include <ncursesw/ncurses.h> instead
of <ncurses.h> (if available).
When compiling with libncursesw, include <ncursesw/ncurses.h> instead
of <ncurses.h> (if available).
wreadln: optimize wreadln_delete_char() with memmove()
Let memmove() do the dirty work on overlapping buffers..
Let memmove() do the dirty work on overlapping buffers..
wreadln: moved code to wreadln_delete()
Remove some more clutter from wreadln() by merging the duplicate
character deletion code to wreadln_delete_char().
Remove some more clutter from wreadln() by merging the duplicate
character deletion code to wreadln_delete_char().
wreadln: return early from cursor movement functions
Unclutter these functions by removing one indent level.
Unclutter these functions by removing one indent level.
wreadln: use unsigned integers and size_t
Declare all screen position variables as "unsigned", and all buffer
positions as "size_t". We don't need signed values.
Declare all screen position variables as "unsigned", and all buffer
positions as "size_t". We don't need signed values.
wreadln: use memcpy() for both cases
Use memcpy() even when the cursor is at the end. It copies only the
trailing null terminator in this case.
The constant "length" is declared here in preparation for the "wide
character" patches.
Use memcpy() even when the cursor is at the end. It copies only the
trailing null terminator in this case.
The constant "length" is declared here in preparation for the "wide
character" patches.
wreadln: use memmove() instead of an temporary buffer
memmove() handles overlapping buffers well, we can use it to get room
for the inserted character.
memmove() handles overlapping buffers well, we can use it to get room
for the inserted character.
wreadln: moved code to insert_byte()
Remove some clutter from wreadln(), isolate some code into a function.
Remove some clutter from wreadln(), isolate some code into a function.
wreadln: static buffer
Since the buffer size is already known at compile time, don't do a
second malloc() for it, declare it statically in struct wreadln. This
way, it is going to be allocated on the stack.
Since the buffer size is already known at compile time, don't do a
second malloc() for it, declare it statically in struct wreadln. This
way, it is going to be allocated on the stack.
wreadln: added struct wreadln
Don't pass a dozen of parameters to all internal functions; pass a
pointer to the wreadln struct instead.
Don't pass a dozen of parameters to all internal functions; pass a
pointer to the wreadln struct instead.
wreadln: removed parameter "x1"
Several internal functions calculate the width of the input field by
subtracting "x0" from "x1", although the width is already being passed
to them. Eliminate the parameter "x1" in all functions, and use
"width" instead.
Several internal functions calculate the width of the input field by
subtracting "x0" from "x1", although the width is already being passed
to them. Eliminate the parameter "x1" in all functions, and use
"width" instead.
wreadln: convert public globals to local constants
Convert wrln_max_line_size and wrln_max_history_length to local
constants. They have no real use outside of wreadln.c.
Convert wrln_max_line_size and wrln_max_history_length to local
constants. They have no real use outside of wreadln.c.
wreadln: import screen_bell() from screen_utils.h
Don't use "extern" outside of the headers, include the proper header
instead.
Don't use "extern" outside of the headers, include the proper header
instead.
code style, indent with tabs XII
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
removed my_wgetch(), switch to wgetch()
There are no special cases left for my_wgetch() to handle. We can
remove it and use the original wgetch() instead.
There are no special cases left for my_wgetch() to handle. We can
remove it and use the original wgetch() instead.
disable ncurses raw mode
We're better off doing our own signal handling, instead of switching
ncurses to raw mode. Anyway, it was commented out and didn't work...
We're better off doing our own signal handling, instead of switching
ncurses to raw mode. Anyway, it was commented out and didn't work...
wreadln: removed the disabled ncursesw code
The wide character version of wreadln() is currently a non-functional
mess. Remove it for now, I will reimplement that later.
The wide character version of wreadln() is currently a non-functional
mess. Remove it for now, I will reimplement that later.
screen: declare time constants as GTime
Variables which store integer seconds should be declared as GTime.
This fixes a gcc warning.
Variables which store integer seconds should be declared as GTime.
This fixes a gcc warning.
Do not include libgen.h, it is unneeded after commit 44ecb.
use g_basename() instead of basename()
Another occurence of the non-portable basename() wasn't converted to
glib yet.
Another occurence of the non-portable basename() wasn't converted to
glib yet.
store MPD_UPDATE_TIME as guint
The glib function g_timeout_add() wants the interval as guint in
milliseconds. Store the update interval in this form, instead of
having to multiply MPD_UPDATE_TIME with 1000.
The glib function g_timeout_add() wants the interval as guint in
milliseconds. Store the update interval in this form, instead of
having to multiply MPD_UPDATE_TIME with 1000.
don't initialize sigaction struct twice
Don't reset sa_mask and sa_flags after every sigaction() call. Do it
once.
Don't reset sa_mask and sa_flags after every sigaction() call. Do it
once.
restart system call after SIGWINCH
Set option SA_RESTART for the SIGWINCH handler. The screen resizer
function is called by the glib main loop anyway, no need to interrupt
any random system call here.
Set option SA_RESTART for the SIGWINCH handler. The screen resizer
function is called by the glib main loop anyway, no need to interrupt
any random system call here.
typo: ignore SIGPIPE instead of SIGWINCH
Somehow the "ignore SIGPIPE" patch had a fatal typo: instead of
ignoring SIGPIPE, it ignored SIGWINCH. Somehow ncurses managed to
hide the bug's symptoms, but a recent patch finally broke it. Repair
the typo.
Somehow the "ignore SIGPIPE" patch had a fatal typo: instead of
ignoring SIGPIPE, it ignored SIGWINCH. Somehow ncurses managed to
hide the bug's symptoms, but a recent patch finally broke it. Repair
the typo.
screen: export the global variable "screen"
screen_t is a singleton. We do not have to pass it around
everywhere. Export the one global variable.
screen_t is a singleton. We do not have to pass it around
everywhere. Export the one global variable.
screen: don't pass mpdclient pointer to method paint()
None of the paint() implementations acutally uses the mpdclient
pointer. Remove it from the method signature.
None of the paint() implementations acutally uses the mpdclient
pointer. Remove it from the method signature.
screen_play: remember playlist
Remove the last paint() dependency on the mpdclient pointer: remember
a pointer to the playlist object, and don't take it from mpdclient
every time we paint. Also add the variable "current_song_id" which is
calculated in update().
Remove the last paint() dependency on the mpdclient pointer: remember
a pointer to the playlist object, and don't take it from mpdclient
every time we paint. Also add the variable "current_song_id" which is
calculated in update().
screen: removed "painted" flag
Repaint immediately instead of setting "painted=0".
Repaint immediately instead of setting "painted=0".
removed KEY_RESIZE
Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE
from ncurses. Remove it.
Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE
from ncurses. Remove it.
screen_search: array index is tag id
Save some bytes again: remove search_tag.id, make the array index
equal to the tag id.
Save some bytes again: remove search_tag.id, make the array index
equal to the tag id.
don't import mpdclient_finish_command() twice
mpdclient_finish_command() is already imported by mpdclient.h, don't
do it again in the sources.
mpdclient_finish_command() is already imported by mpdclient.h, don't
do it again in the sources.
screen_search: removed the FUTURE macro
The future is now!
The future is now!
options: don't initialize with memset(0)
Global variables are already initialized with zero when the program
starts, don't memset(0) again.
Global variables are already initialized with zero when the program
starts, don't memset(0) again.
options: don't pass the "options" pointer around
Just make everybody use the global "options" variable. This
eliminates namespace confusion and the NO_GLOBAL_OPTIONS hack.
Just make everybody use the global "options" variable. This
eliminates namespace confusion and the NO_GLOBAL_OPTIONS hack.
colors: make color support optional at compile time
Default is colors disabled. Those who love colorful terminals have
the option to enable it with --enable-colors.
Default is colors disabled. Those who love colorful terminals have
the option to enable it with --enable-colors.
options: print one big string in --version screen
Instead of calling printf() multiple times for every compile time
option, build the whole string at compile time and print it with
puts().
Instead of calling printf() multiple times for every compile time
option, build the whole string at compile time and print it with
puts().
colors: color id is the index of the "colors" array
The color ids are sequential, and we can save some bytes if we use it
for the array index.
The color ids are sequential, and we can save some bytes if we use it
for the array index.
colors: added enum color_t
Instead of declaring a bunch of CPP macros, use a C enum for
identifying colors.
Instead of declaring a bunch of CPP macros, use a C enum for
identifying colors.
code style, indent with tabs XI
Follow the same code style als MPD itself.
Follow the same code style als MPD itself.
screen_artist: better screen title
The artist screen shouldn't be marked "experimental" anymore.
Describe the current state of the screen in the title, instead of
always writing "Artist".
The artist screen shouldn't be marked "experimental" anymore.
Describe the current state of the screen in the title, instead of
always writing "Artist".
list_window: remove list_window_state_t
We do not need to save a stack of list window states. When we return
to a parent directory, we just have to find the directory which we
come from in the parent list. Note that this patch resets the cursor
when going to the root directory, but I think it's not that important,
and I will deal with that later.
We do not need to save a stack of list window states. When we return
to a parent directory, we just have to find the directory which we
come from in the parent list. Note that this patch resets the cursor
when going to the root directory, but I think it's not that important,
and I will deal with that later.
filelist: added filelist_find_directory()
The function filelist_find_directory() will be useful for the
following patch.
The function filelist_find_directory() will be useful for the
following patch.
screen_artist: fix reload in "All tracks"
The variable "album" was set to _("All tracks") when it was empty.
When reloading the songs, ncmpc was trying to find an album named "All
tracks", which didn't seem to work. Leave "album" in its canonical
form and generate the title text on demand.
The variable "album" was set to _("All tracks") when it was empty.
When reloading the songs, ncmpc was trying to find an album named "All
tracks", which didn't seem to work. Leave "album" in its canonical
form and generate the title text on demand.
charset: pass -1 instead of strlen()
The GTK charset functions accept "-1" if the parameter is null
terminated.
The GTK charset functions accept "-1" if the parameter is null
terminated.
support: removed unused function remove_trailing_slash()
use g_basename() instead of basename()
g_basename() is always available, no need to implement a fallback.
Also use g_path_get_dirname(), g_path_get_basename().
g_basename() is always available, no need to implement a fallback.
Also use g_path_get_dirname(), g_path_get_basename().
use g_ascii_isspace() instead of IS_WHITESPACE()
Don't duplicate code which is already provided by glib.
Don't duplicate code which is already provided by glib.
use g_ascii_strdown() instead of the custom lowerstr()
Don't duplicate code which is already provided by glib.
Don't duplicate code which is already provided by glib.
list_window: removed unused macro "LW_ROW"
screen_browser: added constant playlist_format
Moved the format string for playlist files to the constant
"playlist_format".
Moved the format string for playlist files to the constant
"playlist_format".
fix compiler errors without locale.h
The code did not compile when HAVE_LOCALE_H was not set. Also don't
compile all that code in charset.c, when there is no locale.h.
The code did not compile when HAVE_LOCALE_H was not set. Also don't
compile all that code in charset.c, when there is no locale.h.
screen_lyrics: character set conversion
Convert the lyrics to the current character set before displaying
them.
Convert the lyrics to the current character set before displaying
them.
charset: convert strings with fallback
Use g_convert_with_fallback() for charset conversion, and don't print
a status bar message on error.
Use g_convert_with_fallback() for charset conversion, and don't print
a status bar message on error.
charset: charset_init() returns character set
Don't pass "noconvert" to charset_init(). Let charset_init()
determine that with g_get_charset() and return its name.
Don't pass "noconvert" to charset_init(). Let charset_init()
determine that with g_get_charset() and return its name.
charset: renamed my_strlen() to utf8_width()
my_strlen() is a bad name for the function, since the return value is
not a length, but a visible width on the screen. Rename it to
utf8_width() and change its return type to "unsigned".
my_strlen() is a bad name for the function, since the return value is
not a length, but a visible width on the screen. Rename it to
utf8_width() and change its return type to "unsigned".