From 5af66f6090a2fc2757a1ac94e1082e526581e4e4 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Tue, 15 Dec 2009 22:50:25 +0100 Subject: playlist selection drawing now respects horizontal scrolling --- plugins/gtkui/gtkplaylist.c | 10 ++++++++-- plugins/gtkui/gtkplaylist.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins/gtkui') diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index 3941ebcb..663ec76a 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -286,6 +286,10 @@ gtkpl_setup_hscrollbar (gtkplaylist_t *ps) { for (c = ps->columns; c; c = c->next) { size += c->width; } + ps->totalwidth = size; + if (ps->totalwidth < ps->playlist->allocation.width) { + ps->totalwidth = ps->playlist->allocation.width; + } if (w >= size) { size = 0; } @@ -338,10 +342,12 @@ gtkpl_draw_pl_row_back (gtkplaylist_t *ps, int row, DB_playItem_t *it) { if (treeview->style->depth == -1) { return; // drawing was called too early } + int x = -ps->hscrollpos; + int w = ps->totalwidth; GtkWidget *widget = ps->playlist; - gtk_paint_flat_box (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, (row & 1) ? "cell_even_ruled" : "cell_odd_ruled", 0, row * rowheight - ps->scrollpos * rowheight, widget->allocation.width, rowheight); + gtk_paint_flat_box (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, GTK_SHADOW_NONE, NULL, treeview, (row & 1) ? "cell_even_ruled" : "cell_odd_ruled", x, row * rowheight - ps->scrollpos * rowheight, w, rowheight); if (row == deadbeef->pl_get_cursor (ps->iterator)) { - gtk_paint_focus (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, NULL, treeview, "treeview", 0, row * rowheight - ps->scrollpos * rowheight, widget->allocation.width, rowheight); + gtk_paint_focus (treeview->style, ps->backbuf, (it && SELECTED(it)) ? GTK_STATE_SELECTED : GTK_STATE_NORMAL, NULL, treeview, "treeview", x, row * rowheight - ps->scrollpos * rowheight, w, rowheight); } } diff --git a/plugins/gtkui/gtkplaylist.h b/plugins/gtkui/gtkplaylist.h index 430f112a..208a19ef 100644 --- a/plugins/gtkui/gtkplaylist.h +++ b/plugins/gtkui/gtkplaylist.h @@ -69,6 +69,7 @@ typedef struct { GtkWidget *header; GtkWidget *scrollbar; GtkWidget *hscrollbar; + int totalwidth; // width of playlist, including invisible part GdkPixmap *backbuf; GdkPixmap *backbuf_header; const char *title; // unique id, used for config writing, etc -- cgit v1.2.3