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

Added fbink_get_state() to dump FBInk internal vars to a struct #13

Merged
merged 2 commits into from
Sep 17, 2018
Merged

Added fbink_get_state() to dump FBInk internal vars to a struct #13

merged 2 commits into from
Sep 17, 2018

Conversation

shermp
Copy link
Contributor

@shermp shermp commented Sep 16, 2018

I'm in some situations when developing where knowing the framebuffer size/state would be really useful. FBInk already did this -- for shell users.

I added a new function and struct to dump the information to said struct instead.

Let me know if you have any issues with it. Tested with a simple C test program on Linux (not on my Kobo)

Copy link
Owner

@NiLuJe NiLuJe left a comment

Choose a reason for hiding this comment

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

A few minor comments, but other than that, I'm definitely okay with it, it does come in handy having that info sometimes ;).

I'll double-check the string thingy, because I'm not quite sure I'm not talking out of my ass here ;).

fbink.c Outdated
fbink_state->font_w = FONTW;
fbink_state->font_h = FONTH;
fbink_state->font_sz_mult = FONTSIZE_MULT;
fbink_state->font_name = fontname_to_string(fbink_config->fontname);

This comment was marked as resolved.

This comment was marked as resolved.

fbink.h Outdated
unsigned short font_w;
unsigned short font_h;
uint8_t font_sz_mult;
const char* font_name;

This comment was marked as resolved.

fbink.c Outdated
fbink_state->bpp = vInfo.bits_per_pixel;
fbink_state->font_w = FONTW;
fbink_state->font_h = FONTH;
fbink_state->font_sz_mult = FONTSIZE_MULT;
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe I'd keep it matching the internal name, i.e., fontsize_mult.

Plus, sz has a fraught history of sometimes meaning 'zero-terminated string' in C ;).

fbink.h Outdated
@@ -189,6 +209,9 @@ FBINK_API int fbink_init(int fbfd, const FBInkConfig* fbink_config);
// Dumps a few of our internal state variables to stdout, in a format easily consumable by a shell (i.e., eval)
FBINK_API void fbink_state_dump(const FBInkConfig* fbink_config);

// Dump a few of out internal state variables to struct pointed to by fbink_state
Copy link
Owner

Choose a reason for hiding this comment

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

out -> our ;). I'm fairly sure I made the exact same typo at one point, it might even have been committed ^^.

@NiLuJe
Copy link
Owner

NiLuJe commented Sep 17, 2018

Okay, apparently string literals do always have a static duration, even in a return statement like that, so, carry on, and forget my 5AM ramblings on the subject ;D.

@shermp
Copy link
Contributor Author

shermp commented Sep 17, 2018

Also, apologies for not creating a new branch for these changes. I forgot :p

@NiLuJe NiLuJe merged commit d561d1c into NiLuJe:master Sep 17, 2018
@NiLuJe
Copy link
Owner

NiLuJe commented Sep 17, 2018

No worries, I'm not an avid brancher either, I tend to only do that for truly experimental stuff, or if I know things will be a bit shaky for a while... ;).

@NiLuJe
Copy link
Owner

NiLuJe commented Sep 17, 2018

Thanks! :)

NiLuJe added a commit that referenced this pull request Sep 17, 2018
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