From 7710bf8fb0d6dff980c6a704f582195735b082c7 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Thu, 21 Oct 2021 22:58:46 +0200 Subject: [PATCH 1/5] fix glib-critical for g_source_remove --- waveform.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/waveform.c b/waveform.c index fe61771..8f05ba8 100644 --- a/waveform.c +++ b/waveform.c @@ -933,7 +933,9 @@ waveform_set_refresh_interval (gpointer user_data, int interval) g_source_remove (w->drawtimer); w->drawtimer = 0; } - w->drawtimer = g_timeout_add (interval, waveform_draw_cb, w); + if (playback_status == PLAYING) { + w->drawtimer = g_timeout_add (interval, waveform_draw_cb, w); + } return TRUE; } From ee283269d047401b5448230feae57289422c3a74 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Thu, 21 Oct 2021 22:59:15 +0200 Subject: [PATCH 2/5] redraw on seek, fixes corruption --- waveform.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/waveform.c b/waveform.c index 8f05ba8..a1b72cb 100644 --- a/waveform.c +++ b/waveform.c @@ -1170,6 +1170,10 @@ waveform_message (ddb_gtkui_widget_t *widget, uint32_t id, uintptr_t ctx, uint32 playback_status = PLAYING; waveform_set_refresh_interval (w, CONFIG_REFRESH_INTERVAL); } + break; + case DB_EV_SEEKED: + g_idle_add (waveform_redraw_cb, w); + g_idle_add (ruler_redraw_cb, w); } return 0; } From 266c8d0c09c9fe259f90de992f6fb023bdedadf8 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Sun, 24 Oct 2021 18:09:50 +0200 Subject: [PATCH 3/5] show configure item in design mode as well --- waveform.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/waveform.c b/waveform.c index a1b72cb..faa3e89 100644 --- a/waveform.c +++ b/waveform.c @@ -1273,6 +1273,15 @@ waveform_init (ddb_gtkui_widget_t *w) on_config_changed (w); } +static void +waveform_initmenu (struct ddb_gtkui_widget_s *w, GtkWidget *menu) +{ + GtkWidget *item = gtk_menu_item_new_with_mnemonic ("Configure"); + gtk_container_add (GTK_CONTAINER (menu), item); + gtk_widget_show (item); + g_signal_connect_after ((gpointer) item, "activate", G_CALLBACK (on_button_config), w); +} + static ddb_gtkui_widget_t * waveform_create (void) { @@ -1283,6 +1292,7 @@ waveform_create (void) w->base.init = waveform_init; w->base.destroy = waveform_destroy; w->base.message = waveform_message; + w->base.initmenu = waveform_initmenu; w->drawarea = gtk_drawing_area_new (); w->ruler = gtk_drawing_area_new (); #if !GTK_CHECK_VERSION(3,0,0) @@ -1295,7 +1305,7 @@ waveform_create (void) gtk_menu_attach_to_widget (GTK_MENU (w->popup), w->base.widget, NULL); w->popup_item = gtk_menu_item_new_with_mnemonic ("Configure"); w->mutex = deadbeef->mutex_create (); - gtk_widget_set_size_request (w->base.widget, 300, 96); + gtk_widget_set_size_request (w->base.widget, 300, -1); gtk_widget_set_size_request (w->ruler, -1, 20); gtk_widget_set_size_request (w->drawarea, -1, -1); gtk_widget_add_events (w->base.widget, GDK_SCROLL_MASK); From 913fda9ee8281832667a2982cf6e173357f5ac47 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Sun, 24 Oct 2021 18:22:23 +0200 Subject: [PATCH 4/5] No min height at all is probably not wise, 5 should be reasonable --- waveform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waveform.c b/waveform.c index faa3e89..892f875 100644 --- a/waveform.c +++ b/waveform.c @@ -1305,7 +1305,7 @@ waveform_create (void) gtk_menu_attach_to_widget (GTK_MENU (w->popup), w->base.widget, NULL); w->popup_item = gtk_menu_item_new_with_mnemonic ("Configure"); w->mutex = deadbeef->mutex_create (); - gtk_widget_set_size_request (w->base.widget, 300, -1); + gtk_widget_set_size_request (w->base.widget, 300, 5); gtk_widget_set_size_request (w->ruler, -1, 20); gtk_widget_set_size_request (w->drawarea, -1, -1); gtk_widget_add_events (w->base.widget, GDK_SCROLL_MASK); From ed306480f8010a846a771722b4061dcf47cd49e3 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Tue, 20 Jun 2023 19:33:47 +0200 Subject: [PATCH 5/5] fix compilation with newer deadbeef header --- waveform.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/waveform.c b/waveform.c index 892f875..14b0b99 100644 --- a/waveform.c +++ b/waveform.c @@ -687,7 +687,11 @@ waveform_generate_wavedata (gpointer user_data, DB_playItem_t *it, const char *u .samplerate = fileinfo->fmt.samplerate, .channelmask = fileinfo->fmt.channelmask, .is_float = 1, +#if (DDB_API_LEVEL >= 17) + .flags = 0, +#else .is_bigendian = 0 +#endif }; int update_counter = 0; @@ -1459,7 +1463,7 @@ static const char settings_dlg[] = ; static DB_misc_t plugin = { - //DB_PLUGIN_SET_API_VERSION + DB_PLUGIN_SET_API_VERSION .plugin.type = DB_PLUGIN_MISC, .plugin.api_vmajor = 1, .plugin.api_vminor = 5,