From ef911eda201ec9b449705f999b60bf3332ee4fdf Mon Sep 17 00:00:00 2001 From: fluxgen Date: Thu, 10 Jan 2002 12:51:21 +0000 Subject: moved rootcommand to screen loading and added loadRootCommand --- src/fluxbox.cc | 133 +++++++++++++++++++++++++-------------------------------- src/fluxbox.hh | 8 ++-- 2 files changed, 62 insertions(+), 79 deletions(-) diff --git a/src/fluxbox.cc b/src/fluxbox.cc index e141b6f..a48f0ef 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.17 2002/01/09 15:08:22 fluxgen Exp $ +// $Id: fluxbox.cc,v 1.18 2002/01/10 12:51:21 fluxgen Exp $ // stupid macros needed to access some functions in version 2 of the GNU C // library @@ -191,8 +191,8 @@ Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc) key=0; no_focus = False; - resource.titlebar_file = resource.menu_file = resource.style_file = resource.keys_file = - resource.root_cmd = 0; + resource.titlebar_file = resource.menu_file = resource.style_file = resource.keys_file = 0; + resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0; focused_window = masked_window = (FluxboxWindow *) 0; @@ -290,9 +290,6 @@ Fluxbox::~Fluxbox(void) { delete key; key = 0; - if (resource.root_cmd) - delete [] resource.root_cmd; - if (resource.menu_file) delete [] resource.menu_file; @@ -982,7 +979,17 @@ void Fluxbox::process_event(XEvent *e) { win->changeBlackboxHints(&net); } + } + #ifdef GNOME + else if (e->xclient.message_type == getGnomeWorkspaceAtom()) { + #ifdef DEBUG + cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom"<xclient.window); + if (screen) + screen->changeWorkspaceID(e->xclient.data.l[0]); } + #endif //!GNOME } break; @@ -1256,28 +1263,6 @@ Slit *Fluxbox::searchSlit(Window window) { void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) { windowSearchList->insert(new WindowSearch(window, data)); - -#ifdef GNOME - /* - Window *wl=0; - int num=0; - - num = windowSearchList->count(); - wl = new Window[num]; - // Fill in array of window ID's - LinkedListIterator it(windowSearchList); - - for (unsigned int i=0; it.current(); it++, i++) - wl[i] = it.current()->getWindow(); - - //set property - XChangeProperty(getXDisplay(), DefaultRootWindow(getXDisplay()), getGnomeClientListAtom(), XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)(wl), num); - - delete wl; - */ -#endif - } @@ -1432,7 +1417,8 @@ void Fluxbox::save_rc(void) { auto_ptr dbfile(getRcFilename()); -// load_rc(); This overwrites configs made while running, for example +// load_rc(); +// This overwrites configs made while running, for example // usage of iconbar and tabs sprintf(rc_string, "session.iconbar: %s", resource.iconbar ? "true" : "false"); @@ -1511,15 +1497,19 @@ void Fluxbox::save_rc(void) { XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.imageDither: %s", - ((screen->getImageControl()->doDither()) ? "True" : "False")); + ((screen->getImageControl()->doDither()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.fullMaximization: %s", screen_number, - ((screen->doFullMax()) ? "True" : "False")); + ((screen->doFullMax()) ? "True" : "False")); + XrmPutLineResource(&new_blackboxrc, rc_string); + + sprintf(rc_string, "session.screen%d.rootCommand: %s", screen_number, + screen->getRootCommand().c_str()); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.focusNewWindows: %s", screen_number, - ((screen->doFocusNew()) ? "True" : "False")); + ((screen->doFocusNew()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.focusLastWindow: %s", screen_number, @@ -1528,18 +1518,18 @@ void Fluxbox::save_rc(void) { sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number, ((screen->getRowPlacementDirection() == BScreen::LeftRight) ? - "LeftToRight" : "RightToLeft")); + "LeftToRight" : "RightToLeft")); XrmPutLineResource(&new_blackboxrc, rc_string); sprintf(rc_string, "session.screen%d.colPlacementDirection: %s", screen_number, ((screen->getColPlacementDirection() == BScreen::TopBottom) ? - "TopToBottom" : "BottomToTop")); + "TopToBottom" : "BottomToTop")); XrmPutLineResource(&new_blackboxrc, rc_string); char *placement = (char *) 0; sprintf(rc_string, "session.screen%d.maxOverSlit: %s", screen_number, - ((screen->doMaxOverSlit()) ? "True" : "False")); + ((screen->doMaxOverSlit()) ? "True" : "False")); XrmPutLineResource(&new_blackboxrc, rc_string); switch (screen->getPlacementPolicy()) { case BScreen::CascadePlacement: @@ -1699,13 +1689,8 @@ void Fluxbox::save_rc(void) { char *Fluxbox::getRcFilename() { char *dbfile=0; - if (!rc_file) { - - string str(getenv("HOME")+string("/.")+RC_PATH+string("/")+RC_INIT_FILE); - #ifdef DEBUG - cerr<<__FILE__<<"("<<__LINE__<<"): str.size()="<getScreenNumber(); - sprintf(name_lookup, "session.screen%d.fullMaximization", screen_number); + + sprintf(name_lookup, "session.screen%d.fullMaximization", screen_number); sprintf(class_lookup, "Session.Screen%d.FullMaximization", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, &value)) { @@ -1957,7 +1933,15 @@ void Fluxbox::load_rc(BScreen *screen) { } else screen->saveFullMax(False); - sprintf(name_lookup, "session.screen%d.focusNewWindows", screen_number); + sprintf(name_lookup, "session.screen%d.rootCommand", screen_number); + sprintf(class_lookup, "Session.Screen%d.RootCommand", screen_number); + if (XrmGetResource(database, name_lookup, class_lookup, &value_type, + &value)) { + screen->saveRootCommand(value.addr==0 ? "": value.addr); + } else + screen->saveRootCommand(""); + + sprintf(name_lookup, "session.screen%d.focusNewWindows", screen_number); sprintf(class_lookup, "Session.Screen%d.FocusNewWindows", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, &value)) { @@ -2080,27 +2064,7 @@ void Fluxbox::load_rc(BScreen *screen) { delete [] search; } - //TODO MOVE THIS!!!!!! - #ifdef GNOME - { - Atom atype; - int aformat; - unsigned long nitems, bytes_remain; - unsigned char *prop; - XGetWindowProperty (screen->getBaseDisplay()->getXDisplay(), - screen->getRootWindow(), - screen->getBaseDisplay()->getGnomeWorkspaceCountAtom(), - 0L, 1L, False, XA_CARDINAL, &atype, &aformat, &nitems, &bytes_remain, &prop); - - long val = screen->getNumberOfWorkspaces(); - fprintf(stderr, "HERE!! %s(%d) num wrkspace(%l)\n", __FILE__, __LINE__, val); - XChangeProperty(screen->getBaseDisplay()->getXDisplay(), screen->getRootWindow(), - screen->getBaseDisplay()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32, - PropModeReplace, (unsigned char *)&val, 1); - } - #endif //GNOME - - + sprintf(name_lookup, "session.screen%d.toolbar.onTop", screen_number); sprintf(class_lookup, "Session.Screen%d.Toolbar.OnTop", screen_number); if (XrmGetResource(database, name_lookup, class_lookup, &value_type, @@ -2375,7 +2339,26 @@ void Fluxbox::load_rc(BScreen *screen) { } +void Fluxbox::loadRootCommand(BScreen *screen) { + XrmDatabase database = (XrmDatabase) 0; + auto_ptr dbfile(getRcFilename()); + + database = XrmGetFileDatabase(dbfile.get()); + if (!database) + database = XrmGetFileDatabase(DEFAULT_INITFILE); + + XrmValue value; + char *value_type, name_lookup[1024], class_lookup[1024]; + sprintf(name_lookup, "session.screen%d.rootCommand", screen->getScreenNumber()); + sprintf(class_lookup, "Session.Screen%d.RootCommand", screen->getScreenNumber()); + if (XrmGetResource(database, name_lookup, class_lookup, &value_type, + &value)) { + screen->saveRootCommand(value.addr==0 ? "": value.addr); + } else + screen->saveRootCommand(""); + +} void Fluxbox::reload_rc(void) { load_rc(); reconfigure(); diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 4e10bad..68219d0 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.hh,v 1.4 2002/01/09 14:11:20 fluxgen Exp $ +// $Id: fluxbox.hh,v 1.5 2002/01/10 12:51:21 fluxgen Exp $ #ifndef _FLUXBOX_HH_ #define _FLUXBOX_HH_ @@ -128,8 +128,7 @@ public: inline const std::vector& getTitlebarLeft() { return titlebar.left; } inline const char *getStyleFilename(void) const { return resource.style_file; } - inline const char *getRootCommand() const - { return resource.root_cmd; } + inline const char *getMenuFilename(void) const { return resource.menu_file; } @@ -151,6 +150,7 @@ public: void setFocusedWindow(FluxboxWindow *w); void shutdown(void); void load_rc(BScreen *); + void loadRootCommand(BScreen *); void loadTitlebar(); void saveStyleFilename(const char *); void saveMenuFilename(const char *); @@ -211,7 +211,7 @@ private: struct resource { Time double_click_interval; - char *menu_file, *style_file, *titlebar_file, *keys_file, *root_cmd; + char *menu_file, *style_file, *titlebar_file, *keys_file; int colors_per_channel; timeval auto_raise_delay; unsigned long cache_life, cache_max; -- cgit v0.11.2