-
Notifications
You must be signed in to change notification settings - Fork 24
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
Conversation
There was a problem hiding this 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.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
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.
This comment was marked as resolved.
Sorry, something went wrong.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 ^^.
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. |
Also, apologies for not creating a new branch for these changes. I forgot :p |
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... ;). |
Thanks! :) |
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)