Ignore:
Timestamp:
Jun 18, 2008, 3:47:59 PM (14 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added an ugly-not-finished-yet screensaver
File:
1 edited

Legend:

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

    r2445 r2447  
    7474    int i, w, h, args, s=0;
    7575    int eof = 0, refresh = 1, command = 0;
     76    long long unsigned int last_key_time = 0;
    7677
    7778    default_shell = getenv("SHELL");
     
    121122    screen_list->pty = screen_list->prevpty = 0;
    122123    screen_list->dont_update_coords = 0;
     124    screen_list->screensaver_timeout = (10) * 1000000;
     125
    123126
    124127    recurrent_list = (struct recurrent_list*) malloc(sizeof(struct recurrent_list));
     
    184187    /* Windows are in a temporary state, resize them to the right dimensions */
    185188    update_windows_props(cv, screen_list);
     189
     190    last_key_time = get_ms();
     191
     192    /* Refresh */
    186193    caca_refresh_display(dp);
    187194
     
    281288                }
    282289            }
     290            last_key_time = get_ms();
     291            caca_set_cursor(dp, 1);
    283292        }
    284293        else if(ret && (caca_get_event_type(&ev) & CACA_EVENT_RESIZE))
     
    315324
    316325        /* Resfresh screen */
    317         if(refresh || screen_list->in_bell)
     326        if((refresh || screen_list->in_bell) &&
     327           (get_ms() - last_key_time < screen_list->screensaver_timeout))
    318328        {
    319329            refresh = 0;
    320330            refresh_screens(cv, dp, screen_list);
     331        }
     332        if((get_ms() - last_key_time > screen_list->screensaver_timeout))
     333        {
     334            caca_set_cursor(dp, 0);
     335            draw_screensaver(cv, dp, screen_list);
     336            caca_refresh_display(dp);
    321337        }
    322338
Note: See TracChangeset for help on using the changeset viewer.