Keyboard max size didn't account for UI buttons

Keyboard's goal is to not be > 90% of the width of the drawing
canvas.  Was misinterpreting the incoming argument ('canvas'),
so have to account for the toolbar (left) and selector (right)
buttons in the UI.

So e.g., `tuxpaint --900x768 --onscreen-keyboard` will use the
small keyboard buttons, while `... --1024x768 ...` will use the large.
This commit is contained in:
Bill Kendrick 2020-08-25 22:09:02 -07:00
parent 61998e4d00
commit 8ef759a9a7

View file

@ -127,7 +127,7 @@ struct osk_keyboard *osk_create(char * layout_name, SDL_Surface * canvas,
printf("w %i, h %i\n", layout->width, layout->height);
#endif
if (layout->width * LG_button_up->w >= canvas->w * 0.9 ||
if (layout->width * LG_button_up->w >= (canvas->w - 48 * 4) * 0.9 ||
layout->height * LG_button_up->h >= canvas->h * 0.5) {
/* Full-size buttons too large, use small buttons */
button_up = SM_button_up;