app.h 2.0 KB

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