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

Fix layout calculations #414

Merged
merged 3 commits into from
Dec 28, 2015
Merged

Fix layout calculations #414

merged 3 commits into from
Dec 28, 2015

Conversation

sce
Copy link
Contributor

@sce sce commented Dec 28, 2015

If the width or height of a container can't be evenly distributed to its
children, then the layout algorithm still thought it got it right (due
to using decimals) which caused a gap of one or more pixels for some
window arrangements.

This is fixed (by the second patch) by first rounding off the width and height
(so that decimals are never introduced) and then adjusting the last
view in a container to fill the remaining pixels (which now is counted
correctly due to the decimals being removed).

Also, due to the way gaps are implemented, an odd sized gap can never be
aligned properly, so just adjust to closest even number.

Fixes #392 .

First patch is a "minor refactoring" of the layout algorithm. Third patch adjusts some debug output that was annoying me.

This brings consistency into the algorithm (instead of resetting and
then fetching again).
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1.0)

project(sway C)

set(CMAKE_C_FLAGS "-g")
set(CMAKE_C_FLAGS "-g -lm")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is required by math.h, if this is not the right way to do this let me know.

Choose a reason for hiding this comment

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

I think target_link_libraries is the preferred way to link stuff. And since this is only required by sway this could be moved to sway/CMakeLists.txt.

Copy link
Contributor

Choose a reason for hiding this comment

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

Correct, use target_link_libraries in the sway subproject.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Super, fixed!

If the width or height of a container can't be evenly distributed to its
children, then the layout algorithm still thought it got it right (due
to using decimals) which caused a gap of one or more pixels for some
window arrangements.

This is fixed by this patch by first rounding off the width and height
(so that decimals are never introduced) and then adjusting the last
view in a container to fill the remaining pixels (which now is counted
correctly due to the decimals being removed).

Also, due to the way gaps are implemented, an odd sized gap can never be
aligned properly, so just adjust to closest even number.
ddevault added a commit that referenced this pull request Dec 28, 2015
@ddevault ddevault merged commit e363546 into swaywm:master Dec 28, 2015
@ddevault
Copy link
Contributor

🎉

@sce sce deleted the fix_layout_calc branch December 28, 2015 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Small gaps showing.
3 participants