[vlc-devel] [PATCH] draw the toolbar with DPI-aware dimensions

Jarrad Whitaker jarrad.whitaker at gmail.com
Thu Nov 6 14:44:53 CET 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Currently VLC draws its toolbar with hardcoded pixel lengths for its
dimensions. This is fine if you are using a display around the
traditional 96 DPI, and terrible if you are not. There are multiple
examples in the forums and elsewhere on the interwebs of users
starting to get bitten by this.

This patch scales the button sizes by the user's current scaling
multiplier - being CurrentDPI/96. This means that the button sizes
grow proportionally to the text sizes (which already work perfectly,
thanks Qt!) as the user changes their DPI.

Before/after are here: http://imgur.com/a/JvUyf
Note that these screens are from my 13" surface pro - so the original
unscaled "big" play button is a whopping 4mm high in physical measure;
entirely impractical to hit with a mouse or touchpad, let alone finger.

After patching, the toolbar is easily hit by mouse, so the usability
concerns are somewhat mitigated, but I have chosen not to scale the
icons. The reason for this is that I would like to add some SVG icons
in future, as these will look much better at medium-to-high
resolutions. But that is for the future - at least now we don't
require a third-order closed-loop feedback control system attached to
our touchpad in order to hit our buttons! (guess what exam I am
procrastinating by fixing VLC...)

Because the volume widget is also based on a pixmap, I have directly
drawn it scaled so it is a little blurry. I would like to mitigate
this by having Qt draw the requisite triangle and mask directly
instead of using a pixmap; again though, I consider the jump in
usability to justify sending my changes as is, as the cosmetic fixups
will have quite a long tail of work (especially to ensure they don't
break the current pixel-perfect layout at 96 dpi).

These changes should not affect displays set to 96-DPI whatsoever (the
scaling factor cancels to 1), so if you've never played with DPI
settings then this won't make a difference to you. :)

Cheers
Jarrad
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUW3tVAAoJED3oB8CFhvqeX84P/1T/l1eW9iANtNn86HXzKfmH
AS9E2ueD5VBllg8QiFEhQH/pXDJ2oFPUx/D1Z5XX+/ehD73kwtLADO4m/njYFELw
8M0Ubgx/ATGvo/ktOEFjKtoU6dJXM2+Xbb3ZKCWMJ0hqWHewRrvazC0w56jeJqro
VfajvKOm0fRX4TgtNLD+qfEJN5vMAktADIG+8uI64TgFtC/N7iOoYDR3axfWrnBE
Qb3/+oAF0Bt4kPUEqrLzzpzUs7J0hf918KZQnHeHAi1AXpPc9/ciKllvEQC/Dp/A
LOa0MGfQyd0jhsdeIsO7vBhXljnVBGBH8FFjXAAw4VnnFfKx6TFr2UFWiMGGbLVx
ibii5UeIkwwwqKmP5dcuYvMs3Gs2TAy6hk5eaAW3l8xjGNZfkepFnGYmlr6iOO2g
G5RUjxTpGnnFUgBZYsi8bRQhtujb8lxRXFDBXSjidRjqNIyacuZXo16qxnANWJ5N
dO3YfUfTGsiyI474iph2VzFJP1KeOJP2nrRUKiCifK24abZChLq+vTi8GvJLsanS
gfvBevNMYKxu/UUUvmrh7iARdp2JjYcVnUzhxzhLtMJIyeY31EEALJQB/MJeAnte
S0Tt72zVvHWa+eEk+vX+Ewdomcv6AIV29oYcUnRvI50o2/j1gEYpWvREwPbgyNOi
PzL0PE4jOBj4u1udZEd1
=XR3y
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-draw-toolbar-buttons-with-DPI-scaled-sizes.patch
Type: text/x-patch
Size: 9603 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141107/99512856/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-draw-toolbar-buttons-with-DPI-scaled-sizes.patch.sig
Type: application/pgp-signature
Size: 543 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141107/99512856/attachment.sig>


More information about the vlc-devel mailing list