2020-09-11 01:25:28 -07:00
|
|
|
#ifndef __DRW_H
|
|
|
|
#define __DRW_H
|
|
|
|
|
2021-08-24 18:52:05 +02:00
|
|
|
#include <pango/pangocairo.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2020-09-11 01:25:28 -07:00
|
|
|
struct drw;
|
|
|
|
struct drwsurf;
|
2021-08-24 18:52:05 +02:00
|
|
|
struct kbd;
|
2020-09-11 01:25:28 -07:00
|
|
|
|
|
|
|
void drw_init(struct drw *d, const char *fc_pattern, struct wl_display *dpy,
|
2021-08-24 18:52:05 +02:00
|
|
|
void *iface);
|
2020-09-11 01:25:28 -07:00
|
|
|
void drwsurf_init(struct drw *d, struct drwsurf *ds, struct wl_surface *surf);
|
|
|
|
void drwsurf_resize(struct drwsurf *ds, uint32_t w, uint32_t h);
|
|
|
|
void drwsurf_flip(struct drwsurf *ds);
|
|
|
|
|
2021-08-24 18:52:05 +02:00
|
|
|
typedef union {
|
|
|
|
uint8_t bgra[4];
|
|
|
|
uint32_t color;
|
|
|
|
} Color;
|
|
|
|
|
|
|
|
void
|
|
|
|
drw_fill_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
|
|
|
uint32_t w, uint32_t h);
|
|
|
|
|
|
|
|
void
|
|
|
|
drw_draw_text(struct drwsurf *d, Color color,
|
|
|
|
uint32_t x, uint32_t y,
|
|
|
|
uint32_t w, uint32_t h,
|
|
|
|
const char *label);
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
setup_buffer(struct drwsurf *drwsurf);
|
|
|
|
|
2020-09-11 01:25:28 -07:00
|
|
|
struct drw {
|
2021-08-24 18:52:05 +02:00
|
|
|
struct wl_shm *shm;
|
|
|
|
PangoFontDescription *font_description;
|
2020-09-11 01:25:28 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct drwsurf {
|
2021-08-24 18:52:05 +02:00
|
|
|
uint32_t w, h, s;
|
2020-09-11 01:25:28 -07:00
|
|
|
bool dirty;
|
|
|
|
|
|
|
|
struct drw *ctx;
|
|
|
|
struct wl_surface *surf;
|
2021-08-24 18:52:05 +02:00
|
|
|
struct wl_buffer *buf;
|
|
|
|
struct wl_shm *shm;
|
|
|
|
unsigned char *pool_data;
|
|
|
|
|
|
|
|
cairo_t *cairo;
|
|
|
|
PangoLayout *layout;
|
2020-09-11 01:25:28 -07:00
|
|
|
|
|
|
|
struct wl_callback *cb;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|