/* * render.h * * Created by buzzert 2019-01-18 */ #pragma once #include "animation.h" #include "auth.h" #include #include #include #include #include #define kMaxAnimations 32 #define kMaxPasswordLength 128 #define kMaxPromptLength 128 typedef unsigned animation_key_t; #define ANIM_KEY_NOEXIST (kMaxAnimations + 1) typedef struct { cairo_t *ctx; cairo_surface_t *surface; PangoLayout *pango_layout; PangoFontDescription *status_font; double background_redshift; RsvgHandle *logo_svg_handle; double logo_fill_progress; RsvgHandle *asterisk_svg_handle; int canvas_width; int canvas_height; bool input_allowed; double cursor_opacity; animation_key_t cursor_anim_key; bool is_processing; bool is_authenticated; RsvgHandle *spinner_svg_handle; animation_key_t spinner_anim_key; char password_prompt[kMaxPromptLength]; char password_buffer[kMaxPasswordLength]; double password_opacity; animation_t animations[kMaxAnimations]; unsigned num_animations; struct auth_handle_t *auth_handle; } saver_state_t; // Use this to set the prompt ("Password: ") void set_password_prompt(saver_state_t *state, const char *prompt); // Start an animation animation_key_t schedule_animation(saver_state_t *state, animation_t anim); // Stop an animation void remove_animation(saver_state_t *state, animation_key_t anim_key); // Get a running animation (returns NULL if it doesn't exist) animation_t* get_animation_for_key(saver_state_t *state, animation_key_t anim_key); // Update all running animations void update_animations(saver_state_t *state); // Background void draw_background(saver_state_t *state); // The purple sidebar void draw_logo(saver_state_t *state); // The status string and paassword field void draw_password_field(saver_state_t *state);