Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently you have to always query every piece of data, even if you only wanted one of them.
Soi, I find myself writing a little bit of boilerplate even if i just wanted to check the display's width to check if a text can fit on it.
Note: While looking at the code i saw that you can pass
NULL
pointers to the function, which was not documented, i added it.So, with the current implementation we can actually do
.... but i find this code much less friendly, specially for beginners, thus the new API allows to simply
While presserving the old API as a convenience wrapper to all of these getters
PS1: I know this adds some duplication and may make code harder to maintain (longer codebase), not ideal
PS2: Perhaps it could be done the other way around, with new getters calling the "everything" one and returning the value we want, however this would lead to needing many changes if a new parameter is added that can be queried (all the
get_*
would need an extraNULL
to the call). And i feel like breaking the logic into smaller function is a better idea anywayTypes of Changes
Issues Fixed or Closed by This PR
Checklist