From 92f49bd8744037bc4812cdacde27b439b5353679 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Mon, 28 Apr 2003 00:38:42 +0000 Subject: fixed execute on right screen --- src/FbCommands.cc | 11 +++++++++-- src/FbCommands.hh | 5 +++-- src/RootTheme.cc | 6 +++--- src/Screen.cc | 58 ++++++++++++++++++++++++++++++++----------------------- src/fluxbox.cc | 4 ++-- 5 files changed, 51 insertions(+), 33 deletions(-) diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 83663fb..0d7d7b6 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc @@ -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); diff --git a/src/FbCommands.hh b/src/FbCommands.hh index 6901d6f..1056b6f 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh @@ -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 diff --git a/src/RootTheme.cc b/src/RootTheme.cc index a652854..617cd8d 100644 --- a/src/RootTheme.cc +++ b/src/RootTheme.cc @@ -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(); } } diff --git a/src/Screen.cc b/src/Screen.cc index 8712fa3..00615e6 100644 --- a/src/Screen.cc +++ b/src/Screen.cc @@ -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,21 +494,24 @@ BScreen::ScreenResource::ScreenResource(ResourceManager &rm, BScreen::BScreen(ResourceManager &rm, const string &screenname, const string &altscreenname, - 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 - m_currentworkspace_sig(*this), // current workspace signal - m_layermanager(num_layers), - cycling_focus(false), - cycling_last(0), - m_windowtheme(new FbWinFrameTheme(scrn)), - m_menutheme(new FbTk::MenuTheme(scrn)), - resource(rm, screenname, altscreenname), - m_root_theme(new - RootTheme(scrn, - *resource.rootcommand)), - m_toolbarhandler(0) { + 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 + m_currentworkspace_sig(*this), // current workspace signal + m_layermanager(num_layers), + cycling_focus(false), + cycling_last(0), + m_windowtheme(new FbWinFrameTheme(scrn)), + m_menutheme(new FbTk::MenuTheme(scrn)), + resource(rm, screenname, altscreenname), + m_root_theme(new + RootTheme(scrn, + *resource.rootcommand)), + // m_winbutton_theme(new WinButtonTheme(scrn)), + m_toolbarhandler(0) { + Display *disp = FbTk::App::instance()->display(); @@ -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"<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 restart_fb(new FbCommands::RestartFluxboxCmd()); FbTk::RefCount exit_fb(new FbCommands::ExitFluxboxCmd()); - FbTk::RefCount execute_xterm(new FbCommands::ExecuteCmd("xterm")); + FbTk::RefCount 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: "< exec_cmd(new FbCommands::ExecuteCmd(str_cmd)); + FbTk::RefCount 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); diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 5de7d8d..15f3a63 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -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: -- cgit v0.11.2