Ignore:
Timestamp:
Nov 14, 2006, 12:33:49 AM (13 years ago)
Author:
Sam Hocevar
Message:
  • Implemented caca_set_display_title() for ncurses and S-Lang.
Location:
libcaca/trunk/caca
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver_ncurses.c

    r1333 r1391  
    6060static void ncurses_check_terminal(void);
    6161#endif
     62static void ncurses_set_title(char const *);
    6263static void ncurses_write_utf32(uint32_t);
    6364
     
    110111#endif
    111112
     113    ncurses_set_title("caca for ncurses");
     114
    112115    initscr();
    113116    keypad(stdscr, TRUE);
     
    167170static int ncurses_end_graphics(caca_display_t *dp)
    168171{
     172    ncurses_set_title("");
    169173    mousemask(dp->drv.p->oldmask, NULL);
    170174    curs_set(1);
     
    179183static int ncurses_set_display_title(caca_display_t *dp, char const *title)
    180184{
    181     return -1;
     185    ncurses_set_title(title);
     186
     187    return 0;
    182188}
    183189
     
    430436#endif
    431437
     438static void ncurses_set_title(char const *str)
     439{
     440    fprintf(stdout, "\x1b]0;%s\x07\n", str);
     441    fflush(stdout);
     442}
     443
    432444static void ncurses_write_utf32(uint32_t ch)
    433445{
  • libcaca/trunk/caca/driver_slang.c

    r1333 r1391  
    104104 */
    105105static void slang_init_palette(void);
     106static void slang_set_title(char const *);
    106107static void slang_write_utf32(uint32_t);
    107108
     
    124125    signal(SIGWINCH, sigwinch_handler);
    125126#endif
     127
     128    slang_set_title("caca for S-Lang");
    126129
    127130    /* Initialise slang library */
     
    173176static int slang_end_graphics(caca_display_t *dp)
    174177{
     178    slang_set_title("");
    175179    SLtt_set_mouse_mode(0, 0);
    176180    SLtt_set_cursor_visibility(1);
     
    183187static int slang_set_display_title(caca_display_t *dp, char const *title)
    184188{
    185     /* FIXME */
    186     return -1;
     189    slang_set_title(title);
     190
     191    return 0;
    187192}
    188193
     
    443448}
    444449
     450static void slang_set_title(char const *str)
     451{
     452    fprintf(stdout, "\x1b]0;%s\x07\n", str);
     453    fflush(stdout);
     454}
     455
    445456static void slang_write_utf32(uint32_t ch)
    446457{
  • libcaca/trunk/caca/graphics.c

    r1362 r1391  
    2727 *
    2828 *  If libcaca runs in a window, try to change its title. This works with
    29  *  the OpenGL, X11 and Win32 drivers.
     29 *  the ncurses, S-Lang, OpenGL, X11 and Win32 drivers.
    3030 *
    3131 *  If an error occurs, -1 is returned and \b errno is set accordingly:
Note: See TracChangeset for help on using the changeset viewer.