]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/login/logind-button.h
logind: rework button setting semantics
[thirdparty/systemd.git] / src / login / logind-button.h
CommitLineData
e9d21f24
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#ifndef foologindbuttonhfoo
4#define foologindbuttonhfoo
5
6/***
7 This file is part of systemd.
8
9 Copyright 2012 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23***/
24
25typedef struct Button Button;
26
27typedef enum HandleButton {
6de0e0e5
LP
28 HANDLE_OFF,
29 HANDLE_NO_SESSION, /* Only handle key when nobody is logged in; honour inhibitors */
30 HANDLE_TTY_SESSION, /* Only handle key when nobody is logged in, or the fg session is the only one and non-graphical; honour inhibitors */
31 HANDLE_ANY_SESSION, /* Only handle key when nobody is logged in, or the fg session is the only one; honour inhibtors */
32 HANDLE_ALWAYS, /* Always handle, ignore sessions; ignore inhibitors */
e9d21f24
LP
33 _HANDLE_BUTTON_MAX,
34 _HANDLE_BUTTON_INVALID = -1
35} HandleButton;
36
37#include "list.h"
38#include "util.h"
39#include "logind.h"
40
41struct Button {
42 Manager *manager;
43
44 char *name;
45 char *seat;
46 int fd;
47};
48
49Button* button_new(Manager *m, const char *name);
50void button_free(Button*b);
51int button_open(Button *b);
52int button_process(Button *b);
53int button_set_seat(Button *b, const char *sn);
54
55const char* handle_button_to_string(HandleButton h);
56HandleButton handle_button_from_string(const char *s);
57
58int config_parse_handle_button(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
59
60#endif