Changeset 2447 for neercs


Ignore:
Timestamp:
Jun 18, 2008, 3:47:59 PM (12 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added an ugly-not-finished-yet screensaver
Location:
neercs/trunk/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • neercs/trunk/src/Makefile.am

    r2445 r2447  
    77endif
    88
    9 neercs_SOURCES = neercs.h $(grab_c) mygetopt.c recurrent.c main.c screens.c term.c effects.c wm.c
     9neercs_SOURCES = neercs.h $(grab_c) mygetopt.c recurrent.c main.c screens.c term.c effects.c wm.c screensaver.c
    1010neercs_CFLAGS = @CACA_CFLAGS@
    1111neercs_LDADD = @CACA_LIBS@ @UTIL_LIBS@
  • 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
  • neercs/trunk/src/neercs.h

    r2446 r2447  
    6666    int status;                  /* Status bar */
    6767    int help;                    /* help */
     68    long long unsigned int screensaver_timeout;     /* Screensaver timeout in us */
     69
    6870
    6971    int pty, prevpty;            /* Current and previous window */
     
    133135
    134136
     137/* Screensavers */
     138void draw_screensaver(cucul_canvas_t *cv,
     139                      caca_display_t *dp,
     140                      struct screen_list *screen_list);
     141void screensaver_flying_toasters(cucul_canvas_t *cv,
     142                                 caca_display_t *dp,
     143                                 struct screen_list *screen_list);
     144
     145
    135146/* Recurrents */
    136147int add_recurrent(struct recurrent_list *list,
Note: See TracChangeset for help on using the changeset viewer.