Qball's Weblog

Dirty hack mania

Tags gmpc 

I got many reports from gmpc users (0.16.x users) that gmpc had a high cpu usage (5-6%).  This turned out to be caused by the GtkProgresssBar I use.

The animations in the progress-bar are implemented by queue-ing a resize request Multiple times a second.  Even though it did not cause a redraw of the whole window (I checked). I could tell the users to ditch the theme, but that is not perfect.

So in 0.17.0 I implemented my own progresbar, this solved the high cpu issue, but this does not integrate.

So today I spend many hours messing with gtk to get a widget, exactly, drawn like a gtkprogressbar but not animated. Using basic themes, this is easy. Just render “trough” box the size of the widget, and then a “bar” and you are done. (beside text). However, many themes beside looking at the detail hint also look at the widget and change the drawing if GTK_IS_PROGRESSBAR matches.  So after some very nasty hacks I have it working.

But I find it kind of sad that I must resort to these type of hacks, because the default theme in f.e. ubuntu and others use completely fucked up (pardon my language) animations..