Wed 29 Nov 2006 09:39:11 PM UTC, original submission:
I've made a patch against 0.6.4 to adjust number of the small bars in xosd percentagebar to reflect real number of levels. This aplies for volume, [un]mute and brightness.
So it sets 14 bars for volume (as it has 15 levels) and 7 bars for brightness, as it has 8 levels.
At compile time it checks for sufficient version of libxosd, otherwise it is disabled.
It also introduces the +1 hack - i've found out that libxosd count number of bars to display as floor(percent/100 * maxbars) or something silimar, but tpb counts it rounded. For example if the brightness is on level 1 of 7 (starting with 0), tpb counts the percentage as (brightnes_level * 100 / 7), which is 14,2857%... - but when xosd is set to display max 7 bars, it needs at least 15% to display one active bar, othervise it displays 0 active bars.
So this patch changes the call to xosd_display to (brightnes_level * 100 / 7 + 1), which should not hurt. Better way would be to count it as ceil(brightness_level * 100 / 7), but i think we could let it ugly, instead of including math.h.
This patch looks nice, if you set big XOSD font, such as:
OSDFONT -bitstream-bitstream vera sans mono-bold-r-normal--30--75-75--*-iso8859-1
Thanks for this great piece of software, hope this could be merged.
patch with -p1 in tpb's directory.
Matej Laitl - strohel (aT) gmail.com
|