[Active Window Control] Slightly fix vertical alignment of window name
ClosedPublic

Authored by Pitel on Mar 5 2018, 6:37 PM.

Details

Summary

On my setup the window label was 1px lower than global menu items (with Fill height enabled) which was very annoying.
I guess it was caused by some rounding error. This patch fixes it.

Old:

New:

(Red rectangle was added so the issue is easier to spot.)

Test Plan

Checked that window label is still vertically centered.

Diff Detail

Repository
R884 Active Window Control Applet for Plasma
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Pitel created this revision.Mar 5 2018, 6:37 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 5 2018, 6:37 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
Pitel requested review of this revision.Mar 5 2018, 6:37 PM
broulik added a subscriber: broulik.Mar 5 2018, 7:00 PM

This disregards any descenders text might have, the previous approach was more technically correct.

Pitel added a comment.EditedMar 5 2018, 7:13 PM

Would it be better to move global menu 1px down instead?

--- a/package/contents/ui/AppMenu.qml
+++ b/package/contents/ui/AppMenu.qml
@@ -113,7 +113,10 @@ Item {

                 PlasmaComponents.Label {
                     id: appmenuButtonTitle
-                    anchors.centerIn: appmenuButtonBackground
+                    anchors.top: appmenuButtonBackground.top
+                    anchors.bottom: appmenuButtonBackground.bottom
+                    verticalAlignment: Text.AlignVCenter
+                    anchors.horizontalCenter: appmenuButtonBackground.horizontalCenter
                     font.pixelSize: fontPixelSize * plasmoid.configuration.appmenuButtonTextSizeScale
                     text: activeMenu.replace('&', '')
                     font.weight: appmenuFontBold ? Font.Bold : theme.defaultFont.weight

It also fixes the issue (although I liked the 1px higher a bit better in this specific case).

Anyway the root of the problem seems to be that each of them was centered in a different way.

martinkostolny requested changes to this revision.Mar 7 2018, 12:26 AM

Firstly, thanks for your effort!

I prefer the latter variant. The first proposed one proves Kai's warning because it broke multi-line title wrapping (e.g. if you have thicker panel).

This revision now requires changes to proceed.Mar 7 2018, 12:26 AM
Pitel updated this revision to Diff 28886.Mar 7 2018, 8:02 AM

Moving appmenu instead of window title.

martinkostolny accepted this revision.Mar 11 2018, 3:07 PM

Perfect, thanks!

This revision is now accepted and ready to land.Mar 11 2018, 3:07 PM
This revision was automatically updated to reflect the committed changes.