aboutsummaryrefslogtreecommitdiff
path: root/include/seat.h
blob: e52a961c7a5a55f91f1926da71d8092f107ae17e (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
#ifndef _SEATD_SEAT_H
#define _SEATD_SEAT_H

#include "list.h"
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>

struct client;

struct seat_device {
	int device_id;
	int fd;
	int ref_cnt;
	bool active;
	char *path;
	dev_t dev;
};

struct seat {
	char *seat_name;
	struct list clients;
	struct client *active_client;
	struct client *next_client;

	bool vt_bound;
	bool vt_pending_ack;
	int next_vt;
};

struct seat *seat_create(const char *name, bool vt_bound);
void seat_destroy(struct seat *seat);

int seat_add_client(struct seat *seat, struct client *client);
int seat_remove_client(struct seat *seat, struct client *client);
int seat_open_client(struct seat *seat, struct client *client);
int seat_close_client(struct seat *seat, struct client *client);

struct seat_device *seat_open_device(struct client *client, const char *path);
int seat_close_device(struct client *client, struct seat_device *seat_device);
struct seat_device *seat_find_device(struct client *client, int device_id);

int seat_set_next_session(struct seat *seat, int session);
int seat_activate(struct seat *seat);
int seat_prepare_vt_switch(struct seat *seat);

#endif