summaryrefslogtreecommitdiff
path: root/gtkplaylist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2009-08-22 16:10:20 +0200
committerGravatar waker <wakeroid@gmail.com>2009-08-22 16:10:20 +0200
commit79fb8ffad1cfccc04ab1de3d0cbcaafa3658fb3d (patch)
tree5d0fe7416c2fe55e1821049295cac4ac8df9a2fa /gtkplaylist.c
parent6556d9f8ce2d68d78a31a260a48d69e5e2fe82c7 (diff)
fixed some redraw slowndown issues
Diffstat (limited to 'gtkplaylist.c')
-rw-r--r--gtkplaylist.c44
1 files changed, 27 insertions, 17 deletions
diff --git a/gtkplaylist.c b/gtkplaylist.c
index 6bda07b6..9d92e925 100644
--- a/gtkplaylist.c
+++ b/gtkplaylist.c
@@ -880,29 +880,33 @@ gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) {
if (state & GDK_SHIFT_MASK) {
// select all between shift_sel_anchor and ps->row
if (prev != ps->row) {
+ int minvis = ps->scrollpos;
+ int maxvis = ps->scrollpos + ps->nvisiblerows-1;
int start = min (ps->row, shift_sel_anchor);
int end = max (ps->row, shift_sel_anchor);
int idx=0;
for (playItem_t *it = playlist_head[ps->iterator]; it; it = it->next[ps->iterator], idx++) {
if (idx >= start && idx <= end) {
-// if (!it->selected) {
- it->selected = 1;
+ it->selected = 1;
+ if (idx >= minvis && idx <= maxvis) {
if (newscroll == ps->scrollpos) {
gtkpl_redraw_pl_row (ps, idx);
}
else {
gtkpl_redraw_pl_row_novis (ps, idx);
}
-// }
+ }
}
else if (it->selected)
{
it->selected = 0;
- if (newscroll == ps->scrollpos) {
- gtkpl_redraw_pl_row (ps, idx);
- }
- else {
- gtkpl_redraw_pl_row_novis (ps, idx);
+ if (idx >= minvis && idx <= maxvis) {
+ if (newscroll == ps->scrollpos) {
+ gtkpl_redraw_pl_row (ps, idx);
+ }
+ else {
+ gtkpl_redraw_pl_row_novis (ps, idx);
+ }
}
}
}
@@ -911,12 +915,27 @@ gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) {
else {
// reset selection, set new single cursor/selection
if (prev != ps->row) {
+ int minvis = ps->scrollpos;
+ int maxvis = ps->scrollpos + ps->nvisiblerows-1;
shift_sel_anchor = ps->row;
int idx=0;
for (playItem_t *it = playlist_head[ps->iterator]; it; it = it->next[ps->iterator], idx++) {
if (idx == ps->row) {
if (!it->selected) {
it->selected = 1;
+ if (idx >= minvis && idx <= maxvis) {
+ if (newscroll == ps->scrollpos) {
+ gtkpl_redraw_pl_row (ps, idx);
+ }
+ else {
+ gtkpl_redraw_pl_row_novis (ps, idx);
+ }
+ }
+ }
+ }
+ else if (it->selected) {
+ it->selected = 0;
+ if (idx >= minvis && idx <= maxvis) {
if (newscroll == ps->scrollpos) {
gtkpl_redraw_pl_row (ps, idx);
}
@@ -925,15 +944,6 @@ gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) {
}
}
}
- else if (it->selected) {
- it->selected = 0;
- if (newscroll == ps->scrollpos) {
- gtkpl_redraw_pl_row (ps, idx);
- }
- else {
- gtkpl_redraw_pl_row_novis (ps, idx);
- }
- }
}
}
}