Skip to content

Commit

Permalink
skins/skins-qt: Fix handling of "playlist position" event. Closes: #1…
Browse files Browse the repository at this point in the history
…157.
  • Loading branch information
jlindgren90 committed Apr 9, 2022
1 parent ab71851 commit fc8622d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
16 changes: 4 additions & 12 deletions src/skins-qt/playlistwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ static Button * button_add, * button_sub, * button_sel, * button_misc, * button_

static int resize_base_width, resize_base_height;
//static int drop_position;
static bool song_changed;

static void update_info ()
{
Expand Down Expand Up @@ -492,12 +491,6 @@ static void update_cb (void *, void *)
{
playlistwin_list->refresh ();

if (song_changed)
{
playlistwin_list->set_focused (Playlist::active_playlist ().get_position ());
song_changed = false;
}

update_info ();
update_rollup_text ();
}
Expand All @@ -509,10 +502,11 @@ static void follow_cb (void * data, void *)

int row = list.get_position ();
if (row >= 0)
{
list.select_entry (row, true);

if (list == Playlist::active_playlist ())
song_changed = true;
if (list == Playlist::active_playlist ())
playlistwin_list->set_focused (row);
}
}

void playlistwin_create ()
Expand All @@ -523,8 +517,6 @@ void playlistwin_create ()
update_info ();
update_rollup_text ();

song_changed = false;

hook_associate ("playlist position", follow_cb, nullptr);
hook_associate ("playlist activate", update_cb, nullptr);
hook_associate ("playlist update", update_cb, nullptr);
Expand Down
16 changes: 4 additions & 12 deletions src/skins/playlistwin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ static Button * button_add, * button_sub, * button_sel, * button_misc, * button_

static int resize_base_width, resize_base_height;
static int drop_position;
static bool song_changed;

static void update_info ()
{
Expand Down Expand Up @@ -505,12 +504,6 @@ static void update_cb (void *, void *)
{
playlistwin_list->refresh ();

if (song_changed)
{
playlistwin_list->set_focused (Playlist::active_playlist ().get_position ());
song_changed = false;
}

update_info ();
update_rollup_text ();
}
Expand All @@ -522,10 +515,11 @@ static void follow_cb (void * data, void *)

int row = list.get_position ();
if (row >= 0)
{
list.select_entry (row, true);

if (list == Playlist::active_playlist ())
song_changed = true;
if (list == Playlist::active_playlist ())
playlistwin_list->set_focused (row);
}
}

void playlistwin_create ()
Expand All @@ -536,8 +530,6 @@ void playlistwin_create ()
update_info ();
update_rollup_text ();

song_changed = false;

hook_associate ("playlist position", follow_cb, nullptr);
hook_associate ("playlist activate", update_cb, nullptr);
hook_associate ("playlist update", update_cb, nullptr);
Expand Down

0 comments on commit fc8622d

Please sign in to comment.