kossebau created this revision. kossebau added reviewers: Plasma, VDG, mart, davidedmundson, ngraham. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. kossebau requested review of this revision.
REVISION SUMMARY Currently the shadow offset of the hands as well as the rotation center of the hands is hardcoded to match the light model and the hands shape of the Breeze theme. As well did some older change to move the rotation center to width/2 in y direction break older themes which relied on the y=0 offset. This patch adds the option for themes to control the shadow offset as well as define the rotation offset for each hand (to avoid the need to create large pixmaps as workaround with empty space to match the assumption of the center to be at (width/2, width/2), by these new hints: One shadow offset for all hands, as the simulated physical model can be assumed to have all hands almost on same layer (also matching that we have only one shadow for stacked objects, like windows, elsewhere): - hint-hands-shadow-offset-to-west/hint-hands-shadows-offset-to-east - hint-hands-shadow-offset-to-north/hint-hands-shadow-offset-to-south (west vs. east & north vs. south as negative rect size is not possible). If no hint is set, defaults to 0. The default of 0 is a small breakage, but almost all themes from store.kde.org do not use a shadow, also was the hour shadow broken/not shown until recently and only fixed for upcoming Plasma 5.16, where the offset of the shadows was tuned as well, so any themes with hand shadows will need some tuning for Plasma 5.16 in any case. Separate rotation offsets for all hands & their shadows, so pixmaps can be as small as needed, with no transparent area padding needed: - hint-hourhand-rotation-center-offset - hint-hourhandshadow-rotation-center-offset - hint-minutehand-rotation-center-offset - hint-minutehandshadow-rotation-center-offset - hint-secondhand-rotation-center-offset - hint-secondhandshadow-rotation-center-offset The offset is taken from by the (width,height) of the hint element. Sadly this does not allow to specify a 0 in any dimension, as such an item is not passed through from QSvgRenderer/Plasms::Svg. Most themes might not need that though, so the few which might have to fall back to padding with transparent area. If no hint is set, defaults to (width/2, width/2). TEST PLAN Clocks of unmodified themes from store.kde.org still look as before. Themes with hints added have shadows at proper place as well as rotation center of hands at the expected offset. REPOSITORY R120 Plasma Workspace BRANCH fixclockshadowhandcenter REVISION DETAIL https://phabricator.kde.org/D20112 AFFECTED FILES applets/analog-clock/contents/ui/Hand.qml applets/analog-clock/contents/ui/analogclock.qml To: kossebau, #plasma, #vdg, mart, davidedmundson, ngraham Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart