summaryrefslogtreecommitdiff
path: root/src/app.h
blob: cae6575435ee42004fead3b631d98741f4bb23ba (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#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 <X11/Xlib.h>
#include <X11/Xlib-xcb.h>
#include <X11/extensions/XInput2.h>
#include <gdk/gdkx.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;
    GtkTreeView *view;
    GtkWidget *appwin;
    GtkWidget *expwin;
};


/* main.c */
extern unsigned timestamp;

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

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

void
sel_expose(GtkWidget *widget, GtkTreeView *view);

void
sel_expose_stop(GtkDialog *dialog, gint response_id, gpointer user_data);

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

/* inputmon.c */
int
input_monitor_init(struct thread_data *data);

void
input_relabel(GtkWidget *widget, GtkTreeView *view);

void
input_add(GtkWidget *widget, GtkTreeView *view);

void
input_remove(GtkWidget *widget, GtkTreeView *view);

void
input_activate(GtkWidget *widget, GtkTreeView *view);

void
input_configure(GtkWidget *widget, GtkTreeView *view);

/* 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 */
void
make_connection(const gchar *name, xcb_connection_t **conn, Display **dpy);

void
check_xselinux(xcb_connection_t *conn);

void
check_xfixes(xcb_connection_t *conn);

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