app.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. class App {
  23. public:
  24. App(int argc, char** argv);
  25. ~App();
  26. void Run();
  27. int GetServerPID();
  28. void StopServer();
  29. // Lock functions
  30. void GetLock();
  31. void RemoveLock();
  32. private:
  33. void Login();
  34. void Reboot();
  35. void Halt();
  36. void Suspend();
  37. void Console();
  38. void Exit();
  39. void KillAllClients(Bool top);
  40. void RestartServer();
  41. void ReadConfig();
  42. void OpenLog();
  43. void CloseLog();
  44. void HideCursor();
  45. void CreateServerAuth();
  46. char* StrConcat(const char* str1, const char* str2);
  47. static std::string findValidRandomTheme(const std::string& set);
  48. static void replaceVariables(std::string& input,
  49. const std::string& var,
  50. const std::string& value);
  51. // Server functions
  52. int StartServer();
  53. int ServerTimeout(int timeout, char *string);
  54. int WaitForServer();
  55. // Private data
  56. Window Root;
  57. Display* Dpy;
  58. int Scr;
  59. Panel* LoginPanel;
  60. int ServerPID;
  61. char* DisplayName;
  62. // Options
  63. char* DispName;
  64. Cfg cfg;
  65. XpmAttributes BackgroundPixmapAttributes;
  66. Pixmap BackgroundPixmap;
  67. void blankScreen();
  68. void setBackground(const string& themedir);
  69. bool daemonmode;
  70. // For testing themes
  71. char* testtheme;
  72. bool testing;
  73. std::string themeName;
  74. std::string mcookie;
  75. };
  76. #endif