]> Dogcows Code - chaz/openbox/blob - src/actions.hh
e57593f78f6fbecdd1f792dc74bc129b793c92fc
[chaz/openbox] / src / actions.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef __actions_hh
3 #define __actions_hh
4
5 /*! @file actions.hh
6 @brief The action interface for user-available actions
7 */
8
9 #include "otk/point.hh"
10 #include "otk/eventhandler.hh"
11
12 extern "C" {
13 #include <X11/Xlib.h>
14 }
15
16 namespace ob {
17
18 //! The action interface for user-available actions
19 /*!
20 When these actions are fired, hooks to the guile engine are fired so that
21 guile code is run.
22 */
23 class OBActions : public otk::OtkEventHandler {
24 public:
25 struct ButtonReleaseAction {
26 Window win;
27 unsigned int button;
28 Time time;
29 ButtonReleaseAction() { win = 0; button = 0; time = 0; }
30 };
31
32 struct ButtonPressAction {
33 unsigned int button;
34 otk::Point pos;
35 ButtonPressAction() { button = 0; }
36 };
37
38 private:
39 // milliseconds XXX: config option
40 static const unsigned int DOUBLECLICKDELAY;
41 static const int BUTTONS = 5;
42
43 //! The mouse button currently being watched from a press for a CLICK
44 unsigned int _button;
45 //! The last button release processed for CLICKs
46 ButtonReleaseAction _release;
47 //! The point where the mouse was when each mouse button was pressed
48 /*!
49 Used for motion events as the starting position.
50 */
51 ButtonPressAction *_posqueue[BUTTONS];
52
53 //! Insert a button/position in the _posqueue
54 void insertPress(const XButtonEvent &e);
55 //! Remove a button/position from the _posqueue
56 void removePress(const XButtonEvent &e);
57
58 public:
59 //! Constructs an OBActions object
60 OBActions();
61 //! Destroys the OBActions object
62 virtual ~OBActions();
63
64 virtual void buttonPressHandler(const XButtonEvent &e);
65 virtual void buttonReleaseHandler(const XButtonEvent &e);
66
67 virtual void enterHandler(const XCrossingEvent &e);
68 virtual void leaveHandler(const XCrossingEvent &e);
69
70 virtual void keyPressHandler(const XKeyEvent &e);
71
72 virtual void motionHandler(const XMotionEvent &e);
73 };
74
75 }
76
77 #endif // __actions_hh
This page took 0.038489 seconds and 4 git commands to generate.