summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7dcdf79)
raw | patch | inline | side by side (parent: 7dcdf79)
author | Max Kellermann <max@duempel.org> | |
Mon, 18 Jul 2011 20:40:22 +0000 (22:40 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Mon, 18 Jul 2011 20:43:22 +0000 (22:43 +0200) |
Makefile.am | patch | blob | history | |
src/colors.c | patch | blob | history | |
src/hscroll.c | patch | blob | history | |
src/ncfix.h | [new file with mode: 0644] | patch | blob |
diff --git a/Makefile.am b/Makefile.am
index 1c178d645071bba24de7bc1a140774aebd8f1c7d..124fb49ded0fc2a8eb464c8663c0bc9da262e385 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
src/conf.h \
src/command.h \
src/ncu.h \
+ src/ncfix.h \
src/player_command.h \
src/window.h \
src/title_bar.h \
diff --git a/src/colors.c b/src/colors.c
index 361a7e93d16f000be78b2aa53222a67c4046814a..9f5409b2610f5dca203275efb809997b9c1f36b2 100644 (file)
--- a/src/colors.c
+++ b/src/colors.c
#include "colors.h"
#include "i18n.h"
+#include "ncfix.h"
+
#ifdef ENABLE_COLORS
#include "options.h"
#endif
assert(id > 0 && id < COLOR_END);
- wattr_get(w, &attrs, &pair, NULL);
+ fix_wattr_get(w, &attrs, &pair, NULL);
#ifdef ENABLE_COLORS
if (options.enable_colors) {
diff --git a/src/hscroll.c b/src/hscroll.c
index 164f178fa3fdff826897e1234f60a88c3bc6f1fd..dafae93dee2dc3a0d9190267c34aa62e0e63d54d 100644 (file)
--- a/src/hscroll.c
+++ b/src/hscroll.c
#include "hscroll.h"
#include "charset.h"
+#include "ncfix.h"
#include "glib_compat.h"
#include <assert.h>
/* obtain the ncurses attributes and the current color, store
them */
- wattr_get(hscroll->w, &hscroll->attrs, &hscroll->pair, NULL);
+ fix_wattr_get(hscroll->w, &hscroll->attrs, &hscroll->pair, NULL);
hscroll->text = g_strdup(text);
hscroll->offset = 0;
assert(hscroll->text != NULL);
/* set stored attributes and color */
- wattr_get(hscroll->w, &old_attrs, &old_pair, NULL);
+ fix_wattr_get(hscroll->w, &old_attrs, &old_pair, NULL);
wattr_set(hscroll->w, hscroll->attrs, hscroll->pair, NULL);
/* scroll the string, and draw it */
diff --git a/src/ncfix.h b/src/ncfix.h
--- /dev/null
+++ b/src/ncfix.h
@@ -0,0 +1,46 @@
+/* ncmpc (Ncurses MPD Client)
+ * (c) 2004-2011 The Music Player Daemon Project
+ * Project homepage: http://musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Workarounds for libncurses oddities.
+ */
+
+#ifndef NCFIX_H
+#define NCFIX_H
+
+#ifdef HAVE_NCURSESW_NCURSES_H
+#include <ncursesw/ncurses.h>
+#else
+#include <ncurses.h>
+#endif
+
+/**
+ * Workaround for "comparison will always evaluate as 'true' for the
+ * address of ...". By wrapping the macro in this inline function,
+ * gcc stops bitching about this.
+ */
+static inline int
+fix_wattr_get(WINDOW *win, attr_t *attrs, short *pair, void *opts)
+{
+ (void)opts;
+
+ return wattr_get(win, attrs, pair, opts);
+}
+
+#endif