Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added support for mixed percent/pixel values for bar geometry#701

Closed
ghost wants to merge 1 commit into
masterfrom
unknown repository
Closed

Added support for mixed percent/pixel values for bar geometry#701
ghost wants to merge 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Aug 17, 2017

Copy link
Copy Markdown

This allows for the width, height, offset-x, and offset-y configuration options to be set in one of the following formats:

width = 100%:-10px
width = 100%:-10
width = 100%
width = 100px
width = 100

This allows for pixel offsets on percent values. For example, with i3-gaps, you can line up the bar so that it is flush with the windows on the screen. This change does not require any configuration changes, but simply adds an optional offset.

@ghost ghost changed the title Added Support for Mixed Percent/Pixel Values for Bar Geometry Added support for mixed percent/pixel values for bar geometry Aug 17, 2017

@patrick96 patrick96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry this is so late. If you're still up for it, I'd like to merge this. But first, please use strtol instead of atoi for parsing the numbers, atoi has undefined behaviour, if the string doesn't have the right format.

EDIT: I just noticed, please also define geom_format_to_pixels in bar.hpp. Also, we recently had a PR that changed this particular section to accept floats, so you will need to rebase and actually use strtof

@ghost

ghost commented May 3, 2018

Copy link
Copy Markdown
Author

image

I fixed some parsing weirdness, changed all atoi's to strtof, moved some stuff around, and tested it. Everything seems to work as expected.

I think that's all, feel free to change/move anything.

@ghost

ghost commented May 3, 2018

Copy link
Copy Markdown
Author

image

The Travis failure appears to be on your end, it's a missing package. All other checks succeeded.

@patrick96 patrick96 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm right now writing unit tests for this. I have just noticed that we recently merged our PR that converted all uses of atoi to strtol (#1202), and this has now again caused a merge conflict.

Please resolve this again (sorry!), but I think you can just use your whole main.cpp when resolving.
Also while writing the tests, I noticed that geom_format_to_pixels returns a double but uses strtof, this causes precision issues in the unit test (not in any real world application though), so please switch strtod for consistency (or return a float, both are fine)

@ghost ghost closed this May 6, 2018
@patrick96

Copy link
Copy Markdown
Member

Do you no longer want to work on this?

@patrick96

Copy link
Copy Markdown
Member

I have now pulled your changes onto my own branch, added my tests and merged the whole thing. Thanks for the implementation

This pull request was closed.
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.

2 participants