]> icculus.org git repositories - dana/openbox.git/blob - src/actions.hh
add click_raise global var
[dana/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 "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   // update the same enum in openbox.i when making changes to this
27   enum ActionType {
28     Action_ButtonPress,
29     Action_ButtonRelease,
30     Action_Click,
31     Action_DoubleClick,
32     Action_EnterWindow,
33     Action_LeaveWindow,
34     Action_KeyPress,
35     Action_MouseMotion,
36     Action_NewWindow,
37     Action_CloseWindow,
38     NUM_ACTIONS
39   };
40   
41   struct ButtonReleaseAction {
42     Window win;
43     unsigned int button;
44     Time time;
45     ButtonReleaseAction() { win = 0; button = 0; time = 0; }
46   };
47
48 private:
49   // milliseconds XXX: config option
50   static const unsigned int DOUBLECLICKDELAY;
51   
52   //! The mouse button currently being watched from a press for a CLICK
53   unsigned int _button;
54   //! The last button release processed for CLICKs
55   ButtonReleaseAction _release;
56
57 public:
58   //! Constructs an OBActions object
59   OBActions();
60   //! Destroys the OBActions object
61   virtual ~OBActions();
62
63   virtual void buttonPressHandler(const XButtonEvent &e);
64   virtual void buttonReleaseHandler(const XButtonEvent &e);
65   
66   virtual void enterHandler(const XCrossingEvent &e);
67   virtual void leaveHandler(const XCrossingEvent &e);
68
69   virtual void keyPressHandler(const XKeyEvent &e);
70
71   virtual void motionHandler(const XMotionEvent &e);
72
73   virtual void mapRequestHandler(const XMapRequestEvent &e);
74   virtual void unmapHandler(const XUnmapEvent &e);
75   virtual void destroyHandler(const XDestroyWindowEvent &e);
76 };
77
78 }
79
80 #endif // __actions_hh