summaryrefslogtreecommitdiff
path: root/src/app.h
blob: 1a1c61cbf9c880ddb9a0952bade47a45348b9207 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef _SESELMGR_H
#define _SESELMGR_H

#include <selinux/selinux.h>
#include <selinux/avc.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
#include <xcb/xfixes.h>
#include <xcb/xselinux.h>
#include <gtk/gtk.h>

enum {
    COL_NAME,
    COL_ATOM,
    COL_WIN,
    COL_TYPE,
    COL_DATA,
    COL_OCTX,
    COL_OFG,
    COL_OBG,
    COL_DCTX,
    COL_DFG,
    COL_DBG,
    COL_ICON,
    N_COLS
};

struct thread_data {
    const gchar *display;
    GtkTreeModel *store;
    GtkWidget *appwin;
    GtkWidget *expwin;
};


/* selmon.c */
int
sel_monitor_init(struct thread_data *data);

/* selman.c */
int
sel_manager_init(struct thread_data *data);

void
expose(xcb_atom_t atom, xcb_window_t owner, security_context_t level,
       xcb_timestamp_t time);

void
expose_stop(xcb_timestamp_t time);

/* propmon.c */
int
prop_monitor_init(struct thread_data *data);

/* inputmon.c */

int
input_monitor_init(struct thread_data *data);

/* atom.c */
extern xcb_atom_t xa_targets;
extern xcb_atom_t xa_prop;
extern xcb_atom_t xa_incr;
extern xcb_atom_t xa_atom;
extern xcb_atom_t xa_text;
extern xcb_atom_t wm_name;

void
atom_init(xcb_connection_t *conn);

gboolean
atom_is_string_type(xcb_atom_t atom);

const char *
atom_lookup(xcb_connection_t *conn, xcb_atom_t atom);

const char *
selection_lookup(xcb_connection_t *conn, xcb_window_t window, xcb_atom_t atom);

void
selection_register(xcb_connection_t *conn, xcb_window_t window);

/* conn.c */
xcb_connection_t *
make_connection(const gchar *display);

int
fetch_property_data(xcb_connection_t *conn,
		    xcb_window_t window, xcb_atom_t property, int delete,
		    xcb_atom_t *type_rtn, unsigned *format_rtn,
		    void **data_rtn, size_t *len_rtn);

/* util.c */
#define APP_ERR(error, msg...) app_err(error, __func__, __LINE__, msg);

void
app_err(xcb_generic_error_t *error,
	const char *func, const int line, const char *fmt, ...)
	__attribute__ ((noreturn));

char *
get_colors(security_context_t octx, security_context_t dctx);

char *
scrub_text(void *input);

#endif