| 1 |
#ifndef _BM_X11_H_ |
| 2 |
#define _BM_X11_H_ |
| 3 |
|
| 4 |
#include "internal.h" |
| 5 |
|
| 6 |
#include <X11/Xlib.h> |
| 7 |
#include <X11/keysym.h> |
| 8 |
|
| 9 |
#include "renderers/cairo_renderer.h" |
| 10 |
|
| 11 |
enum mod_bit { |
| 12 |
MOD_SHIFT = 1<<0, |
| 13 |
MOD_CTRL = 1<<1, |
| 14 |
MOD_ALT = 1<<2, |
| 15 |
}; |
| 16 |
|
| 17 |
struct buffer { |
| 18 |
struct cairo cairo; |
| 19 |
uint32_t width, height; |
| 20 |
bool created; |
| 21 |
}; |
| 22 |
|
| 23 |
struct window { |
| 24 |
Display *display; |
| 25 |
int32_t screen; |
| 26 |
Drawable drawable; |
| 27 |
XIM xim; |
| 28 |
XIC xic; |
| 29 |
Visual *visual; |
| 30 |
|
| 31 |
KeySym keysym; |
| 32 |
uint32_t mods; |
| 33 |
|
| 34 |
struct buffer buffer; |
| 35 |
uint32_t x, y, width, height, max_height; |
| 36 |
uint32_t orig_width, orig_x; |
| 37 |
uint32_t hmargin_size; |
| 38 |
float width_factor; |
| 39 |
uint32_t displayed; |
| 40 |
|
| 41 |
int32_t monitor; |
| 42 |
enum bm_align align; |
| 43 |
int32_t y_offset; |
| 44 |
|
| 45 |
struct { |
| 46 |
void (*render)(struct cairo *cairo, uint32_t width, uint32_t max_height, struct bm_menu *menu, struct cairo_paint_result *result); |
| 47 |
} notify; |
| 48 |
}; |
| 49 |
|
| 50 |
struct x11 { |
| 51 |
Display *display; |
| 52 |
struct window window; |
| 53 |
}; |
| 54 |
|
| 55 |
void bm_x11_window_render(struct window *window, struct bm_menu *menu); |
| 56 |
void bm_x11_window_key_press(struct window *window, XKeyEvent *ev); |
| 57 |
void bm_x11_window_set_monitor(struct window *window, int32_t monitor); |
| 58 |
void bm_x11_window_set_align(struct window *window, enum bm_align align); |
| 59 |
void bm_x11_window_set_y_offset(struct window *window, int32_t y_offset); |
| 60 |
void bm_x11_window_set_width(struct window *window, uint32_t margin, float factor); |
| 61 |
bool bm_x11_window_create(struct window *window, Display *display); |
| 62 |
void bm_x11_window_destroy(struct window *window); |
| 63 |
|
| 64 |
#endif /* _BM_WAYLAND_H_ */ |
| 65 |
|
| 66 |
/* vim: set ts=8 sw=4 tw=0 :*/ |