summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ae39bd6)
raw | patch | inline | side by side (parent: ae39bd6)
author | Jeffrey Middleton <jefromi@gmail.com> | |
Mon, 23 Mar 2009 15:48:05 +0000 (10:48 -0500) | ||
committer | Jeffrey Middleton <jefromi@gmail.com> | |
Mon, 23 Mar 2009 15:48:51 +0000 (10:48 -0500) |
The screen swap command now gets handled outside of screen.c when
appropriate, to allow passing the currently selected song to the
song/lyrics screens.
appropriate, to allow passing the currently selected song to the
song/lyrics screens.
diff --git a/src/screen.c b/src/screen.c
index 57b22cf8a784b4c1a0253690c7c6e6a67647a971..622582582a60edb1872fb8b33b1b252048ace8fb 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
screen_paint(c);
}
+void
+screen_swap(struct mpdclient *c, const struct mpd_song *song)
+{
+ if (song != NULL)
+ {
+ if (mode_fn_prev == &screen_song)
+ screen_song_switch(c, song);
+ else if (mode_fn_prev == &screen_lyrics)
+ screen_lyrics_switch(c, song);
+ else
+ screen_switch(mode_fn_prev, c);
+ }
+ else
+ screen_switch(mode_fn_prev, c);
+}
+
static int
find_configured_screen(const char *name)
{
screen_switch(&screen_outputs, c);
break;
case CMD_SCREEN_SWAP:
- screen_switch(mode_fn_prev, c);
+ screen_swap(c, NULL);
break;
#endif
diff --git a/src/screen.h b/src/screen.h
index d414548d227e313c64c81766540bf912257fb14c..601548c0158ecf7edfd0d278b54aceccbb5a664e 100644 (file)
--- a/src/screen.h
+++ b/src/screen.h
void
screen_switch(const struct screen_functions *sf, struct mpdclient *c);
+void
+screen_swap(struct mpdclient *c, const struct mpd_song *song);
gboolean
screen_is_visible(const struct screen_functions *sf);
diff --git a/src/screen_browser.c b/src/screen_browser.c
index b118a7ec3c7e457a2350e60583beaacaff04ea58..b616c58ed3925a40d03bf021fbe0c7bfe6eba6bc 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
screen_lyrics_switch(c, entry->entity->info.song);
return true;
#endif
+ case CMD_SCREEN_SWAP:
+ entry = browser_get_selected(browser);
+ if (entry->entity != NULL &&
+ entry->entity->type == MPD_INFO_ENTITY_TYPE_SONG)
+ screen_swap(c, entry->entity->info.song);
+ else
+ screen_swap(c, NULL);
+ return true;
default:
break;
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 1cb392fb86e4419f5e9de31f24a9f4e6b784e4ff..221b7cdb4ce87f69425158f2ffd3ef51d5e7f0cb 100644 (file)
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
break;
#endif
+ case CMD_SCREEN_SWAP:
+ screen_swap(c, current.song);
+ return true;
case CMD_LOCATE:
if (current.song != NULL) {
diff --git a/src/screen_play.c b/src/screen_play.c
index 4201fb81a2e7b26b6ecf53f187b5e14ee4a37ee1..d80c3510e9c4c29168ed95a0536b8cfea3fcf2df 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.c
break;
#endif
+ case CMD_SCREEN_SWAP:
+ screen_swap(c, playlist_get(&c->playlist, lw->selected));
+ return true;
default:
break;
diff --git a/src/screen_song.c b/src/screen_song.c
index cc4d53801fce2c202aee86ea27954386815039ee..74d2652728ccfd1d142be267bf48a5358c390adf 100644 (file)
--- a/src/screen_song.c
+++ b/src/screen_song.c
screen_lyrics_switch(c, current.played_song);
return true;
}
-
return false;
+
#endif
+ case CMD_SCREEN_SWAP:
+ if (current.selected_song != NULL)
+ screen_swap(c, current.selected_song);
+ else
+ // No need to check if this is null - we'd pass null anyway
+ screen_swap(c, current.played_song);
+ return true;
+
default:
break;
}