fixed execute on right screen

This commit is contained in:
fluxgen 2003-04-28 00:38:42 +00:00
parent 45fff3a4b2
commit 92f49bd874
5 changed files with 51 additions and 33 deletions

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: FbCommands.cc,v 1.3 2003/04/15 12:13:22 fluxgen Exp $
// $Id: FbCommands.cc,v 1.4 2003/04/28 00:34:59 fluxgen Exp $
#include "FbCommands.hh"
#include "fluxbox.hh"
@ -33,13 +33,20 @@ using namespace std;
namespace FbCommands {
ExecuteCmd::ExecuteCmd(const std::string &cmd):m_cmd(cmd) {
ExecuteCmd::ExecuteCmd(const std::string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) {
}
void ExecuteCmd::execute() {
#ifndef __EMX__
if (! fork()) {
std::string displaystring("DISPLAY=");
displaystring += DisplayString(FbTk::App::instance()->display());
char intbuff[64];
sprintf(intbuff, "%d", m_screen_num);
// remove last number of display and add screen num
displaystring.erase(displaystring.size()-1);
displaystring += intbuff;
setsid();
execl("/bin/sh", "/bin/sh", "-c", m_cmd.c_str(), 0);
exit(0);

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: FbCommands.hh,v 1.3 2003/04/16 13:33:18 fluxgen Exp $
// $Id: FbCommands.hh,v 1.4 2003/04/28 00:34:06 fluxgen Exp $
// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
@ -35,10 +35,11 @@ namespace FbCommands {
/// executes a system command
class ExecuteCmd: public FbTk::Command {
public:
explicit ExecuteCmd(const std::string &cmd);
ExecuteCmd(const std::string &cmd, int screen_num);
void execute();
private:
std::string m_cmd;
const int m_screen_num;
};
/// exit fluxbox

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: RootTheme.cc,v 1.1 2003/04/25 10:14:54 fluxgen Exp $
// $Id: RootTheme.cc,v 1.2 2003/04/28 00:38:42 fluxgen Exp $
#include "RootTheme.hh"
@ -54,10 +54,10 @@ void RootTheme::reconfigTheme() {
// override resource root command?
if (m_screen_root_command == "") {
// do root command
FbCommands::ExecuteCmd cmd(*m_root_command);
FbCommands::ExecuteCmd cmd(*m_root_command, screenNum());
cmd.execute();
} else {
FbCommands::ExecuteCmd cmd(m_screen_root_command);
FbCommands::ExecuteCmd cmd(m_screen_root_command, screenNum());
cmd.execute();
}
}

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: Screen.cc,v 1.139 2003/04/27 14:36:03 rathnor Exp $
// $Id: Screen.cc,v 1.140 2003/04/28 00:36:50 fluxgen Exp $
#include "Screen.hh"
@ -41,6 +41,7 @@
#include "FbWinFrameTheme.hh"
#include "MenuTheme.hh"
#include "RootTheme.hh"
//#include "WinButtonTheme.hh"
#include "FbCommands.hh"
#include "BoolMenuItem.hh"
#include "IntResMenuItem.hh"
@ -493,7 +494,8 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
BScreen::BScreen(ResourceManager &rm,
const string &screenname, const string &altscreenname,
int scrn, int num_layers) : ScreenInfo(scrn),
int scrn, int num_layers) :
ScreenInfo(scrn),
m_clientlist_sig(*this), // client signal
m_workspacecount_sig(*this), // workspace count signal
m_workspacenames_sig(*this), // workspace names signal
@ -507,8 +509,10 @@ BScreen::BScreen(ResourceManager &rm,
m_root_theme(new
RootTheme(scrn,
*resource.rootcommand)),
// m_winbutton_theme(new WinButtonTheme(scrn)),
m_toolbarhandler(0) {
Display *disp = FbTk::App::instance()->display();
event_mask = ColormapChangeMask | EnterWindowMask | PropertyChangeMask |
@ -1328,13 +1332,15 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
//create new buttons
FbTk::Button *newbutton = 0;
if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) {
newbutton = new WinButton(win, WinButton::MINIMIZE,
newbutton = new WinButton(win, //*m_winbutton_theme.get(),
WinButton::MINIMIZE,
frame.titlebar(),
0, 0, 10, 10);
newbutton->setOnClick(iconify_cmd);
} else if (win.isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) {
newbutton = new WinButton(win, WinButton::MAXIMIZE,
newbutton = new WinButton(win, //*m_winbutton_theme.get(),
WinButton::MAXIMIZE,
frame.titlebar(),
0, 0, 10, 10);
@ -1343,7 +1349,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
newbutton->setOnClick(maximize_vert_cmd, 2);
} else if (win.isClosable() && (*dir)[i] == Fluxbox::CLOSE) {
newbutton = new WinButton(win, WinButton::CLOSE,
newbutton = new WinButton(win, //*m_winbutton_theme.get(),
WinButton::CLOSE,
frame.titlebar(),
0, 0, 10, 10);
@ -1352,14 +1359,16 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
cerr<<__FILE__<<": Creating close button"<<endl;
#endif // DEBUG
} else if ((*dir)[i] == Fluxbox::STICK) {
WinButton *winbtn = new WinButton(win, WinButton::STICK,
WinButton *winbtn = new WinButton(win, // *m_winbutton_theme.get(),
WinButton::STICK,
frame.titlebar(),
0, 0, 10, 10);
win.stateSig().attach(winbtn);
winbtn->setOnClick(stick_cmd);
newbutton = winbtn;
} else if ((*dir)[i] == Fluxbox::SHADE) {
WinButton *winbtn = new WinButton(win, WinButton::SHADE,
WinButton *winbtn = new WinButton(win, // *m_winbutton_theme.get(),
WinButton::SHADE,
frame.titlebar(),
0, 0, 10, 10);
winbtn->setOnClick(shade_cmd);
@ -1431,7 +1440,8 @@ string BScreen::getNameOfWorkspace(unsigned int workspace) const {
}
}
void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id, bool ignore_sticky) {
void BScreen::reassociateWindow(FluxboxWindow *w, unsigned int wkspc_id,
bool ignore_sticky) {
if (w == 0)
return;
@ -1816,7 +1826,7 @@ void BScreen::initMenu() {
if (defaultMenu) {
FbTk::RefCount<FbTk::Command> restart_fb(new FbCommands::RestartFluxboxCmd());
FbTk::RefCount<FbTk::Command> exit_fb(new FbCommands::ExitFluxboxCmd());
FbTk::RefCount<FbTk::Command> execute_xterm(new FbCommands::ExecuteCmd("xterm"));
FbTk::RefCount<FbTk::Command> execute_xterm(new FbCommands::ExecuteCmd("xterm", getScreenNumber()));
m_rootmenu->setInternalMenu();
m_rootmenu->insert(i18n->getMessage(
FBNLS::ScreenSet, FBNLS::Screenxterm,
@ -1888,7 +1898,7 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
"no menu label and/or command defined\n"));
cerr<<"Row: "<<row<<endl;
} else {
FbTk::RefCount<FbTk::Command> exec_cmd(new FbCommands::ExecuteCmd(str_cmd));
FbTk::RefCount<FbTk::Command> exec_cmd(new FbCommands::ExecuteCmd(str_cmd, getScreenNumber()));
FbTk::MacroCommand *exec_and_hide = new FbTk::MacroCommand();
exec_and_hide->add(hide_menu);
exec_and_hide->add(exec_cmd);

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.122 2003/04/27 04:56:18 rathnor Exp $
// $Id: fluxbox.cc,v 1.123 2003/04/28 00:37:38 fluxgen Exp $
#include "fluxbox.hh"
@ -1188,7 +1188,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
}
break;
case Keys::EXECUTE: { //execute command on keypress
FbCommands::ExecuteCmd cmd(m_key->getExecCommand());
FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), screen->getScreenNumber());
cmd.execute();
} break;
case Keys::QUIT: