From 6b94942c5651383925896ea4469e49e6c77bd69a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 22 Sep 2008 10:05:48 +0200 Subject: screen: moved input_timestamp to screen_play.c Since the input_timestamp is only used by screen_play, move it there. --- src/screen.c | 2 -- src/screen.h | 1 - src/screen_play.c | 7 ++++++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/screen.c b/src/screen.c index a76438b9c..c7fece70e 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 6f98d1e4d..0165abb21 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 11d475478..7c2dc426f 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); -- cgit v1.2.3