all repos — openbox @ 373de009f7e98b0c6f3a78f31c1e5c120cd722ed

openbox fork - make it a bit more like ryudo

src/openbox.hh (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// -*- mode: C++; indent-tabs-mode: nil; -*-
#ifndef   __openbox_hh
#define   __openbox_hh

extern "C" {
#include <X11/Xlib.h>
}

#include <string>
#include <vector>

#include "otk/screeninfo.hh"
#include "timer.hh"

namespace ob {

class Openbox
{
public:
  static Openbox *instance;  // there can only be ONE instance of this class in
                             // the program, and it is held in here

  typedef std::vector<otk::ScreenInfo> ScreenInfoList;

  enum RunState {
    State_Starting,
    State_Normal,
    State_Exiting
  };
  
private:
  // stuff that can be passed on the command line
  std::string _rcfilepath;   // path to the config file to use/in use
  std::string _menufilepath; // path to the menu file to use/in use
  char *_displayreq;         // display requested by the user
  char *_argv0;              // argv[0], how the program was called

  OBTimerQueueManager _timermanager; // manages timers, so that they fire when
                                     // their time elapses

  RunState _state;           // the state of the window manager

  ScreenInfoList _screenInfoList; // info for all screens on the display

  void parseCommandLine(int argv, char **argv);
  void showVersion();
  void showHelp();

  static int xerrorHandler(Display *d, XErrorEvent *e);
  static void signalHandler(int signal);

public:
  //! Openbox constructor.
  /*!
    \param argc Number of command line arguments, as received in main()
    \param argv The command line arguments, as received in main()
  */
  Openbox(int argc, char **argv);
  //! Openbox destructor.
  virtual ~Openbox();

  //! Returns the state of the window manager (starting, exiting, etc).
  inline RunState state() const { return _state; }

  inline OBTimerQueueManager *timerManager() { return &_timermanager; }

  void eventLoop();

  // XXX: TEMPORARY!#!@%*!^#*!#!#!
  virtual void process_event(XEvent *) = 0;

  //! Requests that the window manager exit.
  inline void shutdown() { _state = State_Exiting; }
};

}

#endif // __openbox_hh