Code

screen: moved input_timestamp to screen_play.c
authorMax Kellermann <max@duempel.org>
Mon, 22 Sep 2008 08:05:48 +0000 (10:05 +0200)
committerMax Kellermann <max@duempel.org>
Mon, 22 Sep 2008 08:05:48 +0000 (10:05 +0200)
Since the input_timestamp is only used by screen_play, move it there.

src/screen.c
src/screen.h
src/screen_play.c

index a76438b9c6f9b095f016fbaea11d6f364b5cf6c2..c7fece70eb83c4b9fd939f0ca6d84c626fb7f459 100644 (file)
@@ -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;
 
index 6f98d1e4d5a238f4b6db32f0a28c2b807a3ae4fe..0165abb21df673c098d52ae886bd105cdc0b3a09 100644 (file)
@@ -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;
index 11d4754783d15c855bda56c9e35bdf3f8433eff0..7c2dc426fcea7b1a285bdf98f2ce3d1d0ce37877 100644 (file)
@@ -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);