Changeset 343


Ignore:
Timestamp:
Jan 12, 2004, 6:30:09 PM (17 years ago)
Author:
Sam Hocevar
Message:
  • src/graphics.c: + Implemented caca_set_title() for X11 and Win32.
  • examples/cacaview.c: + Use caca_set_title() to set the window title to "cacaview".
Location:
libcaca/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/NOTES

    r336 r343  
    197197      tutorial here: http://www.adrianxw.dk/SoftwareSite/index.html
    198198
     199   o  Set terminal window title:
     200      http://mail.gnome.org/archives/mc-devel/2003-January/msg00101.html
     201
  • libcaca/trunk/examples/cacaview.c

    r337 r343  
    8585    }
    8686
     87    /* Set the window title */
     88    caca_set_title("cacaview");
     89
    8790    /* Load items into playlist */
    8891    for(i = 1; i < argc; i++)
  • libcaca/trunk/src/caca.h

    r332 r343  
    246246unsigned int caca_get_width(void);
    247247unsigned int caca_get_height(void);
     248int caca_set_title(char const *);
    248249void caca_refresh(void);
    249250void caca_end(void);
  • libcaca/trunk/src/graphics.c

    r336 r343  
    938938#endif /* _DOXYGEN_SKIP_ME */
    939939
     940/** \brief Set the window title.
     941 *
     942 *  If libcaca runs in a window, try to change its title. This works with
     943 *  the X11 and Win32 drivers.
     944 *
     945 *  \param title The desired window title.
     946 *  \return 0 upon success, a non-zero value if an error occurs.
     947 */
     948int caca_set_title(char const *title)
     949{
     950#if defined(USE_X11)
     951    if(_caca_driver == CACA_DRIVER_X11)
     952    {
     953        XStoreName(x11_dpy, x11_window, title);
     954    }
     955    else
     956#endif
     957#if defined(USE_WIN32)
     958    if(_caca_driver == CACA_DRIVER_WIN32)
     959    {
     960        SetConsoleTitle(title);
     961    }
     962    else
     963#endif
     964    {
     965        /* Not supported */
     966        return -1;
     967    }
     968
     969    return 0;
     970}
     971
    940972/** \brief Set the refresh delay.
    941973 *
Note: See TracChangeset for help on using the changeset viewer.