Loading...
Searching...
No Matches
engine.c File Reference

The skin-neutral slot engine. Builds one layer per slot and repaints them all on a store change. More...

#include "ui/engine/engine.h"
#include "text/cstring_fit.h"
#include <string.h>

Functions

static void draw_update (Layer *layer, GContext *ctx)
 Draw-slot update proc: hand the module its own bounds.
static void build (void)
 Work out the current slots and make one layer per slot.
static void destroy (void)
 Destroy the slot layers.
void engine_init (Window *window, EngineBuild build_cb)
 Build the slot layers for a face and paint them once.
void engine_deinit (void)
 Tear down the slot layers.
void engine_rebuild (void)
 Rebuild the slot layers (after a layout or theme change).
static void repaint_slot (uint8_t i)
 Repaint one slot: a text-slot re-pulls and re-fits (skipping an unchanged string), a draw-slot marks its layer dirty.
void engine_mark_dirty (void)
 Repaint every slot: text-slots re-pull + fit, draw-slots mark dirty.
void engine_mark_dirty_tags (uint32_t changed)
 Repaint only the slots whose tags intersect changed (plus any slot with no tags). Lets a face route a store change to just the slots that read from it.

Variables

static Window * s_window
 The window the slots are built in.
static EngineBuild s_build
 What the face passed to the engine at init.
static EngineSlot s_slots [ENGINE_SLOTS_MAX]
 The slots as the face defined them.
static Layer * s_layers [ENGINE_SLOTS_MAX]
 Draw-slot layers, NULL for text-slots.
static TextLayer * s_text_layers [ENGINE_SLOTS_MAX]
 Text-slot layers, NULL for draw-slots.
static char s_last_text [ENGINE_SLOTS_MAX][24]
 The last string set on each slot, so an unchanged one skips the re-fit.
static uint8_t s_count
 How many slots are in use.

Detailed Description

The skin-neutral slot engine. Builds one layer per slot and repaints them all on a store change.

Function Documentation

◆ draw_update()

void draw_update ( Layer * layer,
GContext * ctx )
static

Draw-slot update proc: hand the module its own bounds.

Parameters
layerThe slot layer (its data holds the slot index).
ctxThe graphics context.

◆ repaint_slot()

void repaint_slot ( uint8_t i)
static

Repaint one slot: a text-slot re-pulls and re-fits (skipping an unchanged string), a draw-slot marks its layer dirty.

Parameters
iThe slot index.