kmscon: remove cdev sessions
[platform/upstream/kmscon.git] / src / kmscon_conf.h
1 /*
2  * Main App
3  *
4  * Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files
8  * (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25
26 /*
27  * This includes global data for the whole kmscon application. For instance,
28  * global parameters can be accessed via this header.
29  */
30
31 #ifndef KMSCON_MAIN_H
32 #define KMSCON_MAIN_H
33
34 #include <stdbool.h>
35 #include <stddef.h>
36 #include <stdlib.h>
37 #include "conf.h"
38 #include "shl_dlist.h"
39
40 enum kmscon_conf_gpu_selection {
41         KMSCON_GPU_ALL,
42         KMSCON_GPU_AUX,
43         KMSCON_GPU_PRIMARY,
44 };
45
46 struct kmscon_conf_t {
47         /* header information */
48         bool seat_config;
49
50         /* General Options */
51         /* show help/usage information */
52         bool help;
53         /* exit application after parsing options */
54         bool exit;
55         /* enable verbose info messages */
56         bool verbose;
57         /* enable debug messages */
58         bool debug;
59         /* disable notices and warnings */
60         bool silent;
61         /* config directory name */
62         char *configdir;
63         /* listen mode */
64         bool listen;
65
66         /* Seat Options */
67         /* VT number to run on */
68         char *vt;
69         /* enter new VT directly */
70         bool switchvt;
71         /* seats */
72         char **seats;
73
74         /* Session Options */
75         /* sessions */
76         unsigned int session_max;
77         /* allow keyboard session control */
78         bool session_control;
79         /* run terminal session */
80         bool terminal_session;
81
82         /* Terminal Options */
83         /* custom login process */
84         bool login;
85         /* argv for login process */
86         char **argv;
87         /* TERM value */
88         char *term;
89         /* reset environment */
90         bool reset_env;
91         /* color palette */
92         char *palette;
93         /* terminal scroll-back buffer size */
94         unsigned int sb_size;
95
96         /* Input Options */
97         /* input KBD model */
98         char *xkb_model;
99         /* input KBD layout */
100         char *xkb_layout;
101         /* input KBD variant */
102         char *xkb_variant;
103         /* input KBD options */
104         char *xkb_options;
105         /* input predefined KBD keymap */
106         char *xkb_keymap;
107         /* keyboard key-repeat delay */
108         unsigned int xkb_repeat_delay;
109         /* keyboard key-repeat rate */
110         unsigned int xkb_repeat_rate;
111
112         /* Grabs / Keyboard-Shortcuts */
113         /* scroll-up grab */
114         struct conf_grab *grab_scroll_up;
115         /* scroll-down grab */
116         struct conf_grab *grab_scroll_down;
117         /* page-up grab */
118         struct conf_grab *grab_page_up;
119         /* page-down grab */
120         struct conf_grab *grab_page_down;
121         /* zoom-in grab */
122         struct conf_grab *grab_zoom_in;
123         /* zoom-out grab */
124         struct conf_grab *grab_zoom_out;
125         /* session-next grab */
126         struct conf_grab *grab_session_next;
127         /* session-prev grab */
128         struct conf_grab *grab_session_prev;
129         /* session-dummy grab */
130         struct conf_grab *grab_session_dummy;
131         /* session-close grab */
132         struct conf_grab *grab_session_close;
133         /* terminal-new grab */
134         struct conf_grab *grab_terminal_new;
135
136         /* Video Options */
137         /* use DRM if available */
138         bool drm;
139         /* use 3D hardware-acceleration if available */
140         bool hwaccel;
141         /* gpu selection mode */
142         unsigned int gpus;
143         /* render engine */
144         char *render_engine;
145         /* print render-engine timing information */
146         bool render_timing;
147
148         /* Font Options */
149         /* font engine */
150         char *font_engine;
151         /* font size */
152         unsigned int font_size;
153         /* font name */
154         char *font_name;
155         /* font ppi (overrides per monitor PPI) */
156         unsigned int font_ppi;
157 };
158
159 int kmscon_conf_new(struct conf_ctx **out);
160 void kmscon_conf_free(struct conf_ctx *ctx);
161 int kmscon_conf_load_main(struct conf_ctx *ctx, int argc, char **argv);
162 int kmscon_conf_load_seat(struct conf_ctx *ctx, const struct conf_ctx *main,
163                           const char *seat);
164
165 static inline bool kmscon_conf_is_current_seat(struct kmscon_conf_t *conf)
166 {
167         return conf && shl_string_list_is(conf->seats, "current");
168 }
169
170 static inline bool kmscon_conf_is_all_seats(struct kmscon_conf_t *conf)
171 {
172         return conf && shl_string_list_is(conf->seats, "all");
173 }
174
175 static inline bool kmscon_conf_is_single_seat(struct kmscon_conf_t *conf)
176 {
177         return conf && !kmscon_conf_is_all_seats(conf) &&
178                shl_string_list_count(conf->seats, true) == 1;
179 }
180
181 #endif /* KMSCON_MAIN_H */