2020-07-31 00:22:18 +02:00
|
|
|
#ifndef _SEATD_SEAT_H
|
|
|
|
#define _SEATD_SEAT_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
2020-08-03 02:12:47 +02:00
|
|
|
#include "linked_list.h"
|
|
|
|
|
2020-07-31 00:22:18 +02:00
|
|
|
struct client;
|
|
|
|
|
2020-08-01 03:23:56 +02:00
|
|
|
enum seat_device_type {
|
|
|
|
SEAT_DEVICE_TYPE_NORMAL,
|
|
|
|
SEAT_DEVICE_TYPE_EVDEV,
|
|
|
|
SEAT_DEVICE_TYPE_DRM,
|
|
|
|
};
|
|
|
|
|
2020-07-31 00:22:18 +02:00
|
|
|
struct seat_device {
|
2020-08-03 02:12:47 +02:00
|
|
|
struct linked_list link; // client::devices
|
2020-07-31 00:22:18 +02:00
|
|
|
int device_id;
|
|
|
|
int fd;
|
|
|
|
int ref_cnt;
|
|
|
|
bool active;
|
|
|
|
char *path;
|
2020-08-01 03:23:56 +02:00
|
|
|
enum seat_device_type type;
|
2020-07-31 00:22:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct seat {
|
2020-08-31 01:34:36 +02:00
|
|
|
struct linked_list link; // server::seats
|
2020-07-31 00:22:18 +02:00
|
|
|
char *seat_name;
|
2020-08-03 02:26:22 +02:00
|
|
|
struct linked_list clients;
|
2020-07-31 00:22:18 +02:00
|
|
|
struct client *active_client;
|
|
|
|
struct client *next_client;
|
|
|
|
|
|
|
|
bool vt_bound;
|
2020-09-18 15:38:53 +02:00
|
|
|
int cur_ttyfd;
|
|
|
|
int cur_vt;
|
|
|
|
int session_cnt;
|
2020-07-31 00:22:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
2020-08-02 21:40:32 +02:00
|
|
|
int seat_remove_client(struct client *client);
|
2020-07-31 00:22:18 +02:00
|
|
|
int seat_open_client(struct seat *seat, struct client *client);
|
2020-08-02 21:40:32 +02:00
|
|
|
int seat_close_client(struct client *client);
|
|
|
|
int seat_ack_disable_client(struct client *client);
|
2020-07-31 00:22:18 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2020-08-02 21:40:32 +02:00
|
|
|
int seat_set_next_session(struct client *client, int session);
|
2020-09-18 15:38:53 +02:00
|
|
|
int seat_vt_activate(struct seat *seat);
|
2020-07-31 00:22:18 +02:00
|
|
|
int seat_prepare_vt_switch(struct seat *seat);
|
|
|
|
|
|
|
|
#endif
|