audacious-media-player / audacious

A lightweight and versatile audio player
https://audacious-media-player.org
Other
870 stars 115 forks source link

Infobar visualizations don‘t work on Wayland with GTK interface #1369

Closed knm100 closed 5 months ago

knm100 commented 6 months ago

Describe the bug A clear and concise description of what the bug is. with GTK3 interface, the virtual effect in the plug-in can only display static images.

Steps to reproduce How and when does the bug occur? Normal playback with GTK3 interface

Expected behavior What do you expect to happen instead? As with the QT interface, it displays motion pictures normally.

Additional information

radioactiveman commented 6 months ago

I am aware of this issue, thanks for reporting. The current workaround is to run Audacious via XWayland.

knm100 commented 5 months ago

I appreciate your efforts in maintaining GTK2, GTK3, QT5, and QT6 interfaces at the same time,but it probably be better to maintain only one interface across all platforms, even one platforms.

radioactiveman commented 5 months ago

This is related to the gdk_window_ensure_native() call added in https://github.com/audacious-media-player/audacious-plugins/commit/70d9d82d770774d5582ac03492f5eb4a939dd41a. Without the realize callback function the visualizations render correctly also on Wayland.

@jlindgren90: Do you know or remember the background of the optimization? I have run Audacious with GTK 3 and GTK_DEBUG=interactive. With "Show Graphic Updates" enabled in the "Visual" tab, I see no difference in the inspector. With and without the realize function only the slider, time label and visualizations are redrawn (marked repeatedly by GTK Inspector with red color).

Can we remove this code completely or is it still useful for GTK 2? In 2013 at the time of the commit we were already using GTK 3.4 though.

gtk_inspector_graphic_updates

jlindgren90 commented 5 months ago

Let's measure CPU usage with and without the ensure_native call, to see if it matters still.

radioactiveman commented 5 months ago

With htop I see no difference in CPU usage, neither with GTK 2 nor GTK 3. On my machine the audacious command uses most times 0.7 % CPU. And sometimes it changes to 0.0 % or up to 1.3 %.

If you know better tools to measure this or notice higher CPU usage, let me know.

diff --git a/src/gtkui/ui_infoarea.cc b/src/gtkui/ui_infoarea.cc
index 8b8832ba1..1fd4e2021 100644
--- a/src/gtkui/ui_infoarea.cc
+++ b/src/gtkui/ui_infoarea.cc
@@ -370,12 +370,6 @@ static void ui_infoarea_playback_stop ()
     timer_add (TimerRate::Hz30, ui_infoarea_do_fade);
 }

-static void realize_cb (GtkWidget * widget)
-{
-    /* using a native window avoids redrawing parent widgets */
-    gdk_window_ensure_native (gtk_widget_get_window (widget));
-}
-
 void ui_infoarea_show_art (bool show)
 {
     if (! area)
@@ -398,9 +392,6 @@ void ui_infoarea_show_vis (bool show)

         vis.widget = gtk_drawing_area_new ();

-        /* note: "realize" signal must be connected before adding to box */
-        g_signal_connect (vis.widget, "realize", (GCallback) realize_cb, nullptr);
-
         gtk_widget_set_size_request (vis.widget, VIS_WIDTH, HEIGHT);
         gtk_box_pack_start ((GtkBox *) area->box, vis.widget, false, false, 0);
jlindgren90 commented 5 months ago

I do not see a significant difference here either (with GTK2). CPU usage is about 5% (of one core throttled to 1.6 GHz) either way. Let's remove the ensure_native call.

radioactiveman commented 5 months ago

Fixed with https://github.com/audacious-media-player/audacious-plugins/commit/1a44f3973201d8cc526dc2e03d156a3f6ec0e28f.

knm100 commented 5 months ago

Thank your very much!