1 /* ghosd -- OSD with fake transparency, cairo, and pango.
2  * Copyright (C) 2006 Evan Martin <martine@danga.com>
3  *
4  * With further development by Giacomo Lozito <james@develia.org>
5  * for the ghosd-based Audacious OSD
6  * - added real transparency with X Composite Extension
7  * - added mouse event handling on OSD window
8  * - added/changed some other stuff
9  */
10 
11 #ifndef __GHOSD_H__
12 #define __GHOSD_H__
13 
14 #include <cairo/cairo.h>
15 
16 #include <limits.h>  /* INT_MAX */
17 #include <sys/time.h>  /* timeval */
18 
19 typedef struct _Ghosd Ghosd;
20 
21 /* minimal struct to handle button events */
22 typedef struct
23 {
24   int x, y;
25   int send_event;
26   int x_root, y_root;
27   unsigned int button;
28   unsigned long time;
29 }
30 GhosdEventButton;
31 
32 typedef void (*GhosdRenderFunc)(Ghosd *ghosd, cairo_t *cr, void *user_data);
33 typedef void (*GhosdEventButtonCb)(Ghosd *ghosd, GhosdEventButton *event, void *user_data);
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 Ghosd *ghosd_new(void);
40 void   ghosd_destroy(Ghosd* ghosd);
41 Ghosd *ghosd_new_with_argbvisual(void);
42 int ghosd_check_composite_ext(void);
43 int ghosd_check_composite_mgr(void);
44 
45 #define GHOSD_COORD_CENTER INT_MAX
46 void ghosd_set_transparent(Ghosd *ghosd, int transparent);
47 void ghosd_set_position(Ghosd *ghosd, int x, int y, int width, int height);
48 void ghosd_set_render(Ghosd *ghosd, GhosdRenderFunc render_func,
49                       void* user_data, void (*user_data_d)(void*));
50 
51 void ghosd_render(Ghosd *ghosd);
52 void ghosd_show(Ghosd *ghosd);
53 void ghosd_hide(Ghosd *ghosd);
54 
55 void ghosd_set_event_button_cb(Ghosd *ghosd, GhosdEventButtonCb cb, void *user_data );
56 
57 void ghosd_main_iterations(Ghosd *ghosd);
58 void ghosd_main_until(Ghosd *ghosd, struct timeval *until);
59 void ghosd_flash(Ghosd *ghosd, int fade_ms, int total_display_ms);
60 
61 int ghosd_get_socket(Ghosd *ghosd);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif /* __GHOSD_H__ */
68 
69 /* vim: set ts=2 sw=2 et cino=(0 : */
70