From: Max Kellermann Date: Mon, 22 Sep 2008 08:05:48 +0000 (+0200) Subject: screen: moved input_timestamp to screen_play.c X-Git-Tag: v0.12_alpha1~191 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6b94942c5651383925896ea4469e49e6c77bd69a;p=ncmpc.git screen: moved input_timestamp to screen_play.c Since the input_timestamp is only used by screen_play, move it there. --- diff --git a/src/screen.c b/src/screen.c index a76438b..c7fece7 100644 --- a/src/screen.c +++ b/src/screen.c @@ -547,7 +547,6 @@ screen_init(mpdclient_t *c) screen.findbuf = NULL; screen.painted = 0; screen.start_timestamp = time(NULL); - screen.input_timestamp = time(NULL); screen.last_cmd = CMD_NONE; /* create top window */ @@ -858,7 +857,6 @@ screen_client_cmd(mpdclient_t *c, command_t cmd) void screen_cmd(mpdclient_t *c, command_t cmd) { - screen.input_timestamp = time(NULL); screen.last_cmd = cmd; welcome = FALSE; diff --git a/src/screen.h b/src/screen.h index 6f98d1e..0165abb 100644 --- a/src/screen.h +++ b/src/screen.h @@ -28,7 +28,6 @@ typedef struct screen { /* GTime is equivalent to time_t */ GTime start_timestamp; GTime status_timestamp; - GTime input_timestamp; GTime last_cmd; int cols, rows; diff --git a/src/screen_play.c b/src/screen_play.c index 11d4754..7c2dc42 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -50,6 +50,7 @@ typedef struct mpdclient_t *c; } completion_callback_data_t; +static GTime input_timestamp; static list_window_t *lw = NULL; static long long playlist_id; @@ -338,6 +339,8 @@ play_open(mpd_unused screen_t *screen, mpdclient_t *c) { static gboolean install_cb = TRUE; + input_timestamp = time(NULL); + if (install_cb) { mpdclient_install_playlist_callback(c, playlist_changed_callback); install_cb = FALSE; @@ -383,7 +386,7 @@ play_update(screen_t *screen, mpdclient_t *c) /* hide the cursor when mpd are playing and the user are inactive */ if (options.hide_cursor > 0 && (c->status != NULL && c->status->state == MPD_STATUS_STATE_PLAY) && - time(NULL)-screen->input_timestamp >= options.hide_cursor ) { + time(NULL) - input_timestamp >= options.hide_cursor ) { lw->flags |= LW_HIDE_CURSOR; } else { lw->flags &= ~LW_HIDE_CURSOR; @@ -456,6 +459,8 @@ handle_mouse_event(mpd_unused screen_t *screen, mpdclient_t *c) static int play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) { + input_timestamp = time(NULL); + switch(cmd) { case CMD_PLAY: mpdclient_cmd_play(c, lw->selected);