add reconfigure and restart keys

This commit is contained in:
rathnor 2003-06-08 14:32:28 +00:00
parent 93b2f8921c
commit 81e4fe8d44
4 changed files with 29 additions and 10 deletions

View file

@ -1,6 +1,9 @@
(Format: Year/Month/Day)
Changes for 0.9.3:
*03/06/08:
* Add Reconfigure and Restart Key actions, thanks Jann Fisher (Simon)
Also modify the patch to take argument on Restart action
Keys.hh/cc fluxbox.cc
* Fix restart command to accept and use an argument again (Simon)
Screen.cc FbCommands.hh/cc
* Fix bug that sometimes left window frames after window closed (Simon)

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//$Id: Keys.cc,v 1.27 2003/04/26 18:27:56 fluxgen Exp $
//$Id: Keys.cc,v 1.28 2003/06/08 14:32:28 rathnor Exp $
#include "Keys.hh"
@ -135,6 +135,8 @@ Keys::t_actionstr Keys::m_actionlist[] = {
{"ToggleDecor", TOGGLEDECOR},
{"ToggleTab", TOGGLETAB},
{"RootMenu", ROOTMENU},
{"Reconfigure", RECONFIGURE},
{"Restart", RESTART},
{"Quit", QUIT},
{0, LASTKEYGRAB}
};
@ -294,12 +296,14 @@ bool Keys::load(const char *filename) {
last_key->action = m_actionlist[i].action;
switch(last_key->action) {
case Keys::RESTART:
case Keys::EXECUTE:
last_key->execcommand =
const_cast<char *>
(FbTk::StringUtil::strcasestr(linebuffer.c_str(),
getActionStr(Keys::EXECUTE))+
strlen(getActionStr(Keys::EXECUTE)));
(FbTk::StringUtil::strcasestr(
linebuffer.c_str(),
getActionStr(last_key->action))
+ strlen(getActionStr(last_key->action)) + 1);
break;
case WORKSPACE:
case SENDTOWORKSPACE:
@ -481,7 +485,8 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
next_key = m_keylist[i];
break; //end for-loop
} else {
if (m_keylist[i]->action == Keys::EXECUTE)
if (m_keylist[i]->action == Keys::EXECUTE ||
m_keylist[i]->action == Keys::RESTART)
m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute
m_param = m_keylist[i]->param;
return m_keylist[i]->action;
@ -496,14 +501,16 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) {
next_key = temp_key;
} else {
next_key = 0;
if (temp_key->action == Keys::EXECUTE)
if (temp_key->action == Keys::EXECUTE ||
temp_key->action == Keys::RESTART)
m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute
return temp_key->action;
}
} else {
temp_key = next_key;
next_key = 0;
if (temp_key->action == Keys::EXECUTE)
if (temp_key->action == Keys::EXECUTE ||
temp_key->action == Keys::RESTART)
m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute
return temp_key->action;
}

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: Keys.hh,v 1.23 2003/04/20 12:21:35 rathnor Exp $
// $Id: Keys.hh,v 1.24 2003/06/08 14:32:28 rathnor Exp $
#ifndef KEYS_HH
#define KEYS_HH
@ -64,6 +64,8 @@ public:
TOGGLEDECOR,// toggle visibility of decor (title, frame, handles)
TOGGLETAB, // toggle visibilty of tab
ROOTMENU, // pop up rootmenu
RECONFIGURE, // reload configuration
RESTART, // restart fluxbox
QUIT, // Die, quit, logout, shutdown
LASTKEYGRAB //mark end of keygrabbs
};
@ -108,7 +110,7 @@ public:
*/
const char *getActionStr(KeyAction action);
/**
Get command to execute (key action EXECUTE)
Get command to execute (key action EXECUTE/RESTART)
@return string to command
*/
const std::string &getExecCommand() { return m_execcmdstring; }

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.152 2003/06/08 00:13:41 rathnor Exp $
// $Id: fluxbox.cc,v 1.153 2003/06/08 14:32:28 rathnor Exp $
#include "fluxbox.hh"
@ -1301,6 +1301,13 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->screenNumber());
cmd.execute();
} break;
case Keys::RECONFIGURE:
reload_rc();
break;
case Keys::RESTART: {
FbCommands::RestartFluxboxCmd cmd(m_key->getExecCommand());
cmd.execute();
} break;
case Keys::QUIT:
shutdown();
break;