app.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SLiM - Simple Login Manager
  2. Copyright (C) 1997, 1998 Per Liden
  3. Copyright (C) 2004-05 Simone Rota <sip@varlock.com>
  4. Copyright (C) 2004-05 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. using namespace std;
  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 ReadConfig();
  42. void OpenLog();
  43. void CloseLog();
  44. void HideCursor();
  45. static std::string findValidRandomTheme(const std::string& set);
  46. static void App::replaceVariables(std::string& input,
  47. const std::string& var,
  48. const std::string& value);
  49. // Server functions
  50. int StartServer();
  51. int ServerTimeout(int timeout, char *string);
  52. int WaitForServer();
  53. // Private data
  54. Window Root;
  55. Display* Dpy;
  56. int Scr;
  57. Panel* LoginPanel;
  58. int ServerPID;
  59. char* DisplayName;
  60. // Options
  61. char* DispName;
  62. Cfg cfg;
  63. XpmAttributes BackgroundPixmapAttributes;
  64. Pixmap BackgroundPixmap;
  65. void App::blankScreen();
  66. void setBackground(const string& themedir);
  67. bool daemonmode;
  68. // For testing themes
  69. char* testtheme;
  70. bool testing;
  71. std::string themeName;
  72. };
  73. #endif