app.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. static std::string findValidRandomTheme(const std::string& set);
  46. static void 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 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