all repos — openbox @ f25252a4849ab205856629480178946b2b454aa3

openbox fork - make it a bit more like ryudo

src/xeventhandler.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// -*- mode: C++; indent-tabs-mode: nil; -*-
#ifndef   __xeventhandler_hh
#define   __xeventhandler_hh

/*! @file xeventhandler.hh
  @brief The class which handles raw XEvents, turning them into high-level
         user interaction sequences, or processing them as appropriate
*/

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

namespace ob {

//! Handles X events
/*!
  There are 2 type of X events:<br>
    a) User Actions<br>
    b) Background Events<br>
  <p>
  User Actions are events like mouse drags and presses, key presses.
  Background Events are everything else. Stuff that can't be bound to user
    input.
  <p>
  When an XEvent comes to the application, it is sent to this class. This class
  will determine what the event means, such as "A Left-Mouse-Button Drag on
  this window", or "Double click with right mouse button on root window" or
  "space bar pressed", or Background Event.
  <p>
  If the XEvent or combination of XEvents form a User Action, then the action
  is dispatched to the OBBindingMapper.
  <p>
  If the XEvent is a Background Event, it is simply dealt with as appropriate.
*/
class OBXEventHandler
{
private:
  //! The time at which the last XEvent with a time was received
  Time _lasttime;

  //! Handles mouse button press events
  /*!
    @param e The XEvent to handle
  */
  void buttonPress(const XButtonEvent &e);
  //! Handles mouse button release events
  /*!
    @param e The XEvent to handle
  */
  void buttonRelease(const XButtonEvent &e);
  //! Handles keyboard key press events
  /*!
    @param e The XEvent to handle
  */
  void keyPress(const XKeyEvent &e); 
  //! Handles mouse motion events
  /*!
    @param e The XEvent to handle
  */
  void motion(const XMotionEvent &e);
  //! Handles mouse-enter events
  /*!
    @param e The XEvent to handle
  */
  void enterNotify(const XCrossingEvent &e);
  //! Handles mouse-leave events
  /*!
    @param e The XEvent to handle
  */
  void leaveNotify(const XCrossingEvent &e);
  //! Handles configure request events
  /*!
    @param e The XEvent to handle
  */
  void configureRequest(const XConfigureRequestEvent &e);
  //! Handles window map request events
  /*!
    @param e The XEvent to handle
  */
  void mapRequest(const XMapRequestEvent &e);
  //! Handles window unmap events
  /*!
    @param e The XEvent to handle
  */
  void unmapNotify(const XUnmapEvent &e);
  //! Handles window destroy events
  /*!
    @param e The XEvent to handle
  */
  void destroyNotify(const XDestroyWindowEvent &e);
  //! Handles window reparent events
  /*!
    @param e The XEvent to handle
  */
  void reparentNotify(const XReparentEvent &e);
  //! Handles window property change events
  /*!
    @param e The XEvent to handle
  */
  void propertyNotify(const XPropertyEvent &e);
  //! Handles window expose events
  /*!
    @param e The XEvent to handle
  */
  void expose(const XExposeEvent &e);
  //! Handles colormap events
  /*!
    @param e The XEvent to handle
  */
  void colormapNotify(const XColormapEvent &e);
  //! Handles focus-in events
  /*!
    @param e The XEvent to handle
  */
  void focusIn(const XFocusChangeEvent &e);
  //! Handles focus-out events
  /*!
    @param e The XEvent to handle
  */
  void focusOut(const XFocusChangeEvent &e);
#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
  //! Handles Shape extension events
  /*!
    @param e The XEvent to handle
  */
  void shapeEvent(const XShapeEvent &e);
#endif // SHAPE 
  //! Handles client message events
  /*!
    @param e The XEvent to handle
  */
  void clientMessage(const XClientMessageEvent &e);
 
  
public:
  //! Constructs an OBXEventHandler object
  OBXEventHandler();
  
  //! Handle an XEvent
  /*!
    @param e The XEvent to handle
  */
  void handle(const XEvent &e);
};

}

#endif // __xeventhandler_hh