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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 "FbCommands.hh"
#include "fluxbox.hh" #include "fluxbox.hh"
@ -33,13 +33,20 @@ using namespace std;
namespace FbCommands { 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() { void ExecuteCmd::execute() {
#ifndef __EMX__ #ifndef __EMX__
if (! fork()) { 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(); setsid();
execl("/bin/sh", "/bin/sh", "-c", m_cmd.c_str(), 0); execl("/bin/sh", "/bin/sh", "-c", m_cmd.c_str(), 0);
exit(0); exit(0);

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
@ -35,10 +35,11 @@ namespace FbCommands {
/// executes a system command /// executes a system command
class ExecuteCmd: public FbTk::Command { class ExecuteCmd: public FbTk::Command {
public: public:
explicit ExecuteCmd(const std::string &cmd); ExecuteCmd(const std::string &cmd, int screen_num);
void execute(); void execute();
private: private:
std::string m_cmd; std::string m_cmd;
const int m_screen_num;
}; };
/// exit fluxbox /// exit fluxbox

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "RootTheme.hh"
@ -54,10 +54,10 @@ void RootTheme::reconfigTheme() {
// override resource root command? // override resource root command?
if (m_screen_root_command == "") { if (m_screen_root_command == "") {
// do root command // do root command
FbCommands::ExecuteCmd cmd(*m_root_command); FbCommands::ExecuteCmd cmd(*m_root_command, screenNum());
cmd.execute(); cmd.execute();
} else { } else {
FbCommands::ExecuteCmd cmd(m_screen_root_command); FbCommands::ExecuteCmd cmd(m_screen_root_command, screenNum());
cmd.execute(); cmd.execute();
} }
} }

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "Screen.hh"
@ -41,6 +41,7 @@
#include "FbWinFrameTheme.hh" #include "FbWinFrameTheme.hh"
#include "MenuTheme.hh" #include "MenuTheme.hh"
#include "RootTheme.hh" #include "RootTheme.hh"
//#include "WinButtonTheme.hh"
#include "FbCommands.hh" #include "FbCommands.hh"
#include "BoolMenuItem.hh" #include "BoolMenuItem.hh"
#include "IntResMenuItem.hh" #include "IntResMenuItem.hh"
@ -493,21 +494,24 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm,
BScreen::BScreen(ResourceManager &rm, BScreen::BScreen(ResourceManager &rm,
const string &screenname, const string &altscreenname, const string &screenname, const string &altscreenname,
int scrn, int num_layers) : ScreenInfo(scrn), int scrn, int num_layers) :
m_clientlist_sig(*this), // client signal ScreenInfo(scrn),
m_workspacecount_sig(*this), // workspace count signal m_clientlist_sig(*this), // client signal
m_workspacenames_sig(*this), // workspace names signal m_workspacecount_sig(*this), // workspace count signal
m_currentworkspace_sig(*this), // current workspace signal m_workspacenames_sig(*this), // workspace names signal
m_layermanager(num_layers), m_currentworkspace_sig(*this), // current workspace signal
cycling_focus(false), m_layermanager(num_layers),
cycling_last(0), cycling_focus(false),
m_windowtheme(new FbWinFrameTheme(scrn)), cycling_last(0),
m_menutheme(new FbTk::MenuTheme(scrn)), m_windowtheme(new FbWinFrameTheme(scrn)),
resource(rm, screenname, altscreenname), m_menutheme(new FbTk::MenuTheme(scrn)),
m_root_theme(new resource(rm, screenname, altscreenname),
RootTheme(scrn, m_root_theme(new
*resource.rootcommand)), RootTheme(scrn,
m_toolbarhandler(0) { *resource.rootcommand)),
// m_winbutton_theme(new WinButtonTheme(scrn)),
m_toolbarhandler(0) {
Display *disp = FbTk::App::instance()->display(); Display *disp = FbTk::App::instance()->display();
@ -1328,13 +1332,15 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
//create new buttons //create new buttons
FbTk::Button *newbutton = 0; FbTk::Button *newbutton = 0;
if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) { 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(), frame.titlebar(),
0, 0, 10, 10); 0, 0, 10, 10);
newbutton->setOnClick(iconify_cmd); newbutton->setOnClick(iconify_cmd);
} else if (win.isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) { } 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(), frame.titlebar(),
0, 0, 10, 10); 0, 0, 10, 10);
@ -1343,7 +1349,8 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
newbutton->setOnClick(maximize_vert_cmd, 2); newbutton->setOnClick(maximize_vert_cmd, 2);
} else if (win.isClosable() && (*dir)[i] == Fluxbox::CLOSE) { } 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(), frame.titlebar(),
0, 0, 10, 10); 0, 0, 10, 10);
@ -1352,14 +1359,16 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
cerr<<__FILE__<<": Creating close button"<<endl; cerr<<__FILE__<<": Creating close button"<<endl;
#endif // DEBUG #endif // DEBUG
} else if ((*dir)[i] == Fluxbox::STICK) { } 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(), frame.titlebar(),
0, 0, 10, 10); 0, 0, 10, 10);
win.stateSig().attach(winbtn); win.stateSig().attach(winbtn);
winbtn->setOnClick(stick_cmd); winbtn->setOnClick(stick_cmd);
newbutton = winbtn; newbutton = winbtn;
} else if ((*dir)[i] == Fluxbox::SHADE) { } 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(), frame.titlebar(),
0, 0, 10, 10); 0, 0, 10, 10);
winbtn->setOnClick(shade_cmd); 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) if (w == 0)
return; return;
@ -1816,7 +1826,7 @@ void BScreen::initMenu() {
if (defaultMenu) { if (defaultMenu) {
FbTk::RefCount<FbTk::Command> restart_fb(new FbCommands::RestartFluxboxCmd()); FbTk::RefCount<FbTk::Command> restart_fb(new FbCommands::RestartFluxboxCmd());
FbTk::RefCount<FbTk::Command> exit_fb(new FbCommands::ExitFluxboxCmd()); 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->setInternalMenu();
m_rootmenu->insert(i18n->getMessage( m_rootmenu->insert(i18n->getMessage(
FBNLS::ScreenSet, FBNLS::Screenxterm, 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")); "no menu label and/or command defined\n"));
cerr<<"Row: "<<row<<endl; cerr<<"Row: "<<row<<endl;
} else { } 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(); FbTk::MacroCommand *exec_and_hide = new FbTk::MacroCommand();
exec_and_hide->add(hide_menu); exec_and_hide->add(hide_menu);
exec_and_hide->add(exec_cmd); 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 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "fluxbox.hh"
@ -1188,7 +1188,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
} }
break; break;
case Keys::EXECUTE: { //execute command on keypress case Keys::EXECUTE: { //execute command on keypress
FbCommands::ExecuteCmd cmd(m_key->getExecCommand()); FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), screen->getScreenNumber());
cmd.execute(); cmd.execute();
} break; } break;
case Keys::QUIT: case Keys::QUIT: