From d5067195b96dfbad5e07e1485fe4f75507b6d558 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 1 Oct 2009 22:03:33 +0200 Subject: [PATCH] screen: eliminated state macros Better do it manually. --- src/main.c | 2 +- src/player_command.c | 4 +--- src/screen.c | 3 ++- src/screen.h | 4 ---- src/screen_play.c | 3 ++- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main.c b/src/main.c index a03b707..43e0dd7 100644 --- a/src/main.c +++ b/src/main.c @@ -81,7 +81,7 @@ update_xterm_title(void) } if (options.xterm_title_format && status && song && - IS_PLAYING(mpd_status_get_state(status))) + mpd_status_get_state(status) == MPD_STATE_PLAY) strfsong(tmp, BUFSIZE, options.xterm_title_format, song); else g_strlcpy(tmp, PACKAGE " version " VERSION, BUFSIZE); diff --git a/src/player_command.c b/src/player_command.c index 085ffa1..3d6d75a 100644 --- a/src/player_command.c +++ b/src/player_command.c @@ -24,8 +24,6 @@ #include "i18n.h" #include "screen_client.h" -#define IS_PAUSED(s) (s==MPD_STATE_PAUSE) - int seek_id = -1; int seek_target_time; @@ -93,7 +91,7 @@ handle_player_command(struct mpdclient *c, command_t cmd) */ case CMD_PAUSE: if (!mpd_run_pause(c->connection, - !IS_PAUSED(mpd_status_get_state(c->status)))) + mpd_status_get_state(c->status) != MPD_STATE_PAUSE)) mpdclient_handle_error(c); break; case CMD_STOP: diff --git a/src/screen.c b/src/screen.c index cf99538..f988cb0 100644 --- a/src/screen.c +++ b/src/screen.c @@ -170,7 +170,8 @@ paint_progress_window(struct mpdclient *c) elapsed = 0; duration = c->status != NULL && - !IS_STOPPED(mpd_status_get_state(c->status)) + (mpd_status_get_state(c->status) == MPD_STATE_PLAY || + mpd_status_get_state(c->status) == MPD_STATE_PAUSE) ? mpd_status_get_total_time(c->status) : 0; diff --git a/src/screen.h b/src/screen.h index 17fc3d4..5ed300f 100644 --- a/src/screen.h +++ b/src/screen.h @@ -37,10 +37,6 @@ #include #endif -#define IS_PLAYING(s) (s==MPD_STATE_PLAY) -#define IS_PAUSED(s) (s==MPD_STATE_PAUSE) -#define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s))) - #define MAX_SONGNAME_LENGTH 512 struct mpdclient; diff --git a/src/screen_play.c b/src/screen_play.c index ceb1361..f1af519 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -570,7 +570,8 @@ play_update(struct mpdclient *c) playlist_restore_selection(); current_song_id = c->status != NULL && - !IS_STOPPED(mpd_status_get_state(c->status)) + (mpd_status_get_state(c->status) == MPD_STATE_PLAY || + mpd_status_get_state(c->status) == MPD_STATE_PAUSE) ? (int)mpd_status_get_song_id(c->status) : -1; if (current_song_id != prev_song_id) { -- 2.30.2