#include #include "ncrswrap.h" #include "surface.h" static inline struct ct_surface *__surface(struct ct_dims *const dims, struct ct_bounds *const bounds, WINDOW *const win) { struct ct_surface *surface; surface = (struct ct_surface *)malloc(sizeof(struct ct_surface)); *surface = (struct ct_surface){ .dims = dims, .bounds = bounds, .win = win, .updatereq = true, }; return surface; } struct ct_surface *new_surface(struct ct_dims *const dims, struct ct_bounds *const bounds) { WINDOW *const win = new_window(dims->x, dims->y, dims->width, dims->height); return __surface(dims, bounds, win); } void destroy_surface(struct ct_surface *const surface) { destroy_window(surface->win); free(surface->dims); } void resize_surface(struct ct_surface *const surface, struct ct_dims *const dims) { free(surface->dims); surface->dims = dims; surface->updatereq = true; resizemv_window(surface->win, dims->x, dims->y, dims->width, dims->height); } void rebind_surface(struct ct_surface *const surface, struct ct_bounds *const bounds) { free(surface->bounds); surface->bounds = bounds; }