forked from jgmenu/jgmenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathx11-ui.h
77 lines (68 loc) · 2.21 KB
/
x11-ui.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef X11_UI_H
#define X11_UI_H
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <cairo.h>
#include <cairo-xlib.h>
#include <pango/pangocairo.h>
#include <librsvg/rsvg.h>
#include "align.h"
struct area {
int x, y, w, h;
};
struct point {
int x, y;
};
struct window_data {
Window win;
XIC xic;
XSetWindowAttributes swa;
GC gc;
Pixmap canvas;
cairo_surface_t *cs;
cairo_t *c;
PangoLayout *pangolayout;
PangoFontDescription *pangofont;
};
struct UI {
int cur;
struct window_data w[MAX_NR_WINDOWS];
Display *dpy;
XIM xim;
int screen;
Window root;
XVisualInfo vinfo;
int font_height_actual; /* used to centre text vertically */
};
extern struct UI *ui;
void ui_clear_canvas(void);
void grabkeyboard(void);
void grabpointer(void);
void ui_init(void);
void ui_get_screen_res(int *x0, int *y0, int *width, int *height);
void ui_create_window(int x, int y, int w, int h);
void ui_init_canvas(int max_width, int max_height);
void ui_init_cairo(int canvas_width, int canvas_height, const char *font);
void ui_win_init(int x, int y, int w, int h, int max_w, int max_h, const char *font);
void ui_win_add(int x, int y, int w, int h, int max_w, int max_h, const char *font);
void ui_win_goto_parent(void);
void ui_win_activate(Window w);
int ui_has_child_window_open(Window w);
Window ui_win_child_wid(Window w);
void ui_win_del(void);
void ui_win_del_beyond(int w);
void ui_draw_rectangle_rounded_at_top(double x, double y, double w, double h, double radius,
double line_width, int fill, double *rgba);
void ui_draw_rectangle(double x, double y, double w, double h, double radius, double line_width,
int fill, double *rgba);
void ui_draw_line(double x0, double y0, double x1, double y1, double line_width, double *rgba);
void ui_insert_text(char *s, int x, int y, int h, int w, double *rgba,
enum alignment align);
struct point ui_get_text_size(const char *str, const char *fontdesc);
int ui_is_point_in_area(struct point p, struct area a);
void ui_map_window(unsigned int w, unsigned int h);
void ui_cleanup(void);
void ui_insert_svg(RsvgHandle *svg, double x, double y, double size);
void ui_insert_image(cairo_surface_t *image, double x, double y, double size);
#endif /* X11_UI_H */