Changeset 2484


Ignore:
Timestamp:
06/24/08 16:13:18 (5 years ago)
Author:
jylam
Message:
  • Factorized multiple calls of caca_refresh_display()
  • Configuration file is now /etc/neercs.conf and ~/.neercsrc
Location:
neercs/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/man/neercs.1

    r2472 r2484  
    1111($SHELL environment variable). 
    1212.PP 
    13 \fBneercs\fR will search for a configuration file called \fBneercs.ini\fR in 
    14 the current directory, your home directory, and /etc (in that order). 
     13\fBneercs\fR will search for a configuration file called /etc/neercs.conf, then \fB.neercsrc\fR in 
     14your home directory (in that order). 
    1515.SH EXAMPLES 
    1616.PP 
  • neercs/trunk/src/main.c

    r2481 r2484  
    2828#include <sys/time.h> 
    2929#include <time.h> 
     30#include <pwd.h> 
     31 
    3032 
    3133#if !defined HAVE_GETOPT_LONG 
     
    7880    struct screen_list *screen_list = NULL; 
    7981    struct recurrent_list *recurrent_list = NULL; 
    80     char *default_shell = NULL; 
     82    struct passwd *user_info; 
     83    char *default_shell = NULL, *user_path = NULL; 
    8184    int i, w, h, args, s=0; 
    8285    int eof = 0, refresh = 1, command = 0; 
     
    133136    memset(screen_list->lockpass, 0, 1024); 
    134137 
    135     if(!read_configuration_file("neercs.ini", screen_list)) 
    136     { 
    137  
    138         if(!read_configuration_file("~/neercs.ini", screen_list)) 
    139         { 
    140             if(!read_configuration_file("/etc/neercs.ini", screen_list)) 
    141             { 
    142                 printf("Failed to read configuration file\n"); 
    143             } 
    144         } 
    145     } 
     138 
     139    /* Read global configuration first */ 
     140    read_configuration_file("/etc/neercs.conf", screen_list); 
     141 
     142    /* Then local one  */ 
     143    user_info = getpwuid(getuid()); 
     144    if(user_info) 
     145    { 
     146        user_path = malloc(strlen(user_info->pw_dir) + strlen("/.neercsrc") + 1); 
     147        sprintf(user_path, "%s/%s", user_info->pw_dir, ".neercsrc"); 
     148        read_configuration_file(user_path, screen_list); 
     149        free(user_path); 
     150    } 
     151 
    146152 
    147153    recurrent_list = (struct recurrent_list*) malloc(sizeof(struct recurrent_list)); 
     
    277283    last_key_time = get_us(); 
    278284 
    279     /* Refresh */ 
    280     caca_refresh_display(dp); 
    281285 
    282286    for(;;) 
     
    524528        { 
    525529            draw_lock(cv, screen_list); 
    526             caca_refresh_display(dp); 
     530            refresh = 1; 
    527531        } 
    528532        else 
     
    531535               (get_us() - last_key_time < screen_list->screensaver_timeout)) 
    532536            { 
    533                 refresh = 0; 
    534537                refresh_screens(cv, screen_list); 
    535538                if(screen_list->screen[screen_list->pty]->title) 
     
    537540                else 
    538541                    caca_set_display_title(dp, PACKAGE_STRING); 
    539                 caca_refresh_display(dp); 
     542                refresh = 1; 
     543 
    540544            } 
    541545 
     
    548552                caca_set_cursor(dp, 0); 
    549553                draw_screensaver(cv, dp, screen_list); 
    550                 caca_refresh_display(dp); 
    551             } 
     554                refresh = 1; 
     555            } 
     556        } 
     557 
     558        /* Refresh screen if needed */ 
     559        if(refresh) 
     560        { 
     561            caca_refresh_display(dp); 
     562            refresh = 0; 
    552563        } 
    553564 
     
    601612    free(recurrent_list->recurrent); 
    602613    free(recurrent_list); 
     614 
     615    free(user_path); 
     616 
    603617 
    604618    return mainret; 
  • neercs/trunk/src/neercs.ini

    r2465 r2484  
    1111[windows] 
    1212window_manager = hsplit   ; full card  hsplit vsplit 
     13status_bar = true         ; Activate status bar 
    1314 
    1415[eyecandy]                ; Not-that-useful stuff 
    15 thumbnails = true         ; Activate thumbnails 
    16 status_bar = true         ; Activate status bar 
     16thumbnails = false         ; Activate thumbnails 
    1717screensaver_timeout = 60  ; Screen Saver timeout in seconds, 0 to desactivate 
Note: See TracChangeset for help on using the changeset viewer.