app.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 <signal.h>
  14. #include <unistd.h>
  15. #include <sys/wait.h>
  16. #include <errno.h>
  17. #include <setjmp.h>
  18. #include <stdlib.h>
  19. #include <iostream>
  20. #include "panel.h"
  21. #include "cfg.h"
  22. #include "image.h"
  23. #ifdef USE_PAM
  24. #include "PAM.h"
  25. #endif
  26. class App {
  27. public:
  28. App(int argc, char** argv);
  29. ~App();
  30. void Run();
  31. int GetServerPID();
  32. void RestartServer();
  33. void StopServer();
  34. bool serverStarted;
  35. // Lock functions
  36. void GetLock();
  37. void RemoveLock();
  38. private:
  39. void Login();
  40. void Reboot();
  41. void Halt();
  42. void Suspend();
  43. void Console();
  44. void Exit();
  45. void KillAllClients(Bool top);
  46. void ReadConfig();
  47. void OpenLog();
  48. void CloseLog();
  49. void HideCursor();
  50. void CreateServerAuth();
  51. char* StrConcat(const char* str1, const char* str2);
  52. void UpdatePid();
  53. bool AuthenticateUser(bool focuspass);
  54. static std::string findValidRandomTheme(const std::string& set);
  55. static void replaceVariables(std::string& input,
  56. const std::string& var,
  57. const std::string& value);
  58. // Server functions
  59. int StartServer();
  60. int ServerTimeout(int timeout, char *string);
  61. int WaitForServer();
  62. // Private data
  63. Window Root;
  64. Display* Dpy;
  65. int Scr;
  66. Panel* LoginPanel;
  67. int ServerPID;
  68. const char* DisplayName;
  69. #ifdef USE_PAM
  70. PAM::Authenticator pam;
  71. #endif
  72. // Options
  73. char* DispName;
  74. Cfg *cfg;
  75. Pixmap BackgroundPixmap;
  76. void blankScreen();
  77. Image* image;
  78. void setBackground(const std::string& themedir);
  79. bool firstlogin;
  80. bool daemonmode;
  81. bool force_nodaemon;
  82. // For testing themes
  83. char* testtheme;
  84. bool testing;
  85. std::string themeName;
  86. std::string mcookie;
  87. const int mcookiesize;
  88. };
  89. #endif