summaryrefslogtreecommitdiff
path: root/tests/src/x-server.h
blob: 32f00da9f090c0315ec0d119376d3aa7d58b4d03 (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
#ifndef X_SERVER_H_
#define X_SERVER_H_

#include <glib-object.h>
#include <gio/gio.h>

G_BEGIN_DECLS

#define X_CLIENT_SIGNAL_DISCONNECTED "disconnected"

#define X_SERVER_SIGNAL_CLIENT_CONNECTED    "client-connected"
#define X_SERVER_SIGNAL_CLIENT_DISCONNECTED "client-disconnected"
#define X_SERVER_SIGNAL_RESET               "reset"

typedef struct XClientPrivate XClientPrivate;

typedef struct
{
   GObject         parent_instance;
   XClientPrivate *priv;
} XClient;

typedef struct
{
   GObjectClass parent_class;
   void (*disconnected)(XClient *client);
} XClientClass;

typedef struct XServerPrivate XServerPrivate;

typedef struct
{
   GObject         parent_instance;
   XServerPrivate *priv;
} XServer;

typedef struct
{
   GObjectClass parent_class;
   void (*client_connected)(XServer *server, XClient *client);
   void (*client_disconnected)(XServer *server, XClient *client);
   void (*reset)(XServer *server);
} XServerClass;

GType x_server_get_type (void);

XServer *x_server_new (gint display_number);

gboolean x_server_start (XServer *server);

gsize x_server_get_n_clients (XServer *server);

GType x_client_get_type (void);

void x_client_send_failed (XClient *client, const gchar *reason);

void x_client_send_success (XClient *client);

void x_client_send_error (XClient *client, int type, int major, int minor);

void x_client_disconnect (XClient *client);

G_END_DECLS

#endif /* X_SERVER_H_ */