~ubuntu-branches/ubuntu/maverick/libaosd/maverick

« back to all changes in this revision

Viewing changes to libaosd/aosd.h

  • Committer: Bazaar Package Importer
  • Author(s): William Pitcock
  • Date: 2007-11-30 07:42:21 UTC
  • Revision ID: james.westby@ubuntu.com-20071130074221-8yt6spn1ns6rfw7e
Tags: upstream-0.1.3
ImportĀ upstreamĀ versionĀ 0.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* aosd -- OSD with transparency, cairo, and pango.
 
2
 *
 
3
 * Copyright (C) 2006 Evan Martin <martine@danga.com>
 
4
 *
 
5
 * With further development by Giacomo Lozito <james@develia.org>
 
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 __AOSD_H__
 
12
#define __AOSD_H__
 
13
 
 
14
#include <X11/Xutil.h>
 
15
 
 
16
#include <cairo/cairo.h>
 
17
 
 
18
#include <limits.h>  /* INT_MAX */
 
19
#include <sys/time.h>  /* timeval */
 
20
 
 
21
/* global object type */
 
22
typedef struct _Aosd Aosd;
 
23
 
 
24
#define AOSD_COORD_CENTER INT_MAX
 
25
 
 
26
/* minimal struct to handle mouse events */
 
27
typedef struct
 
28
{
 
29
  // relative coordinates
 
30
  int x, y;
 
31
  // global coordinates
 
32
  int x_root, y_root;
 
33
 
 
34
  // whether we should send the event further
 
35
  int send_event;
 
36
 
 
37
  // button being pressed
 
38
  unsigned int button;
 
39
  unsigned long time;
 
40
}
 
41
AosdMouseEvent;
 
42
 
 
43
/* various callbacks */
 
44
typedef void (*AosdRenderer)(Aosd* aosd, cairo_t* cr, void* user_data);
 
45
typedef void (*AosdMouseEventCb)(Aosd* aosd, AosdMouseEvent* event,
 
46
                                 void* user_data);
 
47
 
 
48
typedef enum
 
49
{
 
50
  TRANSPARENCY_NONE = 0,
 
51
  TRANSPARENCY_FAKE,
 
52
  TRANSPARENCY_COMPOSITE
 
53
} AosdTransparency;
 
54
 
 
55
/* object (de)allocators */
 
56
Aosd* aosd_new(void);
 
57
void aosd_destroy(Aosd* aosd);
 
58
 
 
59
/* object inspectors */
 
60
void aosd_get_name(Aosd* aosd, XClassHint* result);
 
61
AosdTransparency aosd_get_transparency(Aosd* aosd);
 
62
void aosd_get_geometry(Aosd* aosd, int* x, int* y, int* width, int* height);
 
63
 
 
64
/* object configurators */
 
65
void aosd_set_name(Aosd* aosd, XClassHint* name);
 
66
void aosd_set_transparency(Aosd* aosd, AosdTransparency mode);
 
67
void aosd_set_geometry(Aosd* aosd, int x, int y, int width, int height);
 
68
void aosd_set_renderer(Aosd* aosd, AosdRenderer renderer, void* user_data,
 
69
    void (*user_data_d)(void*));
 
70
void aosd_set_mouse_event_cb(Aosd* aosd, AosdMouseEventCb cb, void* user_data);
 
71
 
 
72
/* manual object manipulators */
 
73
void aosd_render(Aosd* aosd);
 
74
void aosd_show(Aosd* aosd);
 
75
void aosd_hide(Aosd* aosd);
 
76
 
 
77
/* automatic object manipulators */
 
78
void aosd_main_iterations(Aosd* aosd);
 
79
void aosd_main_until(Aosd* aosd, struct timeval* until);
 
80
void aosd_flash(Aosd* aosd, int fade_ms, int total_display_ms);
 
81
 
 
82
#endif /* __AOSD_H__ */
 
83
 
 
84
/* vim: set ts=2 sw=2 et : */