Changeset 4014 for neercs


Ignore:
Timestamp:
Nov 23, 2009, 11:46:29 AM (10 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Moved caca_set_color(RED... to the right place
  • Added configuration option "border", which toggles, erm, borders.
Location:
neercs/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/configuration.c

    r4001 r4014  
    3737int set_delay(const char *argv, struct screen_list *screen_list);
    3838int set_eyecandy(const char *argv, struct screen_list *screen_list);
    39 char*  get_window_manager(struct screen_list *screen_list);
    40 char*  get_cube_duration(struct screen_list *screen_list);
    41 char*  get_thumbnails(struct screen_list *screen_list);
    42 char*  get_status_bar(struct screen_list *screen_list);
    43 char*  get_screensaver_timeout(struct screen_list *screen_list);
    44 char*  get_autolock_timeout(struct screen_list *screen_list);
    45 char*  get_lock_on_detach(struct screen_list *screen_list);
    46 char*  get_socket_dir(struct screen_list *screen_list);
    47 char*  get_delay(struct screen_list *screen_list);
    48 char*  get_eyecandy(struct screen_list *screen_list);
     39int set_border(const char *argv, struct screen_list *screen_list);
     40char *get_window_manager(struct screen_list *screen_list);
     41char *get_cube_duration(struct screen_list *screen_list);
     42char *get_thumbnails(struct screen_list *screen_list);
     43char *get_status_bar(struct screen_list *screen_list);
     44char *get_screensaver_timeout(struct screen_list *screen_list);
     45char *get_autolock_timeout(struct screen_list *screen_list);
     46char *get_lock_on_detach(struct screen_list *screen_list);
     47char *get_socket_dir(struct screen_list *screen_list);
     48char *get_delay(struct screen_list *screen_list);
     49char *get_eyecandy(struct screen_list *screen_list);
     50char *get_border(struct screen_list *screen_list);
    4951
    5052/* Options definition and associated function pointer */
    5153struct config_line config_option[] = {
    52     {.name = "window_manager",.set = set_window_manager, .get = get_window_manager},
    53     {.name = "eyecandy",.set = set_eyecandy, .get = get_eyecandy},
    54     {.name = "cube_duration",.set = set_cube_duration, .get = get_window_manager},
    55     {.name = "thumbnails",.set = set_thumbnails, .get = get_window_manager},
    56     {.name = "status_bar",.set = set_status_bar, .get = get_window_manager},
    57     {.name = "screensaver_timeout",.set = set_screensaver_timeout, .get = get_window_manager},
    58     {.name = "autolock_timeout",.set = set_autolock_timeout, .get = get_window_manager},
    59     {.name = "lock_on_detach",.set = set_lock_on_detach, .get = get_window_manager},
    60     {.name = "socket_dir",.set = set_socket_dir, .get = get_window_manager},
    61     {.name = "delay",.set = set_delay, .get = NULL},
    62    
     54    {.name = "window_manager",.set = set_window_manager,.get =
     55     get_window_manager},
     56    {.name = "eyecandy",.set = set_eyecandy,.get = get_eyecandy},
     57    {.name = "borders",.set = set_border,.get = get_border},
     58    {.name = "cube_duration",.set = set_cube_duration,.get =
     59     get_window_manager},
     60    {.name = "thumbnails",.set = set_thumbnails,.get = get_window_manager},
     61    {.name = "status_bar",.set = set_status_bar,.get = get_window_manager},
     62    {.name = "screensaver_timeout",.set = set_screensaver_timeout,.get =
     63     get_window_manager},
     64    {.name = "autolock_timeout",.set = set_autolock_timeout,.get =
     65     get_window_manager},
     66    {.name = "lock_on_detach",.set = set_lock_on_detach,.get =
     67     get_window_manager},
     68    {.name = "socket_dir",.set = set_socket_dir,.get = get_window_manager},
     69    {.name = "delay",.set = set_delay,.get = NULL},
     70
    6371    {.name = "last",.set = NULL},
    6472};
     
    344352        if (c)
    345353        {
    346             c->set((const char*)option->value, screen_list);
     354            c->set((const char *)option->value, screen_list);
    347355        }
    348356        option = option->next;
     
    390398        screen_list->mini = 0;
    391399    return 0;
    392    
     400
    393401}
    394402
     
    414422{
    415423    if (screen_list->autolock_timeout == 0 ||
    416         screen_list->autolock_timeout ==
    417         ((long long unsigned int)0) - 1)
     424        screen_list->autolock_timeout == ((long long unsigned int)0) - 1)
    418425    {
    419426        screen_list->autolock_timeout = atoi(argv) * 1000000;
     
    443450}
    444451
     452int set_border(const char *argv, struct screen_list *screen_list)
     453{
     454    if (IS_OPTION("true") || IS_OPTION("1"))
     455        screen_list->border_size = 1;
     456    else
     457        screen_list->border_size = 0;
     458    return 0;
     459}
     460
    445461int set_socket_dir(const char *argv, struct screen_list *screen_list)
    446462{
    447463    screen_list->socket_dir = strdup(argv);
    448         return 0;
     464    return 0;
    449465}
    450466
     
    453469    screen_list->requested_delay = atoi(argv);
    454470    screen_list->delay = atoi(argv);
    455         return 0;
    456 }
    457 
    458 char* get_window_manager(struct screen_list *screen_list)
    459 {
    460     switch(screen_list->wm_type)
    461     {
    462         case WM_FULL:
    463             return "full";
    464         case WM_CARD:
    465             return "card";
    466         case WM_VSPLIT:
    467             return "vsplit";
    468         case WM_HSPLIT:
    469             return "hsplit";
    470         default:
    471             return "invalid";
    472     }
    473     return NULL; /* Not reached */
    474 }
    475 
    476 charget_cube_duration(struct screen_list *screen_list)
     471    return 0;
     472}
     473
     474char *get_window_manager(struct screen_list *screen_list)
     475{
     476    switch (screen_list->wm_type)
     477    {
     478    case WM_FULL:
     479        return "full";
     480    case WM_CARD:
     481        return "card";
     482    case WM_VSPLIT:
     483        return "vsplit";
     484    case WM_HSPLIT:
     485        return "hsplit";
     486    default:
     487        return "invalid";
     488    }
     489    return NULL;                /* Not reached */
     490}
     491
     492char *get_cube_duration(struct screen_list *screen_list)
    477493{
    478494    char *r = malloc(100);
    479     sprintf(r, "%f", (float)screen_list->cube.duration/1000000.0f);
     495    sprintf(r, "%f", (float)screen_list->cube.duration / 1000000.0f);
    480496    return r;
    481497}
    482498
    483 char*  get_thumbnails(struct screen_list *screen_list)
    484 {
    485     if(screen_list->mini) return "yes";
     499char *get_thumbnails(struct screen_list *screen_list)
     500{
     501    if (screen_list->mini)
     502        return "yes";
    486503    return "no";
    487504}
    488505
    489 char*  get_status_bar(struct screen_list *screen_list)
    490 {
    491     if(screen_list->status) return "yes";
     506char *get_status_bar(struct screen_list *screen_list)
     507{
     508    if (screen_list->status)
     509        return "yes";
    492510    return "no";
    493511}
    494512
    495 char*  get_eyecandy(struct screen_list *screen_list)
    496 {
    497     if(screen_list->eyecandy) return "yes";
     513char *get_eyecandy(struct screen_list *screen_list)
     514{
     515    if (screen_list->eyecandy)
     516        return "yes";
    498517    return "no";
    499518}
    500519
    501 char*  get_screensaver_timeout(struct screen_list *screen_list)
     520char *get_border(struct screen_list *screen_list)
     521{
     522    if (screen_list->border_size)
     523        return "yes";
     524    return "no";
     525}
     526
     527char *get_screensaver_timeout(struct screen_list *screen_list)
    502528{
    503529    char *r = malloc(100);
    504     sprintf(r, "%f", (float)screen_list->screensaver_timeout/1000000.0f);
    505     return r; 
    506 }
    507 
    508 charget_autolock_timeout(struct screen_list *screen_list)
     530    sprintf(r, "%f", (float)screen_list->screensaver_timeout / 1000000.0f);
     531    return r;
     532}
     533
     534char *get_autolock_timeout(struct screen_list *screen_list)
    509535{
    510536    char *r = malloc(100);
    511     sprintf(r, "%f", (float)screen_list->autolock_timeout/1000000.0f);
     537    sprintf(r, "%f", (float)screen_list->autolock_timeout / 1000000.0f);
    512538    return r;
    513539}
    514540
    515 char*  get_lock_on_detach(struct screen_list *screen_list)
    516 {
    517     if(screen_list->lock_on_detach) return "yes";
    518     else return "no";
    519 }
    520 
    521 char*  get_socket_dir(struct screen_list *screen_list)
     541char *get_lock_on_detach(struct screen_list *screen_list)
     542{
     543    if (screen_list->lock_on_detach)
     544        return "yes";
     545    else
     546        return "no";
     547}
     548
     549char *get_socket_dir(struct screen_list *screen_list)
    522550{
    523551    return screen_list->socket_dir;
    524552}
    525553
    526 charget_delay(struct screen_list *screen_list)
     554char *get_delay(struct screen_list *screen_list)
    527555{
    528556    char *r = malloc(100);
     
    530558    return r;
    531559}
    532 
    533 
    534 
  • neercs/trunk/src/neercs.h

    r4000 r4014  
    148148    int wm_type;                 /* Window manager type */
    149149    int in_bell;                 /* Bell occuring in a window  */
     150    int was_in_bell;
    150151    int dont_update_coords;      /* Used by recurrents */
    151152    int changed;                 /* Global redraw needed (e.g. adding a screen) */
    152153    int delay;                   /* Minimal time between two refresh (ms) */
    153154    int force_refresh;
     155    int command;
    154156    long long unsigned int last_key_time;
    155     int command;
    156     int was_in_bell;
    157157    long long unsigned int last_refresh_time;
    158158
     
    178178    int status;                  /* Status bar */
    179179    int help;                    /* Help */
     180    int border_size;             /* Borders */
    180181    int window_list;             /* Window list */
    181182    int cur_in_list;             /* Window list */
  • neercs/trunk/src/screen_list.c

    r4000 r4014  
    6060    screen_list->status = 1;
    6161    screen_list->eyecandy = 1;
     62    screen_list->border_size = 0;
    6263    screen_list->title = NULL;
    6364    screen_list->window_list = 0;
  • neercs/trunk/src/screens.c

    r3970 r4014  
    205205        caca_clear_canvas(screen_list->cv);
    206206    }
    207     caca_set_color_ansi(screen_list->cv, CACA_LIGHTRED, CACA_BLACK);
    208207
    209208    wm_refresh(screen_list);
  • neercs/trunk/src/wm.c

    r4008 r4014  
    8686{
    8787    int i;
    88     int w = (screen_list->width / screen_list->count) - 1;
    89     int h = screen_list->height - 2;
     88    int w =
     89        (screen_list->width / screen_list->count) -
     90        (screen_list->border_size * 2);
     91    int h = screen_list->height - (screen_list->border_size * 2);
    9092
    9193    for (i = 0; i < screen_list->count; i++)
    9294    {
    93         screen_list->screen[i]->x = (i * w) + 1;
    94         screen_list->screen[i]->y = 1;
     95        screen_list->screen[i]->x = (i * w) + screen_list->border_size;
     96        screen_list->screen[i]->y = screen_list->border_size;
    9597        screen_list->screen[i]->visible = 1;
    9698        if (i != screen_list->count - 1)
     
    109111{
    110112    int i;
    111     int w = screen_list->width - 2;
     113    int w = screen_list->width - (screen_list->border_size * 2);
    112114    int h = (screen_list->height) / screen_list->count;
    113115
    114116    for (i = 0; i < screen_list->count; i++)
    115117    {
    116         screen_list->screen[i]->x = 1;
    117         screen_list->screen[i]->y = (i * h) + 1;
     118        screen_list->screen[i]->x = screen_list->border_size;
     119        screen_list->screen[i]->y = (i * h) + (screen_list->border_size);
    118120        screen_list->screen[i]->visible = 1;
    119121        if (i != screen_list->count - 1)
    120122        {
    121             resize_screen(screen_list->screen[i], w, h - 2);
     123            resize_screen(screen_list->screen[i], w,
     124                          h - (screen_list->border_size * 2));
    122125        }
    123126        else
    124127        {
    125128            resize_screen(screen_list->screen[i],
    126                           w, screen_list->height - i * h - 2);
     129                          w,
     130                          screen_list->height - i * h -
     131                          (screen_list->border_size * 2));
    127132        }
    128133    }
     
    133138{
    134139    int i;
    135     int w = screen_list->width - 2;
    136     int h = screen_list->height - 2;
     140    int w = screen_list->width - (screen_list->border_size * 2);
     141    int h = screen_list->height - (screen_list->border_size * 2);
    137142
    138143    for (i = 0; i < screen_list->count; i++)
    139144    {
    140145        screen_list->screen[i]->visible = 0;
    141         screen_list->screen[i]->x = 1;
    142         screen_list->screen[i]->y = 1;
     146        screen_list->screen[i]->x = screen_list->border_size;
     147        screen_list->screen[i]->y = screen_list->border_size;
    143148
    144149        resize_screen(screen_list->screen[i], w, h);
     
    172177void wm_refresh(struct screen_list *screen_list)
    173178{
     179    /* FIXME : move set_color to a relevant place */
     180    caca_set_color_ansi(screen_list->cv, CACA_LIGHTRED, CACA_BLACK);
     181
    174182    switch (screen_list->wm_type)
    175183    {
     
    207215{
    208216    /* FIXME drawing the box and rewriting the title creates a dirty rectangle
    209      * for the title, even when nothing changed, triggering useless traffic
    210      * between server and client.
    211      */
     217       for the title, even when nothing changed, triggering useless traffic
     218       between server and client. */
     219    if (!screen_list->border_size)
     220        return;
     221
    212222    caca_draw_cp437_box(screen_list->cv,
    213223                        screen_list->screen[pty]->x - 1,
     
    253263        }
    254264    }
    255        
     265
    256266    /* Force 'changed' to force redraw */
    257267    screen_list->screen[screen_list->pty]->changed = 1;
     
    381391{
    382392    int i;
    383    
     393
    384394    if (!screen_list->cube.in_switch || !screen_list->eyecandy)
    385395    {
Note: See TracChangeset for help on using the changeset viewer.