File: aosd.h

package info (click to toggle)
libaosd 0.2.7-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch, trixie
  • size: 512 kB
  • sloc: sh: 2,859; ansic: 1,731; makefile: 82
file content (105 lines) | stat: -rw-r--r-- 2,873 bytes parent folder | download | duplicates (2)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* aosd -- OSD with transparency, cairo, and pango.
 *
 * Copyright (C) 2006 Evan Martin <martine@danga.com>
 *
 * With further development by Giacomo Lozito <james@develia.org>
 * - added real transparency with X Composite Extension
 * - added mouse event handling on OSD window
 * - added/changed some other stuff
 */

#ifndef __AOSD_H__
#define __AOSD_H__

#include <X11/Xutil.h>

#include <cairo/cairo.h>

#ifdef __cplusplus
extern "C"
{
#endif

/* global object type */
typedef struct _Aosd Aosd;

// relative coordinates for positioning
typedef enum {
  COORDINATE_MINIMUM = 0,
  COORDINATE_CENTER,
  COORDINATE_MAXIMUM
} AosdCoordinate;

/* minimal struct to handle mouse events */
typedef struct
{
  // relative coordinates
  int x, y;
  // global coordinates
  int x_root, y_root;

  int send_event;

  // button being pressed
  unsigned int button;
  unsigned long time;
}
AosdMouseEvent;

/* various callbacks */
typedef void (*AosdRenderer)(cairo_t* cr, void* user_data);
typedef void (*AosdMouseEventCb)(AosdMouseEvent* event, void* user_data);

typedef enum
{
  TRANSPARENCY_NONE = 0,
  TRANSPARENCY_FAKE,
  TRANSPARENCY_COMPOSITE
} AosdTransparency;

/* object (de)allocators */
Aosd* aosd_new(void);
void aosd_destroy(Aosd* aosd);

/* object inspectors */
void aosd_get_name(Aosd* aosd, XClassHint* result);
void aosd_get_names(Aosd* aosd, char** res_name, char** res_class);
AosdTransparency aosd_get_transparency(Aosd* aosd);
void aosd_get_geometry(Aosd* aosd, int* x, int* y, int* width, int* height);
void aosd_get_screen_size(Aosd* aosd, int* width, int* height);
Bool aosd_get_is_shown(Aosd* aosd);

/* object configurators */
void aosd_set_name(Aosd* aosd, XClassHint* name);
void aosd_set_names(Aosd* aosd, const char* res_name, const char* res_class);
void aosd_set_transparency(Aosd* aosd, AosdTransparency mode);
void aosd_set_geometry(Aosd* aosd, int x, int y, int width, int height);
void aosd_set_position(Aosd* aosd, unsigned pos, int width, int height);
void aosd_set_position_offset(Aosd* aosd, int x_offset, int y_offset);
void aosd_set_position_with_offset(Aosd* aosd,
    AosdCoordinate abscissa, AosdCoordinate ordinate, int width, int height,
    int x_offset, int y_offset);
void aosd_set_renderer(Aosd* aosd, AosdRenderer renderer, void* user_data);
void aosd_set_mouse_event_cb(Aosd* aosd, AosdMouseEventCb cb, void* user_data);
void aosd_set_hide_upon_mouse_event(Aosd* aosd, Bool enable);

/* object manipulators */
void aosd_render(Aosd* aosd);
void aosd_show(Aosd* aosd);
void aosd_hide(Aosd* aosd);

/* X main loop processing */
void aosd_loop_once(Aosd* aosd);
void aosd_loop_for(Aosd* aosd, unsigned loop_ms);

/* automatic object manipulator */
void aosd_flash(Aosd* aosd, unsigned fade_in_ms,
    unsigned full_ms, unsigned fade_out_ms);

#ifdef __cplusplus
}
#endif

#endif /* __AOSD_H__ */

/* vim: set ts=2 sw=2 et : */