aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/events.h
blob: 73d0712898724086a4d596f0627f51dcd4007c1c (plain)
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
/*
 ** Uzbl event routines
 ** (c) 2009 by Robert Manea
*/

#ifndef __EVENTS__
#define __EVENTS__

#include <glib.h>
#include <stdarg.h>

/* Event system */
enum event_type {
    LOAD_START, LOAD_COMMIT, LOAD_FINISH, LOAD_ERROR,
    REQUEST_STARTING,
    KEY_PRESS, KEY_RELEASE, MOD_PRESS, MOD_RELEASE,
    COMMAND_EXECUTED,
    LINK_HOVER, TITLE_CHANGED, GEOMETRY_CHANGED,
    WEBINSPECTOR, NEW_WINDOW, SELECTION_CHANGED,
    VARIABLE_SET, FIFO_SET, SOCKET_SET,
    INSTANCE_START, INSTANCE_EXIT, LOAD_PROGRESS,
    LINK_UNHOVER, FORM_ACTIVE, ROOT_ACTIVE,
    FOCUS_LOST, FOCUS_GAINED, FILE_INCLUDED,
    PLUG_CREATED, COMMAND_ERROR, BUILTINS,
    PTR_MOVE, SCROLL_VERT, SCROLL_HORIZ,
    DOWNLOAD_STARTED, DOWNLOAD_PROGRESS, DOWNLOAD_COMPLETE,
    ADD_COOKIE, DELETE_COOKIE,
    FOCUS_ELEMENT, BLUR_ELEMENT,

    /* must be last entry */
    LAST_EVENT
};

typedef struct _Event Event;
struct _Event;

void
event_buffer_timeout(guint sec);

void
replay_buffered_events();

/*
 * build event string
 */
Event *
format_event(int type, const gchar *custom_event, ...) G_GNUC_NULL_TERMINATED;

Event *
vformat_event(int type, const gchar *custom_event, va_list vargs);

/*
 * send a already formatted event string over the supported interfaces.
 * returned event string should be freed by `event_free`
 */
void
send_formatted_event(const Event *event);

/*
 * frees a event string
 */
void
event_free(Event *event);

/*
 * build event string and send over the supported interfaces
 * this is the same as calling `format_event` and then `send_formatted_event`
 */
void
send_event(int type, const gchar *custom_event, ...) G_GNUC_NULL_TERMINATED;

void
vsend_event(int type, const gchar *custom_event, va_list vargs);

gchar *
get_modifier_mask(guint state);

void
key_to_event(guint keyval, guint state, guint is_modifier, gint mode);

void
button_to_event(guint buttonval, guint state, gint mode);

#endif