-
Notifications
You must be signed in to change notification settings - Fork 34
/
app.h
119 lines (99 loc) · 2.26 KB
/
app.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* SLiM - Simple Login Manager
* Copyright (C) 1997, 1998 Per Liden
* Copyright (C) 2004-06 Simone Rota <[email protected]>
* Copyright (C) 2004-06 Johannes Winkelmann <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef _APP_H_
#define _APP_H_
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <signal.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <setjmp.h>
#include <stdlib.h>
#include <iostream>
#include "panel.h"
#include "cfg.h"
#include "image.h"
#ifdef USE_PAM
#include "PAM.h"
#endif
#ifdef USE_CONSOLEKIT
#include "Ck.h"
#endif
class App {
public:
App(int argc, char **argv);
~App();
void Run();
int GetServerPID();
void RestartServer();
void StopServer();
/* Lock functions */
void GetLock();
void RemoveLock();
bool isServerStarted();
private:
void Login();
void Reboot();
void Halt();
void Suspend();
void Console();
void Exit();
void KillAllClients(Bool top);
void ReadConfig();
void OpenLog();
void CloseLog();
void HideCursor();
void CreateServerAuth();
char *StrConcat(const char *str1, const char *str2);
void UpdatePid();
bool AuthenticateUser(bool focuspass);
static std::string findValidRandomTheme(const std::string &set);
static void replaceVariables(std::string &input,
const std::string &var,
const std::string &value);
/* Server functions */
int StartServer();
int ServerTimeout(int timeout, char *string);
int WaitForServer();
/* Private data */
Window Root;
Display *Dpy;
int Scr;
Panel *LoginPanel;
int ServerPID;
const char *DisplayName;
bool serverStarted;
#ifdef USE_PAM
PAM::Authenticator pam;
#endif
#ifdef USE_CONSOLEKIT
Ck::Session ck;
#endif
/* Options */
char *DispName;
Cfg *cfg;
Pixmap BackgroundPixmap;
void blankScreen();
Image *image;
Atom BackgroundPixmapId;
void setBackground(const std::string &themedir);
bool firstlogin;
bool daemonmode;
bool force_nodaemon;
/* For testing themes */
char *testtheme;
bool testing;
std::string themeName;
std::string mcookie;
const int mcookiesize;
};
#endif /* _APP_H_ */