]> icculus.org git repositories - mikachu/openbox.git/blob - src/xeventhandler.hh
manage and unmanage windows in OBScreen
[mikachu/openbox.git] / src / xeventhandler.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef   __xeventhandler_hh
3 #define   __xeventhandler_hh
4
5 /*! @file xeventhandler.hh
6   @brief The class which handles raw XEvents, turning them into high-level
7          user interaction sequences, or processing them as appropriate
8 */
9
10 extern "C" {
11 #include <X11/Xlib.h>
12
13 #ifdef    SHAPE
14 #include <X11/extensions/shape.h>
15 #endif // SHAPE
16 }
17
18 namespace ob {
19
20 // XXX: TEMPORARY!!
21 class OBClient;
22
23
24 //! Handles X events
25 /*!
26   There are 2 type of X events:<br>
27     a) User Actions<br>
28     b) Background Events<br>
29   <p>
30   User Actions are events like mouse drags and presses, key presses.
31   Background Events are everything else. Stuff that can't be bound to user
32     input.
33   <p>
34   When an XEvent comes to the application, it is sent to this class. This class
35   will determine what the event means, such as "A Left-Mouse-Button Drag on
36   this window", or "Double click with right mouse button on root window" or
37   "space bar pressed", or Background Event.
38   <p>
39   If the XEvent or combination of XEvents form a User Action, then the action
40   is dispatched to the OBBindingMapper.
41   <p>
42   If the XEvent is a Background Event, it is simply dealt with as appropriate.
43 */
44 class OBXEventHandler
45 {
46 private:
47   //! The time at which the last XEvent with a time was received
48   Time _lasttime;
49
50   //! Handles mouse button press events
51   /*!
52     @param e The XEvent to handle
53   */
54   void buttonPress(const XButtonEvent &e);
55   //! Handles mouse button release events
56   /*!
57     @param e The XEvent to handle
58   */
59   void buttonRelease(const XButtonEvent &e);
60   //! Handles keyboard key press events
61   /*!
62     @param e The XEvent to handle
63   */
64   void keyPress(const XKeyEvent &e); 
65   //! Handles mouse motion events
66   /*!
67     @param e The XEvent to handle
68   */
69   void motion(const XMotionEvent &e);
70   //! Handles mouse-enter events
71   /*!
72     @param e The XEvent to handle
73   */
74   void enterNotify(const XCrossingEvent &e);
75   //! Handles mouse-leave events
76   /*!
77     @param e The XEvent to handle
78   */
79   void leaveNotify(const XCrossingEvent &e);
80   //! Handles configure request events
81   /*!
82     @param e The XEvent to handle
83   */
84   void configureRequest(const XConfigureRequestEvent &e);
85   //! Handles window map request events
86   /*!
87     @param e The XEvent to handle
88   */
89   void mapRequest(const XMapRequestEvent &e);
90   //! Handles window unmap events
91   /*!
92     @param e The XEvent to handle
93   */
94   void unmapNotify(const XUnmapEvent &e);
95   //! Handles window destroy events
96   /*!
97     @param e The XEvent to handle
98   */
99   void destroyNotify(const XDestroyWindowEvent &e);
100   //! Handles window reparent events
101   /*!
102     @param e The XEvent to handle
103   */
104   void reparentNotify(const XReparentEvent &e);
105   //! Handles window property change events
106   /*!
107     @param e The XEvent to handle
108   */
109   void propertyNotify(const XPropertyEvent &e);
110   //! Handles window expose events
111   /*!
112     @param e The XEvent to handle
113   */
114   void expose(const XExposeEvent &e);
115   //! Handles colormap events
116   /*!
117     @param e The XEvent to handle
118   */
119   void colormapNotify(const XColormapEvent &e);
120   //! Handles focus-in events
121   /*!
122     @param e The XEvent to handle
123   */
124   void focusIn(const XFocusChangeEvent &e);
125   //! Handles focus-out events
126   /*!
127     @param e The XEvent to handle
128   */
129   void focusOut(const XFocusChangeEvent &e);
130 #if defined(SHAPE) || defined(DOXYGEN_IGNORE)
131   //! Handles Shape extension events
132   /*!
133     @param e The XEvent to handle
134   */
135   void shapeEvent(const XShapeEvent &e);
136 #endif // SHAPE 
137   //! Handles client message events
138   /*!
139     @param e The XEvent to handle
140   */
141   void clientMessage(const XClientMessageEvent &e);
142  
143   
144 public:
145   //! Constructs an OBXEventHandler object
146   OBXEventHandler();
147   
148   //! Handle an XEvent
149   /*!
150     @param e The XEvent to handle
151   */
152   void handle(const XEvent &e);
153 };
154
155 }
156
157 #endif // __xeventhandler_hh