61. src/optioins.c
void init_parse_options(int argc char **argv)
void init_parse_options(int argc, char **argv)
{
/* TODO: sort these to match declaration of __fehoptions */
/* For setting the command hint on X windows */
cmdargc = argc;
cmdargv = argv;
/* Set default options */
memset(&opt, 0, sizeof(fehoptions));
opt.display = 1;
opt.aspect = 1;
opt.slideshow_delay = 0.0;
opt.magick_timeout = -1;
opt.thumb_w = 60;
opt.thumb_h = 60;
opt.thumb_redraw = 10;
opt.scroll_step = 20;
opt.menu_font = estrdup(DEFAULT_MENU_FONT);
opt.font = NULL;
opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png");
opt.max_height = opt.max_width = UINT_MAX;
opt.start_list_at = NULL;
opt.jump_on_resort = 1;
opt.screen_clip = 1;
#ifdef HAVE_LIBXINERAMA
/* if we're using xinerama, then enable it by default */
opt.xinerama = 1;
opt.xinerama_index = -1;
#endif /* HAVE_LIBXINERAMA */
feh_getopt_theme(argc, argv);
D(("About to check for theme configurationn"));
feh_check_theme_options(argv);
D(("About to parse commandline optionsn"));
/* Parse the cmdline args */
feh_parse_option_array(argc, argv, 1);
/* If we have a filelist to read, do it now */
if (opt.filelistfile) {
/* joining two reverse-sorted lists in this manner works nicely for us
here, as files specified on the commandline end up at the *end* of
the combined filelist, in the specified order. */
D(("About to load filelist from filen"));
filelist = gib_list_cat(filelist, feh_read_filelist(opt.filelistfile));
}
D(("Options parsedn"));
filelist_len = gib_list_length(filelist);
if (!filelist_len)
show_mini_usage();
check_options();
feh_prepare_filelist();
return;
}
62. src/optioins.c
void init_parse_options(int argc char **argv)
optにデフォルト値セット
コマンドライン引数を
feh_getopt_theme(argc, argv);
でパースしてopt設定
void init_parse_options(int argc, char **argv)
{
/* TODO: sort these to match declaration of __fehoptions */
/* For setting the command hint on X windows */
cmdargc = argc;
cmdargv = argv;
/* Set default options */
memset(&opt, 0, sizeof(fehoptions));
opt.display = 1;
opt.aspect = 1;
opt.slideshow_delay = 0.0;
opt.magick_timeout = -1;
opt.thumb_w = 60;
opt.thumb_h = 60;
opt.thumb_redraw = 10;
opt.scroll_step = 20;
opt.menu_font = estrdup(DEFAULT_MENU_FONT);
opt.font = NULL;
opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png");
opt.max_height = opt.max_width = UINT_MAX;
opt.start_list_at = NULL;
opt.jump_on_resort = 1;
opt.screen_clip = 1;
#ifdef HAVE_LIBXINERAMA
/* if we're using xinerama, then enable it by default */
opt.xinerama = 1;
opt.xinerama_index = -1;
#endif /* HAVE_LIBXINERAMA */
feh_getopt_theme(argc, argv);
D(("About to check for theme configurationn"));
feh_check_theme_options(argv);
D(("About to parse commandline optionsn"));
/* Parse the cmdline args */
feh_parse_option_array(argc, argv, 1);
/* If we have a filelist to read, do it now */
if (opt.filelistfile) {
/* joining two reverse-sorted lists in this manner works nicely for us
here, as files specified on the commandline end up at the *end* of
the combined filelist, in the specified order. */
D(("About to load filelist from filen"));
filelist = gib_list_cat(filelist, feh_read_filelist(opt.filelistfile));
}
D(("Options parsedn"));
filelist_len = gib_list_length(filelist);
if (!filelist_len)
show_mini_usage();
check_options();
feh_prepare_filelist();
return;
}
63. int main(int argc, char **argv)
{
atexit(feh_clean_exit);
setup_signal_handlers();
init_parse_options(argc, argv);
init_imlib_fonts();
if (opt.display) {
init_x_and_imlib();
init_keyevents();
init_buttonbindings();
}
feh_event_init();
if (opt.index)
init_index_mode();
else if (opt.collage)
init_collage_mode();
else if (opt.multiwindow)
init_multiwindow_mode();
else if (opt.list || opt.customlist)
init_list_mode();
else if (opt.loadables)
init_loadables_mode();
else if (opt.unloadables)
init_unloadables_mode();
else if (opt.thumbs)
init_thumbnail_mode();
else if (opt.bgmode) {
feh_wm_set_bg_filelist(opt.bgmode);
exit(0);
}
else {
/* Slideshow mode is the default. Because it's spiffy */
opt.slideshow = 1;
init_slideshow_mode();
}
/* main event loop */
while (feh_main_iteration(1));
return(0);
}
optの値を見て
モード設定するだけ。
src/main.c
64. int main(int argc, char **argv)
{
atexit(feh_clean_exit);
setup_signal_handlers();
init_parse_options(argc, argv);
init_imlib_fonts();
if (opt.display) {
init_x_and_imlib();
init_keyevents();
init_buttonbindings();
}
feh_event_init();
if (opt.index)
init_index_mode();
else if (opt.collage)
init_collage_mode();
else if (opt.multiwindow)
init_multiwindow_mode();
else if (opt.list || opt.customlist)
init_list_mode();
else if (opt.loadables)
init_loadables_mode();
else if (opt.unloadables)
init_unloadables_mode();
else if (opt.thumbs)
init_thumbnail_mode();
else if (opt.bgmode) {
feh_wm_set_bg_filelist(opt.bgmode);
exit(0);
}
else {
/* Slideshow mode is the default. Because it's spiffy */
opt.slideshow = 1;
init_slideshow_mode();
}
/* main event loop */
while (feh_main_iteration(1));
return(0);
}
メインループ
src/main.c