summaryrefslogtreecommitdiff
path: root/gtkplaylist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-28 21:31:08 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-28 21:31:08 +0200
commit02a72b4aae032565b401c88162315d72b917a688 (patch)
tree3c68679b0c0da18a0721084261564be4daf60be4 /gtkplaylist.c
parentf263abb8b777b61bcce7eee88716a137d0f880c3 (diff)
fixed some "scroll follows playback" bugs
Diffstat (limited to 'gtkplaylist.c')
-rw-r--r--gtkplaylist.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gtkplaylist.c b/gtkplaylist.c
index dc0783f4..d2c3f6f9 100644
--- a/gtkplaylist.c
+++ b/gtkplaylist.c
@@ -391,6 +391,7 @@ gtkpl_configure (gtkplaylist_t *ps) {
ps->fmtcache = NULL;
}
ps->nvisiblerows = ceil (widget->allocation.height / (float)rowheight);
+ ps->nvisiblefullrows = floor (widget->allocation.height / (float)rowheight);
ps->backbuf = gdk_pixmap_new (widget->window, widget->allocation.width, widget->allocation.height, -1);
gtkpl_draw_playlist (ps, 0, 0, widget->allocation.width, widget->allocation.height);
@@ -490,7 +491,8 @@ gtkpl_mouse1_pressed (gtkplaylist_t *ps, int state, int ex, int ey, double time)
// doubleclick - play this item
if (ps->row != -1) {
playItem_t *it = gtkpl_get_for_idx (ps, ps->row);
- messagepump_push (M_PLAYSONGNUM, 0, pl_get_idx_of (it), 0);
+ it->selected = 1;
+ messagepump_push (M_PLAYSONGNUM, 0, ps->row, 0);
return;
}
@@ -742,10 +744,13 @@ gtkpl_playsongnum (int idx) {
void
gtkpl_songchanged (gtkplaylist_t *ps, int from, int to) {
- GtkWidget *widget = ps->playlist;
- if (to >= 0 && session_get_cursor_follows_playback ()) {
- gtk_range_set_value (GTK_RANGE (ps->scrollbar), to - ps->nvisiblerows/2);
- return;
+ if (!dragwait) {
+ GtkWidget *widget = ps->playlist;
+ if (session_get_cursor_follows_playback ()) {
+ if (to < ps->scrollpos || to >= ps->scrollpos + ps->nvisiblefullrows) {
+ gtk_range_set_value (GTK_RANGE (ps->scrollbar), to - ps->nvisiblerows/2);
+ }
+ }
}
if (from >= 0) {