diff options
Diffstat (limited to 'src/Keys.hh')
-rw-r--r-- | src/Keys.hh | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/src/Keys.hh b/src/Keys.hh index 3b19aaa..9d1f090 100644 --- a/src/Keys.hh +++ b/src/Keys.hh | |||
@@ -1,4 +1,4 @@ | |||
1 | // Key2.hh for Fluxbox - an X11 Window manager | 1 | // Keys.hh for Fluxbox - an X11 Window manager |
2 | // Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) | 2 | // Copyright (c) 2001 Henrik Kinnunen (fluxgen@linuxmail.org) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
@@ -18,55 +18,60 @@ | |||
18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | |||
22 | // $Id: Keys.hh,v 1.4 2002/01/09 14:11:20 fluxgen Exp $ | ||
23 | |||
21 | #ifndef _KEYS_HH_ | 24 | #ifndef _KEYS_HH_ |
22 | #define _KEYS_HH_ | 25 | #define _KEYS_HH_ |
23 | 26 | ||
24 | #include <string> | 27 | #include <string> |
25 | #include <vector> | 28 | #include <vector> |
26 | 29 | #include <X11/Xlib.h> | |
30 | |||
27 | class Keys | 31 | class Keys |
28 | { | 32 | { |
29 | public: | 33 | public: |
30 | enum KeyAction{ | 34 | enum KeyAction{ |
31 | grabIconify=0, | 35 | ICONIFY=0, |
32 | grabRaise, | 36 | RAISE, |
33 | grabLower, | 37 | LOWER, |
34 | grabClose, | 38 | CLOSE, |
35 | grabAbortKeychain, | 39 | ABORTKEYCHAIN, |
36 | grabWorkspace1, grabWorkspace2, grabWorkspace3, grabWorkspace4, grabWorkspace5, | 40 | WORKSPACE1, WORKSPACE2, WORKSPACE3, WORKSPACE4, WORKSPACE5, |
37 | grabWorkspace6, grabWorkspace7, grabWorkspace8, grabWorkspace9, grabWorkspace10, | 41 | WORKSPACE6, WORKSPACE7, WORKSPACE8, WORKSPACE9, WORKSPACE10, |
38 | grabWorkspace11, grabWorkspace12, grabNextWorkspace, grabPrevWorkspace, | 42 | WORKSPACE11, WORKSPACE12, NEXTWORKSPACE, PREVWORKSPACE, |
39 | grabLeftWorkspace, grabRightWorkspace, | 43 | LEFTWORKSPACE, RIGHTWORKSPACE, |
40 | grabKillWindow, grabNextWindow, grabPrevWindow, | 44 | KILLWINDOW, NEXTWINDOW, PREVWINDOW, |
41 | grabNextTab, grabPrevTab, | 45 | NEXTTAB, PREVTAB, |
42 | grabShade, grabMaximize, grabStick, grabExecute, grabVertMax, | 46 | SHADE, MAXIMIZE, STICK, EXECUTE, VERTMAX, |
43 | grabHorizMax, grabNudgeRight, grabNudgeLeft,grabNudgeUp, | 47 | HORIZMAX, NUDGERIGHT, NUDGELEFT,NUDGEUP, |
44 | grabNudgeDown, grabBigNudgeRight, grabBigNudgeLeft, | 48 | NUDGEDOWN, BIGNUDGERIGHT, BIGNUDGELEFT, |
45 | grabBigNudgeUp, grabBigNudgeDown, | 49 | BIGNUDGEUP, BIGNUDGEDOWN, |
46 | grabHorizInc, grabVertInc, grabHorizDec, grabVertDec, | 50 | HORIZINC, VERTINC, HORIZDEC, VERTDEC, |
47 | grabToggleDecor, | 51 | TOGGLEDECOR, |
48 | lastKeygrab | 52 | LASTKEYGRAB |
49 | }; | 53 | }; |
50 | 54 | ||
51 | Keys(char *filename); | 55 | Keys(Display *display, char *filename=0); |
52 | ~Keys(); | 56 | ~Keys(); |
53 | bool load(char *filename=0); | 57 | bool load(char *filename=0); |
54 | KeyAction getAction(XKeyEvent *ke); | 58 | KeyAction getAction(XKeyEvent *ke); |
55 | bool reconfigure(char *filename); | 59 | bool reconfigure(char *filename); |
56 | const char *getActionStr(KeyAction action); | 60 | const char *getActionStr(KeyAction action); |
57 | std::string getExecCommand() { return m_execcmdstring; } | 61 | std::string getExecCommand() { return m_execcmdstring; } |
62 | |||
58 | private: | 63 | private: |
59 | void deleteTree(); | 64 | void deleteTree(); |
60 | 65 | void ungrabKeys(); | |
61 | void bindKey(unsigned int key, unsigned int mod); | 66 | void bindKey(unsigned int key, unsigned int mod); |
62 | unsigned int getModifier(char *modstr); | 67 | unsigned int getModifier(const char *modstr); |
63 | unsigned int getKey(char *keystr); | 68 | unsigned int getKey(const char *keystr); |
64 | void grabKey(unsigned int key, unsigned int mod); | 69 | void grabKey(unsigned int key, unsigned int mod); |
65 | std::string filename; | 70 | std::string filename; |
66 | 71 | ||
67 | class t_key { | 72 | class t_key { |
68 | public: | 73 | public: |
69 | t_key(unsigned int key, unsigned int mod, KeyAction action_ = lastKeygrab); | 74 | t_key(unsigned int key, unsigned int mod, KeyAction action_ = Keys::LASTKEYGRAB); |
70 | t_key(t_key *k); | 75 | t_key(t_key *k); |
71 | ~t_key(); | 76 | ~t_key(); |
72 | 77 | ||
@@ -111,6 +116,7 @@ private: | |||
111 | std::vector<t_key *> m_keylist; | 116 | std::vector<t_key *> m_keylist; |
112 | t_key *m_abortkey; //abortkey for keygrabbing chain | 117 | t_key *m_abortkey; //abortkey for keygrabbing chain |
113 | std::string m_execcmdstring; //copy of the execcommandstring | 118 | std::string m_execcmdstring; //copy of the execcommandstring |
119 | Display *m_display; | ||
114 | }; | 120 | }; |
115 | 121 | ||
116 | #endif // _KEYS_HH_ | 122 | #endif // _KEYS_HH_ |