1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 // actions.hh for Epistrophy - a key handler for NETWM/EWMH window managers.
3 // Copyright (c) 2002 - 2002 Ben Jansens <ben at orodu.net>
4 //
5 // Adapted slightly for inclusion in bbkeys by Jason 'vanRijn' Kasper
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a
8 // copy of this software and associated documentation files (the "Software"),
9 // to deal in the Software without restriction, including without limitation
10 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 // and/or sell copies of the Software, and to permit persons to whom the
12 // Software is furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in
15 // all copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 // DEALINGS IN THE SOFTWARE.
24 
25 #ifndef __actions_hh
26 #define __actions_hh
27 
28 extern "C" {
29 #include <X11/Xlib.h>
30 #include <X11/keysym.h>
31 }
32 
33 #include <list>
34 #include <string>
35 
36 #include "Display.hh"
37 
38 #include "version.h"
39 
40 class Action {
41 public:
42 
43   enum ActionType {
44     START = 0,
45     noaction,
46     execute,
47     iconify,
48     raise,
49     lower,
50     close,
51     toggleShade,
52     toggleOmnipresent,
53     moveWindowUp,
54     moveWindowDown,
55     moveWindowLeft,
56     moveWindowRight,
57     resizeWindowWidth,
58     resizeWindowHeight,
59 
60     toggleMaximizeFull,
61     toggleMaximizeVertical,
62     toggleMaximizeHorizontal,
63 
64     sendToWorkspace,
65     sendToNextWorkspace,
66     sendToPrevWorkspace,
67 
68     nextWindow,
69     prevWindow,
70     nextWindowOnAllWorkspaces,
71     prevWindowOnAllWorkspaces,
72 
73     nextWindowOnAllScreens,
74     prevWindowOnAllScreens,
75 
76     nextWindowOfClass,
77     prevWindowOfClass,
78     nextWindowOfClassOnAllWorkspaces,
79     prevWindowOfClassOnAllWorkspaces,
80 
81     upWindow,
82     downWindow,
83     leftWindow,
84     rightWindow,
85 
86     changeWorkspace,
87     nextWorkspace,
88     prevWorkspace,
89 
90     upWorkspace,
91     downWorkspace,
92     leftWorkspace,
93     rightWorkspace,
94 
95     nextScreen,
96     prevScreen,
97 
98     // these are openbox extensions
99     showRootMenu,
100     showWorkspaceMenu,
101 
102     toggleDecorations,
103     toggleGrabs,
104     stringChain,
105     keyChain,
106     numberChain,
107 
108     cancelChain,
109 
110     chain,
111 
112     NUM_ACTIONS,
113     END
114   };
115 
116 private:
117   enum ActionType _type;
118   const KeyCode _keycode;
119   const unsigned int _modifierMask;
120 
121   int _numberParam;
122   std::string _stringParam;
123   Display * _display;
124 
125 public:
type() const126   inline enum ActionType type() const { return _type;}
127   const char * getActionName();
128   const char * getKeyString();
keycode() const129   inline KeyCode keycode() const { return _keycode; }
modifierMask() const130   inline unsigned int modifierMask() const { return _modifierMask; }
number() const131   inline int number() const { return _numberParam; }
string() const132   inline const std::string &string() const { return _stringParam; }
133   const std::string toString();
134 
135   Action(enum ActionType type, Display * _display, KeyCode keycode, unsigned int modifierMask,
136          const std::string &str = "");
137 };
138 
139 typedef std::list<Action> ActionList;
140 
141 #endif
142