summaryrefslogtreecommitdiffstats
path: root/src/notify.c
Commit message (Collapse)AuthorAgeFilesLines
* Add support for caption rows in list boxesLukas Fleischer2014-05-181-1/+8
| | | | | | | This adds support for rows that cannot be selected. Such rows can be used for section headings and the like. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add support for drawing highlighted decorationLukas Fleischer2014-05-181-2/+2
| | | | | | | This allows for drawing selected scroll windows and list boxes with a highlighted border. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove numbers and whitespace from option menusLukas Fleischer2014-05-181-8/+5
| | | | | | | These are no longer needed since items are no longer accessed via numeric keys. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Reduce flicker when resizing in option menusLukas Fleischer2014-05-181-1/+1
| | | | | | | Do not update the main windows when resizing the terminal in the general options menu or in the notification options menu. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic list box for notification optionsLukas Fleischer2014-05-181-106/+107
| | | | | | | | This changes the notification options menu to use the new generic list box implementation. The only user-visible change is that items are now accessed via the arrow and edit key bindings instead of digits. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Rework scroll window implementationLukas Fleischer2014-05-181-15/+6
| | | | | | | | | | This complete rewrite of the scroll window implementation decouples scroll windows from every other window abstraction layer we use. Note that this leads to some code duplication. The long-term purpose of this rewrite, however, is to eventually make every panel use scroll windows. This makes for a huge cleanup of the UI code. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use tabs instead of spaces for indentationLukas Fleischer2013-04-141-524/+558
| | | | | | | | | | | This completes our switch to the Linux kernel coding style. Note that we still use deeply nested constructs at some places which need to be fixed up later. Converted using the `Lindent` script from the Linux kernel code base, along with some manual fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix braces in if-else statementsLukas Fleischer2013-02-171-7/+10
| | | | | | | | | | From the Linux kernel coding guidelines: Do not unnecessarily use braces where a single statement will do. [...] This does not apply if one branch of a conditional statement is a single statement. Use braces in both branches. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright rangesLukas Fleischer2013-02-041-1/+1
| | | | | | | Add 2013 to the copyright range for all source and documentation files. Reported-by: Frederic Culot <frederic@culot.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add hidden key handler windowLukas Fleischer2012-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | After BUG#6 had apparently been closed with the screen locks introduced in commit a80f8dcf2c6eb3b54658218bc081ee9694204dd5, some people still had problems with random characters appearing in the notification bar. This was obviously caused by wgetch() refreshing the screen if the status panel was changed. From wgetch(3): If the window is not a pad, and it has been moved or modified since the last call to wrefresh, wrefresh will be called before another character is read. Since the wgetch(3) isn't thread-safe, there were race conditions between the notification bar thread drawing to the notification bar and wgetch() updating the screen. Introduce a (hidden) window that handles all key presses and never gets changed in order to avoid this. Also, call wins_wrefresh() explicitly in status_mesg(), since we can no longer rely on wgetch() updating windows automatically. Fixes reopened BUG#6. Note that this is a hotfix -- FR#26 has been opened to ensure we fix this properly in the next major release. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Release screen mutex if thread diesLukas Fleischer2012-11-231-6/+6
| | | | | | | | | | | | | | | | | We did not setup a thread cleanup procedure which resulted in calcurse freezing if a thread tried to draw on the screen after another thread was canceled while locking the screen. Note that this kind of cleanup handlers should be added to other mutexes as well. This patch just removes the most common case of triggering a deadlock. Also note that we cannot move pthread_cleanup_push() and pthread_cleanup_pop() into the locking/unlocking functions since both pthread_cleanup_push() and pthread_cleanup_pop() may be implemented as macros that must be used in pairs within the same lexical scope. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Lock screen when drawing on the calendar/notification panelLukas Fleischer2012-11-231-0/+6
| | | | | | | | | | | | Lock the screen if either the calendar panel or the notification bar is updated to avoid race conditions. Addresses BUG#6. Note that we currently always use a screen-level lock, even if only one window is affected. This is to be changed in the future. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Replace localtime() with localtime_r()Lukas Fleischer2012-11-221-4/+4
| | | | | | | | | | | | | | Since the result of localtime() is stored in a statically allocated structure, data was overwritten when a context switch occurred during (or shortly after) the execution of localtime(), potentially resulting in critical data corruption. BUG#7 and BUG#8 are likely related. This patch converts all usages of localtime() with localtime_r(), which is thread-safe. Reported-by: Baptiste Jonglez <baptiste@jonglez.org> Reported-by: Erik Saule <esaule@bmi.osu.edu> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use mvwaddstr() instead of mvwprintw()Baptiste Jonglez2012-05-311-2/+2
| | | | | | | | | | | | | When we only want to display a string at a specific place of the screen, there's no need to use the more complex mvwprintw(), use mvwaddstr() instead. This should be slightly more efficient, and, above all, it prevents weird things to happen if our string contains a '%', being interpreted as an unwanted format string. Signed-off-by: Baptiste Jonglez <baptiste--git@jonglez.org> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Do not localize configuration optionsLukas Fleischer2012-05-231-8/+8
| | | | | | | | | The configuration options shown in the configuration menu are meant to reflect the keys used in the configuration file. The descriptions displayed alongside each option should be sufficient for non-English speakers. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Merge branch 'maint'Lukas Fleischer2012-05-231-1/+1
|\ | | | | | | | | | | | | Conflicts: src/io.c src/notify.c src/utils.c
| * src/notify.c: Fix printf() misuseLukas Fleischer2012-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Make sure we actually copy the notification warning interval to the correct buffer instead of printing it to stdout (using an arbitrary format string). This makes sure the current warning interval is shown when editing the field and also eliminates a potential format string vulnerability. Spotted with "-Wformat-nonliteral". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Switch to Linux kernel coding styleLukas Fleischer2012-05-211-455/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert our code base to adhere to Linux kernel coding style using Lindent, with the following exceptions: * Use spaces, instead of tabs, for indentation. * Use 2-character indentations (instead of 8 characters). Rationale: We currently have too much levels of indentation. Using 8-character tabs would make huge code parts unreadable. These need to be cleaned up before we can switch to 8 characters. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Update configuration dialogsLukas Fleischer2012-05-171-8/+8
| | | | | | | | | | | | | | Rename the configuration options shown in the configuration dialogs to match the new naming scheme used in the configuration file. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Declare several parameters/variables constantLukas Fleischer2012-05-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add the "const" keyword to parameters and variables that are never modified. Most of these were spotted by "-Wwrite-strings". We cast the second parameter to execvp() explicitly as it expects a "char *const[]" where it should expect a "const char *const[]" (according to the documentation, this is due to compatibility reasons). This should be changed once we come up with a better solution. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Mark localized string literals constantLukas Fleischer2012-04-051-6/+6
| | | | | | | | | | | | | | Translated strings returned by gettext() are statically allocated and shouldn't be modified. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Update copyright rangesLukas Fleischer2012-03-261-1/+1
| | | | | | | | | | | | Add 2012 to the copyright range for all source and documentation files. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not strncpy() strings returned by gettext()Lukas Fleischer2012-03-121-1/+1
| | | | | | | | | | | | | | | | Translated strings returned by gettext() are statically allocated. There's no need to copy them to a buffer, we can use the pointers returned by gettext() instead. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Merge branch 'maint'Lukas Fleischer2011-11-111-1/+4
|\| | | | | | | | | | | Conflicts: src/calcurse.h src/io.c
| * Cleanup joinable threads on terminationLukas Fleischer2011-10-041-1/+4
| | | | | | | | | | | | | | Always invoke pthread_join() when we blow up a thread via pthread_cancel() (avoid zombie threads). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Remove parentheses from return statementsLukas Fleischer2011-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | No reason to use "return (x);" here. Refer to the GNU coding guidelines for details. Created using following semantic patch: @@ expression expr; @@ - return (expr); + return expr; Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Make use of the NULL macroLukas Fleischer2011-11-021-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use this constant everywhere when referring to a null pointer instead of casting 0 to various types of pointers. Created using following semantic patch: @@ type type; @@ - (type *)0 + NULL Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Do not cast unused return values to voidLukas Fleischer2011-11-021-22/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A small style fix that removes all remaining "(void)" casts. Using these isn't encouraged in GNU coding guidelines and doesn't serve a certain purpose, except for satisfying a few static code analysis tools. We already nuked some of these in previous patches, but this semantic patch should fix what's left: @@ identifier func; @@ - (void)func ( + func ( ...); Long lines were re-formatted manually. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Avoid use of printf()/fprintf()Lukas Fleischer2011-11-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use one of the following functions where appropriate: * puts() (whenever we print hard coded strings to stdout) * fputs() (whenever we print hard coded strings to a stream) * putchar() (whenever we print a single character to stdout) * fputc() (whenever we print a single character to a stream) * strncpy() (whenever we copy hard coded strings to a buffer) This removes the overhead introduced by the format string parser and reduces the number of false positive C-format strings spotted by xgettext(1)'s heuristics. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Avoid unnecessary start time calculationsLukas Fleischer2011-10-211-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Rename recur_*_inday() to recur_*_find_occurrence() and use the new functions whenever we actually care about the start time of an occurrence. Reintroduce recur_*_inday() as wrappers to recur_*_find_occurrence() and pass NULL as start time buffer (which means "skip start time calculation"). Keep using these when we only want to know if a recurrent item belongs to a specific day but do not care about the actual start time. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Pass item durations to recur_item_inday()Lukas Fleischer2011-10-211-4/+4
| | | | | | | | | | | | | | | | Having item's durations eventually allows for better parsing of recurrent appointments as we might be interested in how many days are covered by a multi-day appointment. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* | Add configuration option to notify all appointmentsLukas Fleischer2011-07-311-5/+21
|/ | | | | | | | If "notify-all" is enabled, all non-flagged appointments will be notified (instead of flagged ones). This is useful for users that want to be notified of everything. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fix notify_check_repeated()Lukas Fleischer2011-07-291-1/+1
| | | | | | | | | | Remove the "current_time" check from the first if condition. As "greater than" relations (">") have higher precedence than assignments ("=") in C, this caused "real_app_time" to always be one or zero which definitely isn't what we want here. Reading further down, it turns out that we don't even need this comparison here, so we should be fine removing it. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Add "force" parameter to notify_check_next_app()Lukas Fleischer2011-07-291-6/+8
| | | | | | | | This allows to force notify_check_next_app() to update the notification appointment, even if start times are equal (e.g. if the item description was changed). Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Avoid redundant redraws on resizeLukas Fleischer2011-06-281-14/+19
| | | | | | | | | | Use a global flag to record whether the terminal was resized instead of redrawing everything each time a KEY_RESIZE is read. Add some additional checks to help_write_pad() as invalid actions may be passed now due to using signals instead of virtual key presses. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update copyright notices in source files, documentation and "COPYING".Lukas Fleischer2011-04-221-1/+1
| | | | | | | | | * Update copyright dates (use 2004-2011 as date range everywhere). * Change copyright holder from "Frederic Culot" to "calcurse Development Team". Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Use generic lists for recurring item exceptions.Lukas Fleischer2011-04-221-2/+2
| | | | | | | | | Rename "days" structure to "excp" which seems to be a better name here. Use generic linked lists of excp structures instead of using the "days" structure which again contains a linked list implementation. Do some cleanups and invocation fixes. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove dead assignments spotted by clang-analyzer.Lukas Fleischer2011-04-031-4/+2
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Overall indentation fixes.Lukas Fleischer2011-03-141-179/+179
| | | | | | | Use spaces instead of tabs for source code indentation only, strip trailing whitespaces from lines. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update website links to match the new URL.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Update mail addresses to match the new mailing lists.Lukas Fleischer2011-03-041-1/+1
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Remove CVS "$Id" headers.Lukas Fleischer2011-03-031-2/+0
| | | | Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
* Fixed file permissions.Lukas Fleischer2011-03-031-0/+0
|
* Avoid concurrent screen refreshes.Frederic Culot2010-03-211-2/+2
|
* All headers gathered into a single one. Typedefs suppressed.Frederic Culot2010-03-201-20/+21
|
* Avoid a segfault when txt_max_len becomes too small. Reported by Thorsten, ↵Frederic Culot2010-02-141-3/+6
| | | | thanks.
* Do not send notifications when running in background mode if user did not ↵Frederic Culot2009-08-171-2/+4
| | | | flag its appointment.
* Possible deadlock fixed, thanks Henrik for reporting it.Frederic Culot2009-08-131-4/+8
|
* notify_thread_app rewrittenFrederic Culot2009-08-091-9/+10
|
* Notification configuration menu rewritten to handle scrolling.Frederic Culot2009-08-021-42/+64
|