From f8a8120b4f9d466a9663088fce899e9602e331bd Mon Sep 17 00:00:00 2001 From: waker Date: Sun, 16 Aug 2009 14:01:49 +0200 Subject: fixed some more redraw issues --- gtkplaylist.c | 12 ++++++++++++ gtkplaylist.h | 3 +++ main.c | 11 +++++++++++ messages.h | 1 + 4 files changed, 27 insertions(+) diff --git a/gtkplaylist.c b/gtkplaylist.c index 3705da1c..80f808d6 100644 --- a/gtkplaylist.c +++ b/gtkplaylist.c @@ -1503,3 +1503,15 @@ gtkpl_get_for_idx (gtkplaylist_t *ps, int idx) { } return it; } + +void +playlist_refresh (void) { + extern gtkplaylist_t main_playlist; + gtkplaylist_t *ps = &main_playlist; + memset (ps->fmtcache, 0, sizeof (int16_t) * 3 * pl_ncolumns * ps->nvisiblerows); + gtkpl_setup_scrollbar (ps); + GtkWidget *widget = ps->playlist; + gtkpl_draw_playlist (ps, 0, 0, widget->allocation.width, widget->allocation.height); + gtkpl_expose (ps, 0, 0, widget->allocation.width, widget->allocation.height); + search_refresh (); +} diff --git a/gtkplaylist.h b/gtkplaylist.h index 36c47b2d..6aced5a8 100644 --- a/gtkplaylist.h +++ b/gtkplaylist.h @@ -199,4 +199,7 @@ gtkpl_set_cairo_source_rgb (cairo_t *cr, int col); void gtkpl_set_cairo_font (cairo_t *cr); +void +playlist_refresh (void); + #endif // __GTKPLAYLIST_H diff --git a/main.c b/main.c index a1bba6ef..e40f6a15 100644 --- a/main.c +++ b/main.c @@ -38,6 +38,7 @@ #include "gtkplaylist.h" #include "codec.h" #include "streamer.h" +#include "search.h" GtkWidget *mainwin; GtkWidget *searchwin; @@ -192,6 +193,10 @@ exec_command_line (const char *cmdline, int len, int filter) { parg++; } } + if (exitcode == 2 || exitcode == 3) { + // added some files, need to redraw + messagepump_push (M_PLAYLISTREFRESH, 0, 0, 0); + } return exitcode; } @@ -330,6 +335,12 @@ player_thread (uintptr_t ctx) { case M_FMDRAGDROP: gtkpl_add_fm_dropped_files (&main_playlist, (char *)ctx, p1, p2); break; + case M_PLAYLISTREFRESH: + GDK_THREADS_ENTER(); + playlist_refresh (); + search_refresh (); + GDK_THREADS_LEAVE(); + break; } } usleep(1000); diff --git a/messages.h b/messages.h index 5a8cecc0..e95a790b 100644 --- a/messages.h +++ b/messages.h @@ -32,6 +32,7 @@ enum { M_ADDFILES, // ctx = GSList pointer, must be freed with g_slist_free M_FMDRAGDROP, // ctx = char* ptr, must be freed with standard free, p1 is length of data, p2 is drop_y M_TERMINATE, // must be sent to player thread to terminate + M_PLAYLISTREFRESH, }; #endif // __MESSAGES_H -- cgit v1.2.3