feat(mpd): play/pause on click & stop on right-click

This commit is contained in:
Minijackson
2019-04-17 16:16:39 +02:00
parent 07dab2baec
commit 80a12d0238
2 changed files with 37 additions and 1 deletions

View File

@ -23,6 +23,8 @@ class MPD : public ALabel {
void fetchState();
void waitForEvent();
bool handlePlayPause(GdkEventButton* const&);
std::thread worker_;
using unique_connection = std::unique_ptr<mpd_connection, decltype(&mpd_connection_free)>;
@ -35,6 +37,9 @@ class MPD : public ALabel {
const unsigned port_;
unique_connection connection_;
// Use two connections because the main one will be blocking most of the time.
// Used to send play/pause events and poll elapsed time.
unique_connection alternate_connection_;
unique_status status_;
mpd_state state_;
unique_song song_;