$ #RCRequiresArg
# error: '-rc' requires an argument\n
+$ #MENURequiresArg
+# error: '-menu' requires an argument\n
$ #DISPLAYRequiresArg
# error: '-display' requires an argument\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tuse display connection.\n\
-rc <string>\t\t\tuse alternate resource file.\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\tdisplay version and exit.\n\
-help\t\t\t\tdisplay this help text and exit.\n\n
$ #CompileOptions
$ #RCRequiresArg
# fejl: '-rc' kræver et argument\n
+$ #MENURequiresArg
+# fejl: '-menu' kræver et argument\n
$ #DISPLAYRequiresArg
# fjel: '-display' kræver et argument\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tbrug skærm tilslutning.\n\
-rc <string>\t\t\tbrug alternativ resource fil.\n\
+ -menu <string>\t\t\tbrug alternativ menu fil.\n\
-version\t\t\tvis versionsnummer og afslut.\n\
-help\t\t\t\tvis denne hjælp og afslut.\n\n
$ #CompileOptions
$ #RCRequiresArg
# Fehler: '-rc' benötigt einen Parameter\n
+$ #MENURequiresArg
+# Fehler: '-menu' benötigt einen Parameter\n
$ #DISPLAYRequiresArg
# Fehler: '-display' benötigt einen Parameter\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tDisplay Verbindung.\n\
-rc <string>\t\t\talternative Konfigurationsdatei.\n\
+ -menu <string>\t\t\talternate menu file.\n\
-version\t\t\tzeige Versionsnummer und Beendung.\n\
-help\t\t\t\tzeige diesen Hilfstext und Beendung.\n\n
$ #CompileOptions
$ #RCRequiresArg
# error: '-rc' requiere un argumento
+$ #MENURequiresArg
+# error: '-menu' requiere un argumento
$ #DISPLAYRequiresArg
# error: '-display' requiere un argumento
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string> conexión de despliegue.\n\
-rc <string> archivo alternativo de recuros.\n\
+ -menu <string> archivo alternativo de menu.\n\
-version mostrar la versión y cerrar.\n\
-help mostrar este texto de ayuda y cerrar.\n\n
$ #CompileOptions
$ #RCRequiresArg
# viga: '-rc' vajab argumenti\n
+$ #MENURequiresArg
+# viga: '-menu' vajab argumenti\n
$ #DISPLAYRequiresArg
# viga: '-display' vajab argumenti\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tkasuta displei ühendust.\n\
-rc <string>\t\t\tkasuta alternatiivseid resursse.\n\
+ -menu <string>\t\t\tkasuta alternatiivseid menu.\n\
-version\t\t\tnäita versiooninumber ja välju.\n\
-help\t\t\t\tnäita seda abiteksti ja välju.\n\n
$ #CompileOptions
$ #RCRequiresArg
# Erreur: '-rc' nécessite un argument\n
+$ #MENURequiresArg
+# Erreur: '-menu' nécessite un argument\n
$ #DISPLAYRequiresArg
# Erreur: '-display' nécessite un argument\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000 Brad Hughes\n\n\
-display <chaîne>\t\tutilise la connexion à l'affichage.\n\
-rc <chaîne>\t\t\tutilise un autre fichier de configuration.\n\
+ -menu <chaîne>\t\t\tutilise un autre fichier de menu.\n\
-version\t\t\taffiche la version et quitte.\n\
-help\t\t\t\taffiche ce texte d'aide et quitte.\n\n
$ #CompileOptions
$ #RCRequiresArg
# Hiba: '-rc' kapcsoló paramétere hiányzik\n
+$ #MENURequiresArg
+# Hiba: '-menu' kapcsoló paramétere hiányzik\n
$ #DISPLAYRequiresArg
# Hiba: '-display' kapcsoló paramétere hiányzik\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000 Brad Hughes\n\n\
-display <string>\t\thasználandó kijelzõ\n\
-rc <string>\t\t\tválasztható konfigurációs file.\n\
+ -menu <string>\t\t\tválasztható menu file.\n\
-version\t\t\tverziószám kijelzése és kilépés.\n\
-help\t\t\t\tsúgóképernyõ mutatása és kilépés.\n\n
$ #CompileOptions
$ #RCRequiresArg
# errore: '-rc' richiede un argomento\n
+$ #MENURequiresArg
+# errore: '-menu' richiede un argomento\n
$ #DISPLAYRequiresArg
# errore: '-display' richiede an argomento\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tusa connessione display.\n\
-rc <string>\t\t\tusa un file risorsa alternativo.\n\
+ -menu <string>\t\t\tusa un file menu alternativo.\n\
-version\t\t\tmostra la versione e esci.\n\
-help\t\t\t\tmostra questo aiuto e esci.\n\n
$ #CompileOptions
$ #RCRequiresArg
# ¥¨¥é¡¼: '-rc' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òɬÍפȤ·¤Þ¤¹\n
+$ #MENURequiresArg
+# ¥¨¥é¡¼: '-menu' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òɬÍפȤ·¤Þ¤¹\n
$ #DISPLAYRequiresArg
# ¥¨¥é¡¼: '-display' ¥ª¥×¥·¥ç¥ó¤Ï°ú¿ô¤òɬÍפȤ·¤Þ¤¹\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\t»ØÄê¥Ç¥£¥¹¥×¥ì¥¤¤ËÀܳ\n\
-rc <string>\t\t\tÂå¤ê¤Î¥ê¥½¡¼¥¹¥Õ¥¡¥¤¥ë¤ò»ÈÍÑ\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\t¥Ð¡¼¥¸¥ç¥ó¾ðÊó¤òɽ¼¨¤·¡¢½ªÎ»\n\
-help\t\t\t\t¤³¤Î¥Ø¥ë¥×¤òɽ¼¨¤·¡¢½ªÎ»\n\n
$ #CompileOptions
$ #RCRequiresArg
# fout: '-rc' heeft een argument nodig (bestandsnaam)\n
+$ #MENURequiresArg
+# fout: '-menu' heeft een argument nodig (bestandsnaam)\n
$ #DISPLAYRequiresArg
# fout: '-display' heeft een argument nodig (displaynaam)\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <displaynaam> gebruik aangegeven display.\n\
-rc <bestandsnaam> gebruik alternatief resource bestand.\n\
+ -menu <bestandsnaam> gebruik alternatief menu bestand.\n\
-version toon versie en stop.\n\
-help toon deze hulp tekst en stop.\n\n
$ #CompileOptions
$ #RCRequiresArg
# erro: '-rc' requer um argumento\n
+$ #MENURequiresArg
+# erro: '-menu' requer um argumento\n
$ #DISPLAYRequiresArg
# erro: '-display' requer um argumento\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tusar conexão com o display.\n\
-rc <string>\t\t\tusar arquivo alternativo de recursos.\n\
+ -menu <string>\t\t\tusar arquivo alternativo de menu.\n\
-version\t\t\tmostrar versao e sair.\n\
-help\t\t\t\tmostrar esta ajuda e sair.\n\n
$ #CompileOptions
$ #RCRequiresArg
# ÏÛÉÂËÁ: '-rc' ÔÒÅÂÕÅÔ ÎÁÌÉÞÉÅ ÁÒÇÕÍÅÎÔÁ\n
+$ #MENURequiresArg
+# ÏÛÉÂËÁ: '-menu' ÔÒÅÂÕÅÔ ÎÁÌÉÞÉÅ ÁÒÇÕÍÅÎÔÁ\n
$ #DISPLAYRequiresArg
# ÏÛÉÂËÁ: '-display' ÔÒÅÂÕÅÔ ÎÁÌÉÞÉÅ ÁÒÇÕÍÅÎÔÁ\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000 Brad Hughes\n\n\
-display <string>\t\tÉÓÐÏÌØÚÏ×ÁÔØ ÚÁÄÁÎÎÙÊ ÄÉÓÐÌÅÊ.\n\
-rc <string>\t\t\tÉÓÐÏÌØÚÏ×ÁÔØ ÁÌØÔÅÒÎÁÔÉ×ÎÙÊ ÆÁÊÌ ÒÅÓÕÒÓÏ×.\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\t×Ù×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓÉÉ É ×ÙÊÔÉ.\n\
-help\t\t\t\t×Ù×ÅÓÔÉ ÜÔÕ ÐÏÄÓËÁÚËÕ É ×ÙÊÔÉ.\n\n
$ #CompileOptions
$ #RCRequiresArg
# napaka: '-rc' zahteva argument\n
+$ #MENURequiresArg
+# napaka: '-menu' zahteva argument\n
$ #DISPLAYRequiresArg
# napaka: '-display' zahteva argument\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tuporabi prikazovalnik.\n\
-rc <string>\t\t\tuporabi nadomestno datoteko z viri.\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\tprika¾i oznako razlièice in konèaj.\n\
-help\t\t\t\prika¾i ta navodila in konèaj.\n\n
$ #CompileOptions
$ #RCRequiresArg
# fel: '-rc' kräver ett argument\n
+$ #MENURequiresArg
+# fel: '-menu' kräver ett argument\n
$ #DISPLAYRequiresArg
# fel: '-display' kräver ett argument\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tanvänd skärmanslutning.\n\
-rc <string>\t\t\tanvänd alternativ resursfil.\n\
+ -menu <string>\t\t\tanvänd alternativ menufil.\n\
-version\t\t\tvisa version och avsluta.\n\
-help\t\t\t\tvisa denna hjälptext och avsluta.\n\n
$ #CompileOptions
$ #RCRequiresArg
# hata : '-rc' bir argüman bekler\n
+$ #MENURequiresArg
+# hata : '-menu' bir argüman bekler\n
$ #DISPLAYRequiresArg
# hata : '-display' bir argüman bekler\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <metin>\t\tekraný kullan.\n\
-rc <metin>\t\t\tbaþka bir ayarlama dosyasýný kullan.\n\
+ -menu <metin>\t\t\tuse alternate menu file.\n\
-version\t\t\tnesil bilgisini gösterir ve çýkar.\n\
-help\t\t\t\tbu yardým iletisini gösterir ve çýkar.\n\n
$ #CompileOptions
$ #RCRequiresArg
# ÐÏÍÉÌËÁ: "-rc" ×ÉÍÁÇÁ¤ ÁÒÇÕÍÅÎÔ\n
+$ #MENURequiresArg
+# ÐÏÍÉÌËÁ: "-menu" ×ÉÍÁÇÁ¤ ÁÒÇÕÍÅÎÔ\n
$ #DISPLAYRequiresArg
# ÐÏÍÉÌËÁ: "-display" ×ÉÍÁÇÁ¤ ÁÒÇÕÍÅÎÔ\n
$ #WarnDisplaySet
# Blackbox %s: (c) 1997 - 2000 Brad Hughes\n\n\
-display <string>\t\tÏÂÓÌÕÇÏ×Õ×ÁÔÉ ×ËÁÚÁÎÉÊ ÄÉÓÐÌÅÊ.\n\
-rc <string>\t\t\t×ÉËÏÒÉÓÔÏ×Õ×ÁÔÉ ÁÌØÔÅÒÎÁÔÉ×ÎÉÊ ÆÁÊÌ ÒÅÓÕÒÓ¦×.\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\t×É×ÅÓÔÉ ÎÏÍÅÒ ×ÅÒÓ¦§ ¦ ×ÉÊÔÉ.\n\
-help\t\t\t\t×É×ÅÓÔÉ ÃÀ ЦÄËÁÚËÕ ¦ ×ÉÊÔÉ.\n\n
$ #CompileOptions
Debugging\t\t\t%s\n\
Interlacing:\t\t\t%s\n\
Shape:\t\t\t%s\n\
- Slit:\t\t\t\t%s\n\
8bpp Ordered Dithering:\t%s\n\n
$ #RCRequiresArg
# ´íÎó: '-rc' ÐèÒª²ÎÊý\n
+$ #MENURequiresArg
+# ´íÎó: '-menu' ÐèÒª²ÎÊý\n
$ #DISPLAYRequiresArg
# ´íÎó: '-display' ÐèÒª²ÎÊý\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tʹÓÃÏÔʾÁ¬½Ó.\n\
-rc <string>\t\t\tʹÓÃÆäËûµÄ×ÊÔ´Îļþ.\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\tÏÔʾ°æ±¾.\n\
-help\t\t\t\tÏÔʾÕâ¸ö°ïÖú.\n\n
$ #CompileOptions
$ #RCRequiresArg
# error: '-rc' requires an argument\n
+$ #MENURequiresArg
+# error: '-menu' requires an argument\n
$ #DISPLAYRequiresArg
# error: '-display' requires an argument\n
$ #WarnDisplaySet
\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n\
-display <string>\t\tuse display connection.\n\
-rc <string>\t\t\tuse alternate resource file.\n\
+ -menu <string>\t\t\tuse alternate menu file.\n\
-version\t\t\tdisplay version and exit.\n\
-help\t\t\t\tdisplay this help text and exit.\n\n
$ #CompileOptions
}
bool defaultMenu = True;
- if (blackbox->getMenuFilename()) {
- FILE *menu_file = fopen(blackbox->getMenuFilename(), "r");
-
- if (!menu_file) {
- perror(blackbox->getMenuFilename());
+ FILE *menu_file = (FILE *) 0;
+ const char *menu_filename = blackbox->getMenuFilename();
+
+ if (menu_filename)
+ if (!(menu_file = fopen(menu_filename, "r")))
+ perror(menu_filename);
+ if (!menu_file) { // opening the menu file failed, try the default menu
+ menu_filename = DEFAULTMENU;
+ if (!(menu_file = fopen(menu_filename, "r")))
+ perror(menu_filename);
+ }
+
+ if (menu_file) {
+ if (feof(menu_file)) {
+ fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile,
+ "%s: Empty menu file"),
+ menu_filename);
} else {
- if (feof(menu_file)) {
- fprintf(stderr, i18n(ScreenSet, ScreenEmptyMenuFile,
- "%s: Empty menu file"),
- blackbox->getMenuFilename());
- } else {
- char line[1024], label[1024];
- memset(line, 0, 1024);
- memset(label, 0, 1024);
-
- while (fgets(line, 1024, menu_file) && ! feof(menu_file)) {
- if (line[0] != '#') {
- int i, key = 0, index = -1, len = strlen(line);
-
- for (i = 0; i < len; i++) {
- if (line[i] == '[') index = 0;
- else if (line[i] == ']') break;
- else if (line[i] != ' ')
- if (index++ >= 0)
- key += tolower(line[i]);
- }
+ char line[1024], label[1024];
+ memset(line, 0, 1024);
+ memset(label, 0, 1024);
+
+ while (fgets(line, 1024, menu_file) && ! feof(menu_file)) {
+ if (line[0] != '#') {
+ int i, key = 0, index = -1, len = strlen(line);
+
+ for (i = 0; i < len; i++) {
+ if (line[i] == '[') index = 0;
+ else if (line[i] == ']') break;
+ else if (line[i] != ' ')
+ if (index++ >= 0)
+ key += tolower(line[i]);
+ }
- if (key == 517) { // [begin]
- index = -1;
- for (i = index; i < len; i++) {
- if (line[i] == '(') index = 0;
- else if (line[i] == ')') break;
- else if (index++ >= 0) {
- if (line[i] == '\\' && i < len - 1) i++;
- label[index - 1] = line[i];
- }
+ if (key == 517) { // [begin]
+ index = -1;
+ for (i = index; i < len; i++) {
+ if (line[i] == '(') index = 0;
+ else if (line[i] == ')') break;
+ else if (index++ >= 0) {
+ if (line[i] == '\\' && i < len - 1) i++;
+ label[index - 1] = line[i];
}
+ }
- if (index == -1) index = 0;
- label[index] = '\0';
+ if (index == -1) index = 0;
+ label[index] = '\0';
- rootmenu->setLabel(label);
- defaultMenu = parseMenuFile(menu_file, rootmenu);
- break;
- }
+ rootmenu->setLabel(label);
+ defaultMenu = parseMenuFile(menu_file, rootmenu);
+ if (!defaultMenu)
+ blackbox->addMenuTimestamp(menu_filename);
+ break;
}
}
}
- fclose(menu_file);
}
+ fclose(menu_file);
}
if (defaultMenu) {
rootmenu->insert(i18n(ScreenSet, ScreenExit, "Exit"),
BScreen::Exit);
rootmenu->setLabel(i18n(BasemenuSet, BasemenuBlackboxMenu,
- "Blackbox Menu"));
- } else {
- blackbox->saveMenuFilename(blackbox->getMenuFilename());
+ "Openbox Menu"));
}
}
if (! feof(submenufile)) {
if (! parseMenuFile(submenufile, menu))
- blackbox->saveMenuFilename(newfile);
+ blackbox->addMenuTimestamp(newfile);
fclose(submenufile);
}
rootmenuList.push_back(stylesmenu);
}
- blackbox->saveMenuFilename(stylesdir);
+ blackbox->addMenuTimestamp(stylesdir);
} else {
fprintf(stderr,
i18n(ScreenSet, ScreenSTYLESDIRErrorNotDir,
Blackbox *blackbox;
-Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc)
+Blackbox::Blackbox(char **m_argv, char *dpy_name, char *rc, char *menu)
: BaseDisplay(m_argv[0], dpy_name) {
if (! XSupportsLocale())
fprintf(stderr, "X server does not support locale\n");
::blackbox = this;
argv = m_argv;
- if (! rc) rc = "~/.blackboxrc";
+ if (! rc) rc = "~/.openbox/rc";
rc_file = expandTilde(rc);
+ if (! menu) menu = "~/.openbox/menu";
+ menu_file = expandTilde(menu);
no_focus = False;
load_rc();
- sprintf(rc_string, "session.menuFile: %s", getMenuFilename());
- XrmPutLineResource(&new_blackboxrc, rc_string);
-
sprintf(rc_string, "session.colorsPerChannel: %d",
resource.colors_per_channel);
XrmPutLineResource(&new_blackboxrc, rc_string);
int int_value;
unsigned long long_value;
- if (XrmGetResource(database, "session.menuFile", "Session.MenuFile",
- &value_type, &value)) {
- resource.menu_file = expandTilde(value.addr);
- } else {
- resource.menu_file = DEFAULTMENU;
- }
-
resource.colors_per_channel = 4;
if (XrmGetResource(database, "session.colorsPerChannel",
"Session.ColorsPerChannel", &value_type, &value) &&
}
-void Blackbox::saveMenuFilename(const string& filename) {
+void Blackbox::addMenuTimestamp(const string& filename) {
assert(! filename.empty());
bool found = False;
struct BResource {
Time double_click_interval;
- std::string menu_file, style_file;
+ std::string style_file;
int colors_per_channel;
timeval auto_raise_delay;
unsigned long cache_life, cache_max;
bool no_focus, reconfigure_wait, reread_menu_wait;
Time last_time;
char **argv;
- std::string rc_file;
+ std::string menu_file, rc_file;
Atom xa_wm_colormap_windows, xa_wm_protocols, xa_wm_state,
xa_wm_delete_window, xa_wm_take_focus, xa_wm_change_state,
public:
- Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0);
+ Blackbox(char **m_argv, char *dpy_name = 0, char *rc = 0, char *menu = 0);
virtual ~Blackbox(void);
Basemenu *searchMenu(Window window);
inline const char *getStyleFilename(void) const
{ return resource.style_file.c_str(); }
inline const char *getMenuFilename(void) const
- { return resource.menu_file.c_str(); }
+ { return menu_file.c_str(); }
inline int getColorsPerChannel(void) const
{ return resource.colors_per_channel; }
void shutdown(void);
void load_rc(BScreen *screen);
void saveStyleFilename(const std::string& filename);
- void saveMenuFilename(const std::string& filename);
+ void addMenuTimestamp(const std::string& filename);
void restart(const char *prog = 0);
void reconfigure(void);
void rereadMenu(void);
"\t\t\t 1997 - 2000, 2002 Brad Hughes\n\n"
" -display <string>\t\tuse display connection.\n"
" -rc <string>\t\t\tuse alternate resource file.\n"
+ " -menu <string>\t\t\tuse alternate menu file.\n"
" -version\t\t\tdisplay version and exit.\n"
" -help\t\t\t\tdisplay this help text and exit.\n\n"),
__openbox_version);
int main(int argc, char **argv) {
char *session_display = (char *) 0;
char *rc_file = (char *) 0;
+ char *menu_file = (char *) 0;
i18n.openCatalog("blackbox.cat");
}
rc_file = argv[i];
+ } else if (! strcmp(argv[i], "-menu")) {
+ // look for alternative menu file to use
+
+ if ((++i) >= argc) {
+ fprintf(stderr,
+ i18n(mainSet, mainMENURequiresArg,
+ "error: '-menu' requires and argument\n"));
+
+ ::exit(1);
+ }
+
+ menu_file = argv[i];
} else if (! strcmp(argv[i], "-display")) {
// check for -display option... to run on a display other than the one
// set by the environment variable DISPLAY
_chdir2(getenv("X11ROOT"));
#endif // __EMX__
- Blackbox blackbox(argv, session_display, rc_file);
+ Blackbox blackbox(argv, session_display, rc_file, menu_file);
blackbox.eventLoop();
return(0);