aboutsummaryrefslogtreecommitdiff
path: root/src/Keys.hh
diff options
context:
space:
mode:
authormarkt <markt>2007-10-13 21:51:37 (GMT)
committermarkt <markt>2007-10-13 21:51:37 (GMT)
commita59428d67a95a9df16554962f0a6257d6378328a (patch)
treef856ed9300c34f7a17d499f22d895610cfbc08e5 /src/Keys.hh
parent41b5c6dadb1f474675660cef18b812d4c2338ed2 (diff)
downloadfluxbox_pavel-a59428d67a95a9df16554962f0a6257d6378328a.zip
fluxbox_pavel-a59428d67a95a9df16554962f0a6257d6378328a.tar.bz2
merged changes from pre-devel
Diffstat (limited to 'src/Keys.hh')
-rw-r--r--src/Keys.hh32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/Keys.hh b/src/Keys.hh
index a83a0ec..2fca460 100644
--- a/src/Keys.hh
+++ b/src/Keys.hh
@@ -25,7 +25,6 @@
25#define KEYS_HH 25#define KEYS_HH
26 26
27#include <string> 27#include <string>
28#include <vector>
29#include <list> 28#include <list>
30#include <map> 29#include <map>
31#include <X11/Xlib.h> 30#include <X11/Xlib.h>
@@ -53,11 +52,7 @@ public:
53 // and so on... 52 // and so on...
54 }; 53 };
55 54
56 /** 55 /// constructor
57 Constructor
58 @param display display connection
59 @param filename file to load, default none
60 */
61 explicit Keys(); 56 explicit Keys();
62 /// destructor 57 /// destructor
63 ~Keys(); 58 ~Keys();
@@ -80,7 +75,12 @@ public:
80 /** 75 /**
81 do action from XKeyEvent; return false if not bound to anything 76 do action from XKeyEvent; return false if not bound to anything
82 */ 77 */
83 bool doAction(int type, unsigned int mods, unsigned int key); 78 bool doAction(int type, unsigned int mods, unsigned int key, int context);
79
80 /// register a window so that proper keys/buttons get grabbed on it
81 void registerWindow(Window win, int context);
82 /// unregister window
83 void unregisterWindow(Window win);
84 84
85 /** 85 /**
86 Reload configuration from filename 86 Reload configuration from filename
@@ -94,8 +94,9 @@ private:
94 94
95 void grabKey(unsigned int key, unsigned int mod); 95 void grabKey(unsigned int key, unsigned int mod);
96 void ungrabKeys(); 96 void ungrabKeys();
97 void grabButton(unsigned int button, unsigned int mod); 97 void grabButton(unsigned int button, unsigned int mod, int context);
98 void ungrabButtons(); 98 void ungrabButtons();
99 void grabWindow(Window win);
99 100
100 // Load default keybindings for when there are errors loading the initial one 101 // Load default keybindings for when there are errors loading the initial one
101 void loadDefaults(); 102 void loadDefaults();
@@ -103,7 +104,7 @@ private:
103 std::string m_filename; 104 std::string m_filename;
104 105
105 class t_key; 106 class t_key;
106 typedef std::vector<t_key*> keylist_t; 107 typedef std::list<t_key*> keylist_t;
107 108
108 class t_key { 109 class t_key {
109 public: 110 public:
@@ -116,11 +117,12 @@ private:
116 int context_) { 117 int context_) {
117 // t_key ctor sets context_ of 0 to GLOBAL, so we must here too 118 // t_key ctor sets context_ of 0 to GLOBAL, so we must here too
118 context_ = context_ ? context_ : GLOBAL; 119 context_ = context_ ? context_ : GLOBAL;
119 for (size_t i = 0; i < keylist.size(); i++) { 120 keylist_t::iterator it = keylist.begin(), it_end = keylist.end();
120 if (keylist[i]->type == type_ && keylist[i]->key == key_ && 121 for (; it != it_end; it++) {
121 (keylist[i]->context & context_) > 0 && keylist[i]->mod == 122 if ((*it)->type == type_ && (*it)->key == key_ &&
123 ((*it)->context & context_) > 0 && (*it)->mod ==
122 FbTk::KeyUtil::instance().isolateModifierMask(mod_)) 124 FbTk::KeyUtil::instance().isolateModifierMask(mod_))
123 return keylist[i]; 125 return *it;
124 } 126 }
125 return 0; 127 return 0;
126 } 128 }
@@ -141,7 +143,9 @@ private:
141 keyspace_t m_map; 143 keyspace_t m_map;
142 144
143 Display *m_display; ///< display connection 145 Display *m_display; ///< display connection
144 std::list<Window> m_window_list; 146
147 typedef std::map<Window, int> WindowMap;
148 WindowMap m_window_map;
145}; 149};
146 150
147#endif // KEYS_HH 151#endif // KEYS_HH