diff options
author | mathias <mathias> | 2006-06-22 07:46:12 (GMT) |
---|---|---|
committer | mathias <mathias> | 2006-06-22 07:46:12 (GMT) |
commit | dedbd7e46816ebce6628d9357cc7feee7a61ab57 (patch) | |
tree | ff8e90f26edffb6d579857e9f68d86c378a7320c /src/FbCommands.cc | |
parent | 535a88ce907641ef5648787bfa5d507d2581b86f (diff) | |
download | fluxbox-dedbd7e46816ebce6628d9357cc7feee7a61ab57.zip fluxbox-dedbd7e46816ebce6628d9357cc7feee7a61ab57.tar.bz2 |
Added patch from Jim Ramsay (i dot am at jimramsay dot com) to freely
define the used modkey.
Added new action SetModKey too
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r-- | src/FbCommands.cc | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index fc2426d..08f1f93 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -71,7 +71,7 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) { | |||
71 | return; | 71 | return; |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | Window root_ret; // not used | 75 | Window root_ret; // not used |
76 | Window window_ret; // not used | 76 | Window window_ret; // not used |
77 | 77 | ||
@@ -86,9 +86,9 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) { | |||
86 | int borderw = menu.fbwindow().borderWidth(); | 86 | int borderw = menu.fbwindow().borderWidth(); |
87 | int head = screen.getHead(rx, ry); | 87 | int head = screen.getHead(rx, ry); |
88 | 88 | ||
89 | pair<int, int> m = | 89 | pair<int, int> m = |
90 | screen.clampToHead(head, | 90 | screen.clampToHead(head, |
91 | rx - menu.width() / 2, | 91 | rx - menu.width() / 2, |
92 | ry - menu.titleWindow().height() / 2, | 92 | ry - menu.titleWindow().height() / 2, |
93 | menu.width() + 2*borderw, | 93 | menu.width() + 2*borderw, |
94 | menu.height() + 2*borderw); | 94 | menu.height() + 2*borderw); |
@@ -98,7 +98,7 @@ void showMenu(const BScreen &screen, FbTk::Menu &menu) { | |||
98 | screen.getHeadY(head), | 98 | screen.getHeadY(head), |
99 | screen.getHeadWidth(head), | 99 | screen.getHeadWidth(head), |
100 | screen.getHeadHeight(head)); | 100 | screen.getHeadHeight(head)); |
101 | 101 | ||
102 | menu.show(); | 102 | menu.show(); |
103 | menu.grabInputFocus(); | 103 | menu.grabInputFocus(); |
104 | } | 104 | } |
@@ -122,7 +122,7 @@ void ExecuteCmd::execute() { | |||
122 | 122 | ||
123 | int ExecuteCmd::run() { | 123 | int ExecuteCmd::run() { |
124 | pid_t pid = fork(); | 124 | pid_t pid = fork(); |
125 | if (pid) | 125 | if (pid) |
126 | return pid; | 126 | return pid; |
127 | 127 | ||
128 | std::string displaystring("DISPLAY="); | 128 | std::string displaystring("DISPLAY="); |
@@ -149,8 +149,17 @@ int ExecuteCmd::run() { | |||
149 | return pid; // compiler happy -> we are happy ;) | 149 | return pid; // compiler happy -> we are happy ;) |
150 | } | 150 | } |
151 | 151 | ||
152 | SetModKeyCmd::SetModKeyCmd(const std::string& modkey) : m_modkey(modkey) { } | ||
153 | |||
154 | void SetModKeyCmd::execute() { | ||
155 | Fluxbox::instance()->setModKey(m_modkey.c_str()); | ||
156 | Fluxbox::instance()->save_rc(); | ||
157 | // TODO: we need a better way to do this ... | ||
158 | Fluxbox::instance()->reconfigure(); | ||
159 | } | ||
160 | |||
152 | ExportCmd::ExportCmd(const std::string& name, const std::string& value) : | 161 | ExportCmd::ExportCmd(const std::string& name, const std::string& value) : |
153 | m_name(name), m_value(value) { | 162 | m_name(name), m_value(value) { |
154 | } | 163 | } |
155 | 164 | ||
156 | void ExportCmd::execute() { | 165 | void ExportCmd::execute() { |
@@ -161,9 +170,9 @@ void ExportCmd::execute() { | |||
161 | static std::set<char*> stored; | 170 | static std::set<char*> stored; |
162 | char* newenv = new char[m_name.size() + m_value.size() + 2]; | 171 | char* newenv = new char[m_name.size() + m_value.size() + 2]; |
163 | if (newenv) { | 172 | if (newenv) { |
164 | 173 | ||
165 | char* oldenv = getenv(m_name.c_str()); | 174 | char* oldenv = getenv(m_name.c_str()); |
166 | 175 | ||
167 | // oldenv points to the value .. we have to go back a bit | 176 | // oldenv points to the value .. we have to go back a bit |
168 | if (oldenv && stored.find(oldenv - (m_name.size() + 1)) != stored.end()) | 177 | if (oldenv && stored.find(oldenv - (m_name.size() + 1)) != stored.end()) |
169 | oldenv -= (m_name.size() + 1); | 178 | oldenv -= (m_name.size() + 1); |
@@ -221,7 +230,7 @@ SetStyleCmd::SetStyleCmd(const std::string &filename):m_filename(filename) { | |||
221 | void SetStyleCmd::execute() { | 230 | void SetStyleCmd::execute() { |
222 | Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); | 231 | Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); |
223 | Fluxbox::instance()->save_rc(); | 232 | Fluxbox::instance()->save_rc(); |
224 | FbTk::ThemeManager::instance().load(m_filename, | 233 | FbTk::ThemeManager::instance().load(m_filename, |
225 | Fluxbox::instance()->getStyleOverlayFilename()); | 234 | Fluxbox::instance()->getStyleOverlayFilename()); |
226 | } | 235 | } |
227 | 236 | ||
@@ -302,8 +311,8 @@ void CommandDialogCmd::execute() { | |||
302 | win->show(); | 311 | win->show(); |
303 | } | 312 | } |
304 | 313 | ||
305 | 314 | ||
306 | SetResourceValueCmd::SetResourceValueCmd(const std::string &resname, | 315 | SetResourceValueCmd::SetResourceValueCmd(const std::string &resname, |
307 | const std::string &value): | 316 | const std::string &value): |
308 | m_resname(resname), | 317 | m_resname(resname), |
309 | m_value(value) { | 318 | m_value(value) { |
@@ -334,13 +343,13 @@ void BindKeyCmd::execute() { | |||
334 | if (Fluxbox::instance()->keys()->addBinding(m_keybind)) { | 343 | if (Fluxbox::instance()->keys()->addBinding(m_keybind)) { |
335 | ofstream ofile(Fluxbox::instance()->keys()->filename().c_str(), ios::app); | 344 | ofstream ofile(Fluxbox::instance()->keys()->filename().c_str(), ios::app); |
336 | if (!ofile) | 345 | if (!ofile) |
337 | return; | 346 | return; |
338 | ofile<<m_keybind<<endl; | 347 | ofile<<m_keybind<<endl; |
339 | } | 348 | } |
340 | } | 349 | } |
341 | } | 350 | } |
342 | 351 | ||
343 | DeiconifyCmd::DeiconifyCmd(Mode mode, | 352 | DeiconifyCmd::DeiconifyCmd(Mode mode, |
344 | Destination dest) : m_mode(mode), m_dest(dest) { } | 353 | Destination dest) : m_mode(mode), m_dest(dest) { } |
345 | 354 | ||
346 | void DeiconifyCmd::execute() { | 355 | void DeiconifyCmd::execute() { |
@@ -356,12 +365,12 @@ void DeiconifyCmd::execute() { | |||
356 | const bool change_ws= m_dest == ORIGIN; | 365 | const bool change_ws= m_dest == ORIGIN; |
357 | 366 | ||
358 | switch(m_mode) { | 367 | switch(m_mode) { |
359 | 368 | ||
360 | case ALL: | 369 | case ALL: |
361 | case ALLWORKSPACE: | 370 | case ALLWORKSPACE: |
362 | for(; it != itend; it++) { | 371 | for(; it != itend; it++) { |
363 | old_workspace_num= (*it)->workspaceNumber(); | 372 | old_workspace_num= (*it)->workspaceNumber(); |
364 | if (m_mode == ALL || old_workspace_num == workspace_num || | 373 | if (m_mode == ALL || old_workspace_num == workspace_num || |
365 | (*it)->isStuck()) { | 374 | (*it)->isStuck()) { |
366 | if (m_dest == ORIGIN || m_dest == ORIGINQUIET) | 375 | if (m_dest == ORIGIN || m_dest == ORIGINQUIET) |
367 | screen->sendToWorkspace(old_workspace_num, (*it), change_ws); | 376 | screen->sendToWorkspace(old_workspace_num, (*it), change_ws); |
@@ -378,7 +387,7 @@ void DeiconifyCmd::execute() { | |||
378 | old_workspace_num= (*it)->workspaceNumber(); | 387 | old_workspace_num= (*it)->workspaceNumber(); |
379 | if(m_mode == LAST || old_workspace_num == workspace_num || | 388 | if(m_mode == LAST || old_workspace_num == workspace_num || |
380 | (*it)->isStuck()) { | 389 | (*it)->isStuck()) { |
381 | if ((m_dest == ORIGIN || m_dest == ORIGINQUIET) && | 390 | if ((m_dest == ORIGIN || m_dest == ORIGINQUIET) && |
382 | m_mode != LASTWORKSPACE) | 391 | m_mode != LASTWORKSPACE) |
383 | screen->sendToWorkspace(old_workspace_num, (*it), change_ws); | 392 | screen->sendToWorkspace(old_workspace_num, (*it), change_ws); |
384 | else | 393 | else |
@@ -389,5 +398,5 @@ void DeiconifyCmd::execute() { | |||
389 | break; | 398 | break; |
390 | }; | 399 | }; |
391 | } | 400 | } |
392 | 401 | ||
393 | }; // end namespace FbCommands | 402 | }; // end namespace FbCommands |