One of my users has reported that my GTK3 app is slow to transition between “active” and “inactive” states. They’ve provided a video:
The delay is between the window getting focus and the window rendering in the “active” styling. You can click on the window, it’ll come to the front, there will be a short but noticeable delay, and then it’ll render as “active”. This happens with all themes, including Adwaita, so it’s not just the user’s theme causing it. It doesn’t happen when you’ve got a dialog (e.g. Settings) open.
The main window is a set of GtkListBox widgets containing custom GtkListItems that contain a GtkGrid with text and some image widgets.
If I limit it to 1 item in the list then the lag isn’t noticeable, but I wouldn’t expect 25 items (the default amount) to cause an obvious lag. It doesn’t appear to be the media, because the lag still happens when they’re not included.
What can cause the lag? How can I debug it? Is it just an unavoidable part of having lists with custom widgets in? From the logging I’ve added so far, it doesn’t appear to be a cascade of reallocations or anything, and I can’t find a way to debug CSS rendering.