Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make window icons follow title alignment #4497

Merged
merged 1 commit into from Sep 9, 2021

Conversation

orestisfl
Copy link
Member

Fixes #4464
Related to #4453

See commit message

@orestisfl orestisfl added this to the 4.20 milestone Sep 7, 2021
src/x.c Outdated Show resolved Hide resolved
src/x.c Outdated Show resolved Hide resolved
src/x.c Outdated Show resolved Hide resolved
src/x.c Outdated Show resolved Hide resolved
src/x.c Outdated Show resolved Hide resolved
Fixes i3#4464.

Inspired by changes from i3#4453 but I didn't end up using the original
code.

For ALIGN_LEFT and ALIGN_CENTER icon offset is calculated first and then
title offset is based on that. For ALIGN_RIGHT title offset is
calculated first but we make sure that the icon fits in the window.

Additionally, icons will now hide if there is not enough space to render
them + their padding. Realistically, this won't happen in normal
usecases.

Effectively, icons have higher precedence over text: draw_util_text will
hide text when it exceeds the max width and the code takes this into
consideration. Icons will only hide when they can't fit at all, not in
order to assure that the text can be displayed fully.
Copy link
Member

@Airblader Airblader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but with the min/max confusion my question would be whether you actually tested it out with different padding settings? :-)

@orestisfl
Copy link
Member Author

I did, when it was 1 + pad. I just mix up min/max sometimes 😅

@orestisfl orestisfl merged commit ce2c218 into i3:next Sep 9, 2021
@orestisfl orestisfl deleted the icons-title-align branch September 9, 2021 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Window icons should follow title alignment
2 participants