]> Dogcows Code - chaz/openbox/blob - src/actions.hh
f18696a10526426da996cf74f5f42bc94f56b03e
[chaz/openbox] / src / actions.hh
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
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 #include <Python.h>
16 }
17
18 #include <map>
19
20 namespace ob {
21
22 //! The action interface for user-available actions
23 /*!
24 When these actions are fired, hooks to the guile engine are fired so that
25 guile code is run.
26 */
27 class Actions : public otk::EventHandler {
28 public:
29 #ifndef SWIG // get rid of a swig warning
30 struct ButtonReleaseAction {
31 Window win;
32 unsigned int button;
33 Time time;
34 ButtonReleaseAction() { win = 0; button = 0; time = 0; }
35 };
36
37 struct ButtonPressAction {
38 unsigned int button;
39 otk::Point pos;
40 otk::Rect clientarea;
41 ButtonPressAction() { button = 0; }
42 };
43 #endif // SWIG
44 private:
45 // milliseconds XXX: config option
46 static const int BUTTONS = 5;
47
48 //! The mouse button currently being watched from a press for a CLICK
49 unsigned int _button;
50 //! The last button release processed for CLICKs
51 ButtonReleaseAction _release;
52 //! The point where the mouse was when each mouse button was pressed
53 /*!
54 Used for motion events as the starting position.
55 */
56 ButtonPressAction *_posqueue[BUTTONS];
57 //! This is set to true once a drag has started and false when done to make
58 //! sure the threshold isnt checked anymore once a drag is underway
59 bool _dragging;
60
61
62 void insertPress(const XButtonEvent &e);
63 void removePress(const XButtonEvent &e);
64
65 public:
66 //! Constructs an Actions object
67 Actions();
68 //! Destroys the Actions object
69 virtual ~Actions();
70
71 virtual void buttonPressHandler(const XButtonEvent &e);
72 virtual void buttonReleaseHandler(const XButtonEvent &e);
73
74 virtual void enterHandler(const XCrossingEvent &e);
75 virtual void leaveHandler(const XCrossingEvent &e);
76
77 virtual void keyPressHandler(const XKeyEvent &e);
78 virtual void keyReleaseHandler(const XKeyEvent &e);
79
80 virtual void motionHandler(const XMotionEvent &e);
81
82 #ifdef XKB
83 virtual void xkbHandler(const XkbEvent &e);
84 #endif // XKB
85
86 };
87
88 }
89
90 #endif // __actions_hh
This page took 0.036297 seconds and 4 git commands to generate.