]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/console/consoled.h
hostname-util: ignore case when checking if hostname is localhost
[thirdparty/systemd.git] / src / console / consoled.h
CommitLineData
ce7b9f50
DH
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright 2014 David Herrmann <dh.herrmann@gmail.com>
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
ce7b9f50 24#include "grdev.h"
ce7b9f50
DH
25#include "idev.h"
26#include "list.h"
27#include "macro.h"
28#include "pty.h"
29#include "sd-bus.h"
30#include "sd-event.h"
31#include "sysview.h"
32#include "term.h"
33#include "unifont.h"
ce7b9f50
DH
34
35typedef struct Manager Manager;
36typedef struct Session Session;
37typedef struct Display Display;
38typedef struct Workspace Workspace;
39typedef struct Terminal Terminal;
40
41/*
42 * Terminals
43 */
44
45struct Terminal {
46 Workspace *workspace;
47 LIST_FIELDS(Terminal, terminals_by_workspace);
48
49 term_utf8 utf8;
50 term_parser *parser;
51 term_screen *screen;
52 Pty *pty;
53};
54
55int terminal_new(Terminal **out, Workspace *w);
56Terminal *terminal_free(Terminal *t);
57
58DEFINE_TRIVIAL_CLEANUP_FUNC(Terminal*, terminal_free);
59
60void terminal_resize(Terminal *t);
61void terminal_run(Terminal *t);
62void terminal_feed(Terminal *t, idev_data *data);
63bool terminal_draw(Terminal *t, const grdev_display_target *target);
64
65/*
66 * Workspaces
67 */
68
69struct Workspace {
70 unsigned long ref;
71 Manager *manager;
72 LIST_FIELDS(Workspace, workspaces_by_manager);
73
74 LIST_HEAD(Terminal, terminal_list);
75 Terminal *current;
76
77 LIST_HEAD(Session, session_list);
78 uint32_t width;
79 uint32_t height;
80};
81
82int workspace_new(Workspace **out, Manager *m);
83Workspace *workspace_ref(Workspace *w);
84Workspace *workspace_unref(Workspace *w);
85
86DEFINE_TRIVIAL_CLEANUP_FUNC(Workspace*, workspace_unref);
87
88Workspace *workspace_attach(Workspace *w, Session *s);
89Workspace *workspace_detach(Workspace *w, Session *s);
90void workspace_refresh(Workspace *w);
91
92void workspace_dirty(Workspace *w);
93void workspace_feed(Workspace *w, idev_data *data);
94bool workspace_draw(Workspace *w, const grdev_display_target *target);
95
96/*
97 * Displays
98 */
99
100struct Display {
101 Session *session;
102 LIST_FIELDS(Display, displays_by_session);
103 grdev_display *grdev;
104 uint32_t width;
105 uint32_t height;
106};
107
108int display_new(Display **out, Session *s, grdev_display *grdev);
109Display *display_free(Display *d);
110
111DEFINE_TRIVIAL_CLEANUP_FUNC(Display*, display_free);
112
113void display_refresh(Display *d);
114void display_render(Display *d, Workspace *w);
115
116/*
117 * Sessions
118 */
119
120struct Session {
121 Manager *manager;
122 sysview_session *sysview;
123 grdev_session *grdev;
124 idev_session *idev;
125
126 LIST_FIELDS(Session, sessions_by_workspace);
127 Workspace *my_ws;
128 Workspace *active_ws;
129
130 LIST_HEAD(Display, display_list);
131 sd_event_source *redraw_src;
132};
133
134int session_new(Session **out, Manager *m, sysview_session *session);
135Session *session_free(Session *s);
136
137DEFINE_TRIVIAL_CLEANUP_FUNC(Session*, session_free);
138
139void session_dirty(Session *s);
140
141void session_add_device(Session *s, sysview_device *device);
142void session_remove_device(Session *s, sysview_device *device);
143void session_refresh_device(Session *s, sysview_device *device, struct udev_device *ud);
144
145/*
146 * Managers
147 */
148
149struct Manager {
150 sd_event *event;
151 sd_bus *sysbus;
152 unifont *uf;
153 sysview_context *sysview;
154 grdev_context *grdev;
155 idev_context *idev;
156 LIST_HEAD(Workspace, workspace_list);
157};
158
159int manager_new(Manager **out);
160Manager *manager_free(Manager *m);
161
162DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free);
163
164int manager_run(Manager *m);