aboutsummaryrefslogtreecommitdiffstats
path: root/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-10-06wreadln: support wide charactersMax Kellermann1-17/+190
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.
2008-10-06wreadln: wait for complete multibyte sequence in wreadln_insert_byte()Max Kellermann1-0/+54
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...
2008-10-06wreadln: don't use cursor_move_right() in insert_byte()Max Kellermann1-1/+4
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.
2008-10-06configure.ac: added option --disable-wideMax Kellermann1-1/+1
The configure option "--disable-wide" disables wide character support. This simplifies lots of internal calculations and makes the ncmpc binary leaner.
2008-10-06include ncursesw/ncurses.h if availableMax Kellermann14-9/+36
When compiling with libncursesw, include <ncursesw/ncurses.h> instead of <ncurses.h> (if available).
2008-10-06wreadln: optimize wreadln_delete_char() with memmove()Max Kellermann1-3/+4
Let memmove() do the dirty work on overlapping buffers..
2008-10-06wreadln: moved code to wreadln_delete()Max Kellermann1-7/+16
Remove some more clutter from wreadln() by merging the duplicate character deletion code to wreadln_delete_char().
2008-10-06wreadln: return early from cursor movement functionsMax Kellermann1-11/+13
Unclutter these functions by removing one indent level.
2008-10-06wreadln: use unsigned integers and size_tMax Kellermann2-15/+16
Declare all screen position variables as "unsigned", and all buffer positions as "size_t". We don't need signed values.
2008-10-06wreadln: use memcpy() for both casesMax Kellermann1-11/+6
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.
2008-10-06wreadln: use memmove() instead of an temporary bufferMax Kellermann1-7/+2
memmove() handles overlapping buffers well, we can use it to get room for the inserted character.
2008-10-06wreadln: moved code to insert_byte()Max Kellermann1-19/+25
Remove some clutter from wreadln(), isolate some code into a function.
2008-10-06wreadln: static bufferMax Kellermann1-18/+11
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.
2008-10-06wreadln: added struct wreadlnMax Kellermann1-94/+111
Don't pass a dozen of parameters to all internal functions; pass a pointer to the wreadln struct instead.
2008-10-06wreadln: removed parameter "x1"Max Kellermann1-15/+11
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.
2008-10-06wreadln: convert public globals to local constantsMax Kellermann3-15/+6
Convert wrln_max_line_size and wrln_max_history_length to local constants. They have no real use outside of wreadln.c.
2008-10-06wreadln: import screen_bell() from screen_utils.hMax Kellermann1-3/+1
Don't use "extern" outside of the headers, include the proper header instead.
2008-10-06code style, indent with tabs XIIMax Kellermann2-64/+61
Follow the same code style als MPD itself.
2008-10-06removed my_wgetch(), switch to wgetch()Max Kellermann6-24/+3
There are no special cases left for my_wgetch() to handle. We can remove it and use the original wgetch() instead.
2008-10-06disable ncurses raw modeMax Kellermann3-18/+0
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...
2008-10-06wreadln: removed the disabled ncursesw codeMax Kellermann1-384/+0
The wide character version of wreadln() is currently a non-functional mess. Remove it for now, I will reimplement that later.
2008-10-04screen: declare time constants as GTimeMax Kellermann1-2/+2
Variables which store integer seconds should be declared as GTime. This fixes a gcc warning.
2008-10-04Do not include libgen.h, it is unneeded after commit 44ecb.Emanuele Giaquinta1-4/+0
2008-10-04use g_basename() instead of basename()Max Kellermann1-1/+1
Another occurence of the non-portable basename() wasn't converted to glib yet.
2008-10-03store MPD_UPDATE_TIME as guintMax Kellermann1-3/+3
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.
2008-10-03don't initialize sigaction struct twiceMax Kellermann1-6/+3
Don't reset sa_mask and sa_flags after every sigaction() call. Do it once.
2008-10-03restart system call after SIGWINCHMax Kellermann1-1/+1
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.
2008-10-03typo: ignore SIGPIPE instead of SIGWINCHMax Kellermann1-2/+2
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.
2008-10-03screen: export the global variable "screen"Max Kellermann14-99/+85
screen_t is a singleton. We do not have to pass it around everywhere. Export the one global variable.
2008-10-03screen: don't pass mpdclient pointer to method paint()Max Kellermann9-33/+32
None of the paint() implementations acutally uses the mpdclient pointer. Remove it from the method signature.
2008-10-03screen_play: remember playlistMax Kellermann1-18/+20
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().
2008-10-03screen: removed "painted" flagMax Kellermann3-14/+10
Repaint immediately instead of setting "painted=0".
2008-10-03removed KEY_RESIZEMax Kellermann4-31/+0
Since we are handling SIGWINCH, we do not need to handle KEY_RESIZE from ncurses. Remove it.
2008-10-03screen_search: array index is tag idMax Kellermann1-24/+19
Save some bytes again: remove search_tag.id, make the array index equal to the tag id.
2008-10-03don't import mpdclient_finish_command() twiceMax Kellermann2-4/+0
mpdclient_finish_command() is already imported by mpdclient.h, don't do it again in the sources.
2008-10-03screen_search: removed the FUTURE macroMax Kellermann1-11/+0
The future is now!
2008-10-03options: don't initialize with memset(0)Max Kellermann1-2/+0
Global variables are already initialized with zero when the program starts, don't memset(0) again.
2008-10-03options: don't pass the "options" pointer aroundMax Kellermann5-55/+48
Just make everybody use the global "options" variable. This eliminates namespace confusion and the NO_GLOBAL_OPTIONS hack.
2008-10-03colors: make color support optional at compile timeMax Kellermann7-0/+57
Default is colors disabled. Those who love colorful terminals have the option to enable it with --enable-colors.
2008-10-03options: print one big string in --version screenMax Kellermann1-9/+9
Instead of calling printf() multiple times for every compile time option, build the whole string at compile time and print it with puts().
2008-10-03colors: color id is the index of the "colors" arrayMax Kellermann2-45/+25
The color ids are sequential, and we can save some bytes if we use it for the array index.
2008-10-03colors: added enum color_tMax Kellermann2-17/+19
Instead of declaring a bunch of CPP macros, use a C enum for identifying colors.
2008-10-03code style, indent with tabs XIMax Kellermann19-921/+790
Follow the same code style als MPD itself.
2008-10-03screen_artist: better screen titleMax Kellermann1-7/+13
The artist screen shouldn't be marked "experimental" anymore. Describe the current state of the screen in the title, instead of always writing "Artist".
2008-10-03list_window: remove list_window_state_tMax Kellermann6-90/+78
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.
2008-10-03filelist: added filelist_find_directory()Max Kellermann2-0/+22
The function filelist_find_directory() will be useful for the following patch.
2008-10-03screen_artist: fix reload in "All tracks"Max Kellermann1-7/+11
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.
2008-10-03charset: pass -1 instead of strlen()Max Kellermann1-2/+2
The GTK charset functions accept "-1" if the parameter is null terminated.
2008-10-03support: removed unused function remove_trailing_slash()Max Kellermann2-18/+0
2008-10-03use g_basename() instead of basename()Max Kellermann5-41/+12
g_basename() is always available, no need to implement a fallback. Also use g_path_get_dirname(), g_path_get_basename().