aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-01-10 12:51:21 (GMT)
committerfluxgen <fluxgen>2002-01-10 12:51:21 (GMT)
commitef911eda201ec9b449705f999b60bf3332ee4fdf (patch)
treeaed052d69b64029167185dac826e36f0eee602c9
parentadd890ad213be267e0efae7ae8c958e1f2614efb (diff)
downloadfluxbox-ef911eda201ec9b449705f999b60bf3332ee4fdf.zip
fluxbox-ef911eda201ec9b449705f999b60bf3332ee4fdf.tar.bz2
moved rootcommand to screen loading and added loadRootCommand
-rw-r--r--src/fluxbox.cc133
-rw-r--r--src/fluxbox.hh8
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 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.17 2002/01/09 15:08:22 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.18 2002/01/10 12:51:21 fluxgen Exp $
26 26
27// stupid macros needed to access some functions in version 2 of the GNU C 27// stupid macros needed to access some functions in version 2 of the GNU C
28// library 28// library
@@ -191,8 +191,8 @@ Fluxbox::Fluxbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
191 key=0; 191 key=0;
192 192
193 no_focus = False; 193 no_focus = False;
194 resource.titlebar_file = resource.menu_file = resource.style_file = resource.keys_file = 194 resource.titlebar_file = resource.menu_file = resource.style_file = resource.keys_file = 0;
195 resource.root_cmd = 0; 195
196 resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0; 196 resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
197 197
198 focused_window = masked_window = (FluxboxWindow *) 0; 198 focused_window = masked_window = (FluxboxWindow *) 0;
@@ -290,9 +290,6 @@ Fluxbox::~Fluxbox(void) {
290 delete key; 290 delete key;
291 key = 0; 291 key = 0;
292 292
293 if (resource.root_cmd)
294 delete [] resource.root_cmd;
295
296 if (resource.menu_file) 293 if (resource.menu_file)
297 delete [] resource.menu_file; 294 delete [] resource.menu_file;
298 295
@@ -982,7 +979,17 @@ void Fluxbox::process_event(XEvent *e) {
982 979
983 win->changeBlackboxHints(&net); 980 win->changeBlackboxHints(&net);
984 } 981 }
982 }
983 #ifdef GNOME
984 else if (e->xclient.message_type == getGnomeWorkspaceAtom()) {
985 #ifdef DEBUG
986 cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom"<<endl;
987 #endif//!DEBUG
988 BScreen *screen = searchScreen(e->xclient.window);
989 if (screen)
990 screen->changeWorkspaceID(e->xclient.data.l[0]);
985 } 991 }
992 #endif //!GNOME
986 } 993 }
987 994
988 break; 995 break;
@@ -1256,28 +1263,6 @@ Slit *Fluxbox::searchSlit(Window window) {
1256 1263
1257void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) { 1264void Fluxbox::saveWindowSearch(Window window, FluxboxWindow *data) {
1258 windowSearchList->insert(new WindowSearch(window, data)); 1265 windowSearchList->insert(new WindowSearch(window, data));
1259
1260#ifdef GNOME
1261 /*
1262 Window *wl=0;
1263 int num=0;
1264
1265 num = windowSearchList->count();
1266 wl = new Window[num];
1267 // Fill in array of window ID's
1268 LinkedListIterator<WindowSearch> it(windowSearchList);
1269
1270 for (unsigned int i=0; it.current(); it++, i++)
1271 wl[i] = it.current()->getWindow();
1272
1273 //set property
1274 XChangeProperty(getXDisplay(), DefaultRootWindow(getXDisplay()), getGnomeClientListAtom(), XA_CARDINAL, 32,
1275 PropModeReplace, (unsigned char *)(wl), num);
1276
1277 delete wl;
1278 */
1279#endif
1280
1281} 1266}
1282 1267
1283 1268
@@ -1432,7 +1417,8 @@ void Fluxbox::save_rc(void) {
1432 1417
1433 auto_ptr<char> dbfile(getRcFilename()); 1418 auto_ptr<char> dbfile(getRcFilename());
1434 1419
1435// load_rc(); This overwrites configs made while running, for example 1420// load_rc();
1421// This overwrites configs made while running, for example
1436// usage of iconbar and tabs 1422// usage of iconbar and tabs
1437 1423
1438 sprintf(rc_string, "session.iconbar: %s", resource.iconbar ? "true" : "false"); 1424 sprintf(rc_string, "session.iconbar: %s", resource.iconbar ? "true" : "false");
@@ -1511,15 +1497,19 @@ void Fluxbox::save_rc(void) {
1511 XrmPutLineResource(&new_blackboxrc, rc_string); 1497 XrmPutLineResource(&new_blackboxrc, rc_string);
1512 1498
1513 sprintf(rc_string, "session.imageDither: %s", 1499 sprintf(rc_string, "session.imageDither: %s",
1514 ((screen->getImageControl()->doDither()) ? "True" : "False")); 1500 ((screen->getImageControl()->doDither()) ? "True" : "False"));
1515 XrmPutLineResource(&new_blackboxrc, rc_string); 1501 XrmPutLineResource(&new_blackboxrc, rc_string);
1516 1502
1517 sprintf(rc_string, "session.screen%d.fullMaximization: %s", screen_number, 1503 sprintf(rc_string, "session.screen%d.fullMaximization: %s", screen_number,
1518 ((screen->doFullMax()) ? "True" : "False")); 1504 ((screen->doFullMax()) ? "True" : "False"));
1505 XrmPutLineResource(&new_blackboxrc, rc_string);
1506
1507 sprintf(rc_string, "session.screen%d.rootCommand: %s", screen_number,
1508 screen->getRootCommand().c_str());
1519 XrmPutLineResource(&new_blackboxrc, rc_string); 1509 XrmPutLineResource(&new_blackboxrc, rc_string);
1520 1510
1521 sprintf(rc_string, "session.screen%d.focusNewWindows: %s", screen_number, 1511 sprintf(rc_string, "session.screen%d.focusNewWindows: %s", screen_number,
1522 ((screen->doFocusNew()) ? "True" : "False")); 1512 ((screen->doFocusNew()) ? "True" : "False"));
1523 XrmPutLineResource(&new_blackboxrc, rc_string); 1513 XrmPutLineResource(&new_blackboxrc, rc_string);
1524 1514
1525 sprintf(rc_string, "session.screen%d.focusLastWindow: %s", screen_number, 1515 sprintf(rc_string, "session.screen%d.focusLastWindow: %s", screen_number,
@@ -1528,18 +1518,18 @@ void Fluxbox::save_rc(void) {
1528 1518
1529 sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number, 1519 sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number,
1530 ((screen->getRowPlacementDirection() == BScreen::LeftRight) ? 1520 ((screen->getRowPlacementDirection() == BScreen::LeftRight) ?
1531 "LeftToRight" : "RightToLeft")); 1521 "LeftToRight" : "RightToLeft"));
1532 XrmPutLineResource(&new_blackboxrc, rc_string); 1522 XrmPutLineResource(&new_blackboxrc, rc_string);
1533 1523
1534 sprintf(rc_string, "session.screen%d.colPlacementDirection: %s", screen_number, 1524 sprintf(rc_string, "session.screen%d.colPlacementDirection: %s", screen_number,
1535 ((screen->getColPlacementDirection() == BScreen::TopBottom) ? 1525 ((screen->getColPlacementDirection() == BScreen::TopBottom) ?
1536 "TopToBottom" : "BottomToTop")); 1526 "TopToBottom" : "BottomToTop"));
1537 XrmPutLineResource(&new_blackboxrc, rc_string); 1527 XrmPutLineResource(&new_blackboxrc, rc_string);
1538 1528
1539 char *placement = (char *) 0; 1529 char *placement = (char *) 0;
1540 1530
1541 sprintf(rc_string, "session.screen%d.maxOverSlit: %s", screen_number, 1531 sprintf(rc_string, "session.screen%d.maxOverSlit: %s", screen_number,
1542 ((screen->doMaxOverSlit()) ? "True" : "False")); 1532 ((screen->doMaxOverSlit()) ? "True" : "False"));
1543 XrmPutLineResource(&new_blackboxrc, rc_string); 1533 XrmPutLineResource(&new_blackboxrc, rc_string);
1544 switch (screen->getPlacementPolicy()) { 1534 switch (screen->getPlacementPolicy()) {
1545 case BScreen::CascadePlacement: 1535 case BScreen::CascadePlacement:
@@ -1699,13 +1689,8 @@ void Fluxbox::save_rc(void) {
1699char *Fluxbox::getRcFilename() { 1689char *Fluxbox::getRcFilename() {
1700 char *dbfile=0; 1690 char *dbfile=0;
1701 1691
1702 if (!rc_file) { 1692 if (!rc_file) {
1703 1693 string str(getenv("HOME")+string("/.")+RC_PATH+string("/")+RC_INIT_FILE);
1704 string str(getenv("HOME")+string("/.")+RC_PATH+string("/")+RC_INIT_FILE);
1705 #ifdef DEBUG
1706 cerr<<__FILE__<<"("<<__LINE__<<"): str.size()="<<str.size()<<endl;
1707 cerr<<__FILE__<<"("<<__LINE__<<"): str="<<str<<endl;
1708 #endif
1709 return StringUtil::strdup(str.c_str()); 1694 return StringUtil::strdup(str.c_str());
1710 } else 1695 } else
1711 dbfile = StringUtil::strdup(rc_file); 1696 dbfile = StringUtil::strdup(rc_file);
@@ -1808,16 +1793,6 @@ void Fluxbox::load_rc(void) {
1808 else 1793 else
1809 resource.style_file = StringUtil::strdup(DEFAULTSTYLE); 1794 resource.style_file = StringUtil::strdup(DEFAULTSTYLE);
1810 1795
1811 if (resource.root_cmd) {
1812 delete [] resource.root_cmd;
1813 resource.root_cmd = 0;
1814 }
1815
1816 if (XrmGetResource(database, "session.rootCommand", "Session.RootCommand", &value_type, &value))
1817 resource.root_cmd = StringUtil::expandFilename(value.addr);
1818 else
1819 resource.root_cmd = 0;
1820
1821 if (XrmGetResource(database, "session.doubleClickInterval", 1796 if (XrmGetResource(database, "session.doubleClickInterval",
1822 "Session.DoubleClickInterval", &value_type, &value)) { 1797 "Session.DoubleClickInterval", &value_type, &value)) {
1823 if (sscanf(value.addr, "%lu", &resource.double_click_interval) != 1) 1798 if (sscanf(value.addr, "%lu", &resource.double_click_interval) != 1)
@@ -1946,7 +1921,8 @@ void Fluxbox::load_rc(BScreen *screen) {
1946 char *value_type, name_lookup[1024], class_lookup[1024]; 1921 char *value_type, name_lookup[1024], class_lookup[1024];
1947 int screen_number = screen->getScreenNumber(); 1922 int screen_number = screen->getScreenNumber();
1948 1923
1949 sprintf(name_lookup, "session.screen%d.fullMaximization", screen_number); 1924
1925 sprintf(name_lookup, "session.screen%d.fullMaximization", screen_number);
1950 sprintf(class_lookup, "Session.Screen%d.FullMaximization", screen_number); 1926 sprintf(class_lookup, "Session.Screen%d.FullMaximization", screen_number);
1951 if (XrmGetResource(database, name_lookup, class_lookup, &value_type, 1927 if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
1952 &value)) { 1928 &value)) {
@@ -1957,7 +1933,15 @@ void Fluxbox::load_rc(BScreen *screen) {
1957 } else 1933 } else
1958 screen->saveFullMax(False); 1934 screen->saveFullMax(False);
1959 1935
1960 sprintf(name_lookup, "session.screen%d.focusNewWindows", screen_number); 1936 sprintf(name_lookup, "session.screen%d.rootCommand", screen_number);
1937 sprintf(class_lookup, "Session.Screen%d.RootCommand", screen_number);
1938 if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
1939 &value)) {
1940 screen->saveRootCommand(value.addr==0 ? "": value.addr);
1941 } else
1942 screen->saveRootCommand("");
1943
1944 sprintf(name_lookup, "session.screen%d.focusNewWindows", screen_number);
1961 sprintf(class_lookup, "Session.Screen%d.FocusNewWindows", screen_number); 1945 sprintf(class_lookup, "Session.Screen%d.FocusNewWindows", screen_number);
1962 if (XrmGetResource(database, name_lookup, class_lookup, &value_type, 1946 if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
1963 &value)) { 1947 &value)) {
@@ -2080,27 +2064,7 @@ void Fluxbox::load_rc(BScreen *screen) {
2080 2064
2081 delete [] search; 2065 delete [] search;
2082 } 2066 }
2083 //TODO MOVE THIS!!!!!! 2067
2084 #ifdef GNOME
2085 {
2086 Atom atype;
2087 int aformat;
2088 unsigned long nitems, bytes_remain;
2089 unsigned char *prop;
2090 XGetWindowProperty (screen->getBaseDisplay()->getXDisplay(),
2091 screen->getRootWindow(),
2092 screen->getBaseDisplay()->getGnomeWorkspaceCountAtom(),
2093 0L, 1L, False, XA_CARDINAL, &atype, &aformat, &nitems, &bytes_remain, &prop);
2094
2095 long val = screen->getNumberOfWorkspaces();
2096 fprintf(stderr, "HERE!! %s(%d) num wrkspace(%l)\n", __FILE__, __LINE__, val);
2097 XChangeProperty(screen->getBaseDisplay()->getXDisplay(), screen->getRootWindow(),
2098 screen->getBaseDisplay()->getGnomeWorkspaceCountAtom(), XA_CARDINAL, 32,
2099 PropModeReplace, (unsigned char *)&val, 1);
2100 }
2101 #endif //GNOME
2102
2103
2104 sprintf(name_lookup, "session.screen%d.toolbar.onTop", screen_number); 2068 sprintf(name_lookup, "session.screen%d.toolbar.onTop", screen_number);
2105 sprintf(class_lookup, "Session.Screen%d.Toolbar.OnTop", screen_number); 2069 sprintf(class_lookup, "Session.Screen%d.Toolbar.OnTop", screen_number);
2106 if (XrmGetResource(database, name_lookup, class_lookup, &value_type, 2070 if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
@@ -2375,7 +2339,26 @@ void Fluxbox::load_rc(BScreen *screen) {
2375 2339
2376} 2340}
2377 2341
2342void Fluxbox::loadRootCommand(BScreen *screen) {
2343 XrmDatabase database = (XrmDatabase) 0;
2378 2344
2345 auto_ptr<char> dbfile(getRcFilename());
2346
2347 database = XrmGetFileDatabase(dbfile.get());
2348 if (!database)
2349 database = XrmGetFileDatabase(DEFAULT_INITFILE);
2350
2351 XrmValue value;
2352 char *value_type, name_lookup[1024], class_lookup[1024];
2353 sprintf(name_lookup, "session.screen%d.rootCommand", screen->getScreenNumber());
2354 sprintf(class_lookup, "Session.Screen%d.RootCommand", screen->getScreenNumber());
2355 if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
2356 &value)) {
2357 screen->saveRootCommand(value.addr==0 ? "": value.addr);
2358 } else
2359 screen->saveRootCommand("");
2360
2361}
2379void Fluxbox::reload_rc(void) { 2362void Fluxbox::reload_rc(void) {
2380 load_rc(); 2363 load_rc();
2381 reconfigure(); 2364 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 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.hh,v 1.4 2002/01/09 14:11:20 fluxgen Exp $ 25// $Id: fluxbox.hh,v 1.5 2002/01/10 12:51:21 fluxgen Exp $
26 26
27#ifndef _FLUXBOX_HH_ 27#ifndef _FLUXBOX_HH_
28#define _FLUXBOX_HH_ 28#define _FLUXBOX_HH_
@@ -128,8 +128,7 @@ public:
128 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return titlebar.left; } 128 inline const std::vector<Fluxbox::Titlebar>& getTitlebarLeft() { return titlebar.left; }
129 inline const char *getStyleFilename(void) const 129 inline const char *getStyleFilename(void) const
130 { return resource.style_file; } 130 { return resource.style_file; }
131 inline const char *getRootCommand() const 131
132 { return resource.root_cmd; }
133 inline const char *getMenuFilename(void) const 132 inline const char *getMenuFilename(void) const
134 { return resource.menu_file; } 133 { return resource.menu_file; }
135 134
@@ -151,6 +150,7 @@ public:
151 void setFocusedWindow(FluxboxWindow *w); 150 void setFocusedWindow(FluxboxWindow *w);
152 void shutdown(void); 151 void shutdown(void);
153 void load_rc(BScreen *); 152 void load_rc(BScreen *);
153 void loadRootCommand(BScreen *);
154 void loadTitlebar(); 154 void loadTitlebar();
155 void saveStyleFilename(const char *); 155 void saveStyleFilename(const char *);
156 void saveMenuFilename(const char *); 156 void saveMenuFilename(const char *);
@@ -211,7 +211,7 @@ private:
211 struct resource { 211 struct resource {
212 Time double_click_interval; 212 Time double_click_interval;
213 213
214 char *menu_file, *style_file, *titlebar_file, *keys_file, *root_cmd; 214 char *menu_file, *style_file, *titlebar_file, *keys_file;
215 int colors_per_channel; 215 int colors_per_channel;
216 timeval auto_raise_delay; 216 timeval auto_raise_delay;
217 unsigned long cache_life, cache_max; 217 unsigned long cache_life, cache_max;