summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3af5c3a)
raw | patch | inline | side by side (parent: 3af5c3a)
author | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 15:59:50 +0000 (16:59 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 15:59:50 +0000 (16:59 +0100) |
Makefile.am | patch | blob | history | |
src/main.c | patch | blob | history | |
src/screen_utils.c | patch | blob | history | |
src/screen_utils.h | patch | blob | history | |
src/xterm_title.c | [new file with mode: 0644] | patch | blob |
src/xterm_title.h | [new file with mode: 0644] | patch | blob |
diff --git a/Makefile.am b/Makefile.am
index 32e18e37a9969890dd43b413905fee1aa26d1544..53293154c48225ce9e401a2bdbe9c64c7d7d8249 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
if NCMPC_MINI
else
src_ncmpc_SOURCES += \
+ src/xterm_title.c src/xterm_title.h \
src/hscroll.c src/hscroll.h \
src/match.c src/match.h \
src/conf.c src/conf.h
diff --git a/src/main.c b/src/main.c
index 0729610a54ad7336e0347efb12154e9187d764d3..d4c5168a251694d539964e9ff70adf82bc6fd545 100644 (file)
--- a/src/main.c
+++ b/src/main.c
#include "command.h"
#include "ncu.h"
#include "screen.h"
-#include "screen_utils.h"
#include "screen_status.h"
+#include "xterm_title.h"
#include "strfsong.h"
#include "i18n.h"
#include "player_command.h"
diff --git a/src/screen_utils.c b/src/screen_utils.c
index ff16613e42952b5ba1a4e393054d3c3b03a111a4..28d5e4b2fd4319384bf117178213f40f030485fa 100644 (file)
--- a/src/screen_utils.c
+++ b/src/screen_utils.c
wrefresh(w);
colors_use(w, COLOR_LIST);
}
-
-#ifndef NCMPC_MINI
-void
-set_xterm_title(const char *format, ...)
-{
- /* the current xterm title exists under the WM_NAME property */
- /* and can be retrieved with xprop -id $WINDOWID */
-
- if (options.enable_xterm_title) {
- if (g_getenv("WINDOWID")) {
- va_list ap;
- va_start(ap,format);
- char *msg = g_strdup_vprintf(format,ap);
- va_end(ap);
- printf("\033]0;%s\033\\", msg);
- fflush(stdout);
- g_free(msg);
- } else
- options.enable_xterm_title = FALSE;
- }
-}
-#endif
diff --git a/src/screen_utils.h b/src/screen_utils.h
index 746a7ae9a86a926d33d509d5410ecbc59d68ba90..2f0568ede047487ea647085148a46934a67a7d02 100644 (file)
--- a/src/screen_utils.h
+++ b/src/screen_utils.h
void screen_display_completion_list(GList *list);
-#ifndef NCMPC_MINI
-void set_xterm_title(const char *format, ...);
-#endif
-
#endif
diff --git a/src/xterm_title.c b/src/xterm_title.c
--- /dev/null
+++ b/src/xterm_title.c
@@ -0,0 +1,45 @@
+/* ncmpc (Ncurses MPD Client)
+ * (c) 2004-2017 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.
+ */
+
+#include "xterm_title.h"
+#include "options.h"
+
+#include <glib.h>
+
+#include <stdio.h>
+
+void
+set_xterm_title(const char *format, ...)
+{
+ /* the current xterm title exists under the WM_NAME property */
+ /* and can be retrieved with xprop -id $WINDOWID */
+
+ if (options.enable_xterm_title) {
+ if (g_getenv("WINDOWID")) {
+ va_list ap;
+ va_start(ap,format);
+ char *msg = g_strdup_vprintf(format,ap);
+ va_end(ap);
+ printf("\033]0;%s\033\\", msg);
+ fflush(stdout);
+ g_free(msg);
+ } else
+ options.enable_xterm_title = FALSE;
+ }
+}
diff --git a/src/xterm_title.h b/src/xterm_title.h
--- /dev/null
+++ b/src/xterm_title.h
@@ -0,0 +1,26 @@
+/* ncmpc (Ncurses MPD Client)
+ * (c) 2004-2017 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.
+ */
+
+#ifndef XTERM_TITLE_H
+#define XTERM_TITLE_H
+
+void
+set_xterm_title(const char *format, ...);
+
+#endif