]> Dogcows Code - chaz/openbox/blob - src/actions.hh
python with callbacks!
[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/rect.hh"
11 #include "otk/eventhandler.hh"
12
13 extern "C" {
14 #include <X11/Xlib.h>
15 }
16
17 namespace ob {
18
19 //! The action interface for user-available actions
20 /*!
21 When these actions are fired, hooks to the guile engine are fired so that
22 guile code is run.
23 */
24 class OBActions : public otk::OtkEventHandler {
25 public:
26 enum ActionType {
27 Action_ButtonPress,
28 Action_ButtonRelease,
29 Action_EnterWindow,
30 Action_LeaveWindow,
31 Action_KeyPress,
32 Action_MouseMotion,
33 NUM_ACTIONS
34 };
35
36 struct ButtonReleaseAction {
37 Window win;
38 unsigned int button;
39 Time time;
40 ButtonReleaseAction() { win = 0; button = 0; time = 0; }
41 };
42
43 struct ButtonPressAction {
44 unsigned int button;
45 otk::Point pos;
46 otk::Rect clientarea;
47 ButtonPressAction() { button = 0; }
48 };
49
50 private:
51 // milliseconds XXX: config option
52 static const unsigned int DOUBLECLICKDELAY;
53 static const int BUTTONS = 5;
54
55 //! The mouse button currently being watched from a press for a CLICK
56 unsigned int _button;
57 //! The last button release processed for CLICKs
58 ButtonReleaseAction _release;
59 //! The point where the mouse was when each mouse button was pressed
60 /*!
61 Used for motion events as the starting position.
62 */
63 ButtonPressAction *_posqueue[BUTTONS];
64 //! The delta x/y of the last motion sequence
65 int _dx, _dy;
66
67 //! Insert a button/position in the _posqueue
68 void insertPress(const XButtonEvent &e);
69 //! Remove a button/position from the _posqueue
70 void removePress(const XButtonEvent &e);
71
72 public:
73 //! Constructs an OBActions object
74 OBActions();
75 //! Destroys the OBActions object
76 virtual ~OBActions();
77
78 virtual void buttonPressHandler(const XButtonEvent &e);
79 virtual void buttonReleaseHandler(const XButtonEvent &e);
80
81 virtual void enterHandler(const XCrossingEvent &e);
82 virtual void leaveHandler(const XCrossingEvent &e);
83
84 virtual void keyPressHandler(const XKeyEvent &e);
85
86 virtual void motionHandler(const XMotionEvent &e);
87 };
88
89 }
90
91 #endif // __actions_hh
This page took 0.037302 seconds and 5 git commands to generate.