Changeset 3998


Ignore:
Timestamp:
Nov 22, 2009, 3:06:26 PM (11 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Moved help code to help.c
  • Fixed bad string handling in configuration
Location:
neercs/trunk/src
Files:
1 added
5 edited

Legend:

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

    r3973 r3998  
    55                 term.c grab.c effects.c wm.c screensaver.c attach.c \
    66                 configuration.c mytrace.c mytrace.h input.c lock.c server.c \
    7                  client.c screen_list.c               
     7                 client.c screen_list.c help.c             
    88neercs_CFLAGS = @CACA_CFLAGS@
    99neercs_LDADD = @CACA_LIBS@ @UTIL_LIBS@ @PAM_LIBS@
  • neercs/trunk/src/configuration.c

    r3997 r3998  
    344344        if (c)
    345345        {
    346             printf("Found config '%s', ptr %p\n", c->name, c->func_ptr);
    347346            c->func_ptr(option->value, screen_list);
    348347        }
     
    439438int set_socket_dir(const char *argv, struct screen_list *screen_list)
    440439{
    441     screen_list->socket_dir = argv;
     440    screen_list->socket_dir = strdup(argv);
    442441        return 0;
    443442}
  • neercs/trunk/src/effects.c

    r3996 r3998  
    182182
    183183
    184 void draw_help(struct screen_list *screen_list)
    185 {
    186     int w = 65, h = 20;
    187     int x = (caca_get_canvas_width(screen_list->cv) - w) / 2;
    188     int y = (caca_get_canvas_height(screen_list->cv) - h) / 2;
    189 
    190 
    191     caca_set_color_ansi(screen_list->cv, CACA_BLUE, CACA_BLUE);
    192     caca_fill_box(screen_list->cv, x, y, w, h, '#');
    193     caca_set_color_ansi(screen_list->cv, CACA_DEFAULT, CACA_BLUE);
    194     caca_draw_cp437_box(screen_list->cv, x, y, w, h);
    195 
    196     x += 2;
    197     y++;
    198     caca_printf(screen_list->cv,
    199                 (caca_get_canvas_width(screen_list->cv) -
    200                  strlen(PACKAGE_STRING)) / 2, y - 1, PACKAGE_STRING);
    201     caca_printf(screen_list->cv, x, y++, "Copyright (c) 2006-2009");
    202     caca_printf(screen_list->cv, x, y++, "              Sam Hocevar <sam@zoy.org>");
    203     caca_printf(screen_list->cv, x, y++, "              Jean-Yves Lamoureux <jylam@lnxscene.org>");
    204     caca_printf(screen_list->cv, x, y++, "              Pascal Terjan <pterjan@linuxfr.org>");
    205     caca_printf(screen_list->cv, x, y++, "");
    206     caca_printf(screen_list->cv, x, y++, "");
    207     caca_printf(screen_list->cv, x, y++, "All shortcuts are in format 'ctrl-a-X' where X is :");
    208     caca_printf(screen_list->cv, x, y++, "n:\t Next window");
    209     caca_printf(screen_list->cv, x, y++, "p:\t Previous window");
    210     caca_printf(screen_list->cv, x, y++, "w:\t Switch window manager");
    211     caca_printf(screen_list->cv, x, y++, "c:\t Create new window");
    212     caca_printf(screen_list->cv, x, y++, "m:\t Thumbnails");
    213     caca_printf(screen_list->cv, x, y++, "d:\t Detach");
    214     caca_printf(screen_list->cv, x, y++, "k:\t Close window and kill associated process");
    215     caca_printf(screen_list->cv, x, y++, "h:\t This help");
    216     caca_printf(screen_list->cv, x, y++, "");
    217     caca_printf(screen_list->cv, x, y++, "");
    218     caca_printf(screen_list->cv, x, y++, "See http://caca.zoy.org/wiki/neercs for more informations");
    219 }
    220184
    221185int update_window_list(int c, struct screen_list *screen_list)
  • neercs/trunk/src/neercs.h

    r3974 r3998  
    298298void draw_status(struct screen_list *screen_list);
    299299void draw_help(struct screen_list *screen_list);
     300int help_handle_key(struct screen_list *screen_list, unsigned int c);
    300301int update_window_list(int c, struct screen_list *screen_list);
    301302void draw_list(struct screen_list *screen_list);
  • neercs/trunk/src/server.c

    r3974 r3998  
    454454       CTRL-A a sends literal CTRL-A */
    455455
    456 
    457456    if (screen_list->help)
    458457    {
    459         if (c == CACA_KEY_ESCAPE || c == 'h')
    460         {
    461             screen_list->help = 0;
    462             screen_list->changed = 1;
    463             refresh = 1;
    464             return 1;
    465         }
    466         else
    467         {
    468             return 0;
    469         }
     458        return help_handle_key(screen_list, c); 
    470459    }
    471460
Note: See TracChangeset for help on using the changeset viewer.