You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

120 lines
2.3 KiB

  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 1997, 1998 Per Liden
  3. Copyright (C) 2004-06 Simone Rota <sip@varlock.com>
  4. Copyright (C) 2004-06 Johannes Winkelmann <jw@tks6.net>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. */
  10. #ifndef _APP_H_
  11. #define _APP_H_
  12. #include <X11/Xlib.h>
  13. #include <X11/Xatom.h>
  14. #include <signal.h>
  15. #include <unistd.h>
  16. #include <sys/wait.h>
  17. #include <errno.h>
  18. #include <setjmp.h>
  19. #include <stdlib.h>
  20. #include <iostream>
  21. #include "panel.h"
  22. #include "cfg.h"
  23. #include "image.h"
  24. #ifdef USE_PAM
  25. #include "PAM.h"
  26. #endif
  27. #ifdef USE_CONSOLEKIT
  28. #include "Ck.h"
  29. #endif
  30. class App {
  31. public:
  32. App(int argc, char **argv);
  33. ~App();
  34. void Run();
  35. int GetServerPID();
  36. void RestartServer();
  37. void StopServer();
  38. /* Lock functions */
  39. void GetLock();
  40. void RemoveLock();
  41. bool isServerStarted();
  42. private:
  43. void Login();
  44. void Reboot();
  45. void Halt();
  46. void Suspend();
  47. void Console();
  48. void Exit();
  49. void KillAllClients(Bool top);
  50. void ReadConfig();
  51. void OpenLog();
  52. void CloseLog();
  53. void HideCursor();
  54. void CreateServerAuth();
  55. char *StrConcat(const char *str1, const char *str2);
  56. void UpdatePid();
  57. bool AuthenticateUser(bool focuspass);
  58. static std::string findValidRandomTheme(const std::string &set);
  59. static void replaceVariables(std::string &input,
  60. const std::string &var,
  61. const std::string &value);
  62. /* Server functions */
  63. int StartServer();
  64. int ServerTimeout(int timeout, char *string);
  65. int WaitForServer();
  66. /* Private data */
  67. Window Root;
  68. Display *Dpy;
  69. int Scr;
  70. Panel *LoginPanel;
  71. int ServerPID;
  72. const char *DisplayName;
  73. bool serverStarted;
  74. #ifdef USE_PAM
  75. PAM::Authenticator pam;
  76. #endif
  77. #ifdef USE_CONSOLEKIT
  78. Ck::Session ck;
  79. #endif
  80. /* Options */
  81. char *DispName;
  82. Cfg *cfg;
  83. Pixmap BackgroundPixmap;
  84. void blankScreen();
  85. Image *image;
  86. Atom BackgroundPixmapId;
  87. void setBackground(const std::string &themedir);
  88. bool firstlogin;
  89. bool daemonmode;
  90. bool force_nodaemon;
  91. /* For testing themes */
  92. char *testtheme;
  93. bool testing;
  94. std::string themeName;
  95. std::string mcookie;
  96. const int mcookiesize;
  97. };
  98. #endif /* _APP_H_ */