aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-06-08 14:32:28 (GMT)
committerrathnor <rathnor>2003-06-08 14:32:28 (GMT)
commit81e4fe8d44a3f0bd8c104127d7785badab6f2bc8 (patch)
tree9258d23bdc8e8c9197075b3635e69bfde7565d15 /src
parent93b2f8921c70e2cf5f2f2c3cf79943de54b6709b (diff)
downloadfluxbox_paul-81e4fe8d44a3f0bd8c104127d7785badab6f2bc8.zip
fluxbox_paul-81e4fe8d44a3f0bd8c104127d7785badab6f2bc8.tar.bz2
add reconfigure and restart keys
Diffstat (limited to 'src')
-rw-r--r--src/Keys.cc21
-rw-r--r--src/Keys.hh6
-rw-r--r--src/fluxbox.cc9
3 files changed, 26 insertions, 10 deletions
diff --git a/src/Keys.cc b/src/Keys.cc
index a9879b5..48db064 100644
--- a/src/Keys.cc
+++ b/src/Keys.cc
@@ -19,7 +19,7 @@
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 21
22//$Id: Keys.cc,v 1.27 2003/04/26 18:27:56 fluxgen Exp $ 22//$Id: Keys.cc,v 1.28 2003/06/08 14:32:28 rathnor Exp $
23 23
24 24
25#include "Keys.hh" 25#include "Keys.hh"
@@ -135,6 +135,8 @@ Keys::t_actionstr Keys::m_actionlist[] = {
135 {"ToggleDecor", TOGGLEDECOR}, 135 {"ToggleDecor", TOGGLEDECOR},
136 {"ToggleTab", TOGGLETAB}, 136 {"ToggleTab", TOGGLETAB},
137 {"RootMenu", ROOTMENU}, 137 {"RootMenu", ROOTMENU},
138 {"Reconfigure", RECONFIGURE},
139 {"Restart", RESTART},
138 {"Quit", QUIT}, 140 {"Quit", QUIT},
139 {0, LASTKEYGRAB} 141 {0, LASTKEYGRAB}
140}; 142};
@@ -294,12 +296,14 @@ bool Keys::load(const char *filename) {
294 296
295 last_key->action = m_actionlist[i].action; 297 last_key->action = m_actionlist[i].action;
296 switch(last_key->action) { 298 switch(last_key->action) {
299 case Keys::RESTART:
297 case Keys::EXECUTE: 300 case Keys::EXECUTE:
298 last_key->execcommand = 301 last_key->execcommand =
299 const_cast<char *> 302 const_cast<char *>
300 (FbTk::StringUtil::strcasestr(linebuffer.c_str(), 303 (FbTk::StringUtil::strcasestr(
301 getActionStr(Keys::EXECUTE))+ 304 linebuffer.c_str(),
302 strlen(getActionStr(Keys::EXECUTE))); 305 getActionStr(last_key->action))
306 + strlen(getActionStr(last_key->action)) + 1);
303 break; 307 break;
304 case WORKSPACE: 308 case WORKSPACE:
305 case SENDTOWORKSPACE: 309 case SENDTOWORKSPACE:
@@ -481,7 +485,8 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
481 next_key = m_keylist[i]; 485 next_key = m_keylist[i];
482 break; //end for-loop 486 break; //end for-loop
483 } else { 487 } else {
484 if (m_keylist[i]->action == Keys::EXECUTE) 488 if (m_keylist[i]->action == Keys::EXECUTE ||
489 m_keylist[i]->action == Keys::RESTART)
485 m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute 490 m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute
486 m_param = m_keylist[i]->param; 491 m_param = m_keylist[i]->param;
487 return m_keylist[i]->action; 492 return m_keylist[i]->action;
@@ -496,14 +501,16 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
496 next_key = temp_key; 501 next_key = temp_key;
497 } else { 502 } else {
498 next_key = 0; 503 next_key = 0;
499 if (temp_key->action == Keys::EXECUTE) 504 if (temp_key->action == Keys::EXECUTE ||
505 temp_key->action == Keys::RESTART)
500 m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute 506 m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute
501 return temp_key->action; 507 return temp_key->action;
502 } 508 }
503 } else { 509 } else {
504 temp_key = next_key; 510 temp_key = next_key;
505 next_key = 0; 511 next_key = 0;
506 if (temp_key->action == Keys::EXECUTE) 512 if (temp_key->action == Keys::EXECUTE ||
513 temp_key->action == Keys::RESTART)
507 m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute 514 m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute
508 return temp_key->action; 515 return temp_key->action;
509 } 516 }
diff --git a/src/Keys.hh b/src/Keys.hh
index d0eb344..b78f7e7 100644
--- a/src/Keys.hh
+++ b/src/Keys.hh
@@ -19,7 +19,7 @@
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 21
22// $Id: Keys.hh,v 1.23 2003/04/20 12:21:35 rathnor Exp $ 22// $Id: Keys.hh,v 1.24 2003/06/08 14:32:28 rathnor Exp $
23 23
24#ifndef KEYS_HH 24#ifndef KEYS_HH
25#define KEYS_HH 25#define KEYS_HH
@@ -64,6 +64,8 @@ public:
64 TOGGLEDECOR,// toggle visibility of decor (title, frame, handles) 64 TOGGLEDECOR,// toggle visibility of decor (title, frame, handles)
65 TOGGLETAB, // toggle visibilty of tab 65 TOGGLETAB, // toggle visibilty of tab
66 ROOTMENU, // pop up rootmenu 66 ROOTMENU, // pop up rootmenu
67 RECONFIGURE, // reload configuration
68 RESTART, // restart fluxbox
67 QUIT, // Die, quit, logout, shutdown 69 QUIT, // Die, quit, logout, shutdown
68 LASTKEYGRAB //mark end of keygrabbs 70 LASTKEYGRAB //mark end of keygrabbs
69 }; 71 };
@@ -108,7 +110,7 @@ public:
108 */ 110 */
109 const char *getActionStr(KeyAction action); 111 const char *getActionStr(KeyAction action);
110 /** 112 /**
111 Get command to execute (key action EXECUTE) 113 Get command to execute (key action EXECUTE/RESTART)
112 @return string to command 114 @return string to command
113 */ 115 */
114 const std::string &getExecCommand() { return m_execcmdstring; } 116 const std::string &getExecCommand() { return m_execcmdstring; }
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 9f5f1cc..7c834a6 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.152 2003/06/08 00:13:41 rathnor Exp $ 25// $Id: fluxbox.cc,v 1.153 2003/06/08 14:32:28 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -1301,6 +1301,13 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
1301 FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->screenNumber()); 1301 FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->screenNumber());
1302 cmd.execute(); 1302 cmd.execute();
1303 } break; 1303 } break;
1304 case Keys::RECONFIGURE:
1305 reload_rc();
1306 break;
1307 case Keys::RESTART: {
1308 FbCommands::RestartFluxboxCmd cmd(m_key->getExecCommand());
1309 cmd.execute();
1310 } break;
1304 case Keys::QUIT: 1311 case Keys::QUIT:
1305 shutdown(); 1312 shutdown();
1306 break; 1313 break;