#include #include #include "btk-cell.h" /* window states mask */ enum btk_window_states { BTK_WINDOW_STATE_INITIAL = 0, BTK_WINDOW_STATE_MAPPED = 1U << 0, BTK_WINDOW_STATE_DISABLED = 1U << 1, BTK_WINDOW_STATE_FOCUSED = 1U << 2, BTK_WINDOW_STATE_LOCKED = 1U << 3 }; typedef struct { /* xcb + cairo */ xcb_connection_t *x_con; int pad0; xcb_window_t x_win; cairo_surface_t *c_srf; int pad1; cairo_t *c_ctx; int pad2; /* self info */ int state; btk_size_t ps; /* actual pixel dimensions */ btk_size_t ms; /* minimum pixel dimensions */ btk_size_t es; /* extra pixel dimensions */ btk_size_t cs; /* dimensions in cells */ btk_pos_t sc; /* stretch row and column positions in cells */ btk_area_t sa; /* area of the stretched core */ btk_pos_t pt; /* pointer position in pixels */ /* contents */ btk_cell_t *cells; /* array of cell */ unsigned int cells_n; /* number of cells */ int cell_focus; /* id of currently focused cell */ int cell_press; /* id of cell under the pointer when press */ int focus_in; /* = 1 if the focus is 'inside' the cell */ void (*func_kill)(void); } btk_window_t; btk_window_t* btk_window_create (xcb_connection_t *, xcb_screen_t *, xcb_visualtype_t *, unsigned int, unsigned int, int, int, unsigned int, unsigned int, unsigned int, void (*)(void)); void btk_window_destroy (btk_window_t *); void btk_window_disable (btk_window_t *); void btk_window_enable (btk_window_t *); void btk_window_init_cells (btk_window_t *); void btk_window_input_button (btk_window_t *, int, int); void btk_window_input_key (btk_window_t *, xcb_keysym_t); void btk_window_input_pointer (btk_window_t *, btk_pos_t); void btk_window_redraw (btk_window_t *); void btk_window_redraw_cell (btk_window_t *, unsigned int); void btk_window_redraw_cell_focus (btk_window_t *, btk_cell_t*); int btk_window_resize (btk_window_t *); /* returns 1 if size actually changed */ void btk_window_set_name (btk_window_t *, char *); void btk_window_update_cell_area (btk_window_t *, btk_cell_t*);