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