Bläddra i källkod

* 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".
tags/v0.99.beta14
Sam Hocevar sam 21 år sedan
förälder
incheckning
a51d8843b2
4 ändrade filer med 39 tillägg och 0 borttagningar
  1. +3
    -0
      NOTES
  2. +3
    -0
      examples/cacaview.c
  3. +1
    -0
      src/caca.h
  4. +32
    -0
      src/graphics.c

+ 3
- 0
NOTES Visa fil

@@ -196,3 +196,6 @@ $Id$
o Win32: we use GetConsoleScreenBufferInfo etc. There is an interesting
tutorial here: http://www.adrianxw.dk/SoftwareSite/index.html

o Set terminal window title:
http://mail.gnome.org/archives/mc-devel/2003-January/msg00101.html


+ 3
- 0
examples/cacaview.c Visa fil

@@ -84,6 +84,9 @@ int main(int argc, char **argv)
return 1;
}

/* Set the window title */
caca_set_title("cacaview");

/* Load items into playlist */
for(i = 1; i < argc; i++)
{


+ 1
- 0
src/caca.h Visa fil

@@ -245,6 +245,7 @@ char const *caca_get_feature_name(enum caca_feature);
unsigned int caca_get_rendertime(void);
unsigned int caca_get_width(void);
unsigned int caca_get_height(void);
int caca_set_title(char const *);
void caca_refresh(void);
void caca_end(void);
/* @} */


+ 32
- 0
src/graphics.c Visa fil

@@ -937,6 +937,38 @@ int _caca_end_graphics(void)
}
#endif /* _DOXYGEN_SKIP_ME */

/** \brief Set the window title.
*
* If libcaca runs in a window, try to change its title. This works with
* the X11 and Win32 drivers.
*
* \param title The desired window title.
* \return 0 upon success, a non-zero value if an error occurs.
*/
int caca_set_title(char const *title)
{
#if defined(USE_X11)
if(_caca_driver == CACA_DRIVER_X11)
{
XStoreName(x11_dpy, x11_window, title);
}
else
#endif
#if defined(USE_WIN32)
if(_caca_driver == CACA_DRIVER_WIN32)
{
SetConsoleTitle(title);
}
else
#endif
{
/* Not supported */
return -1;
}

return 0;
}

/** \brief Set the refresh delay.
*
* This function sets the refresh delay in microseconds. The refresh delay


Laddar…
Avbryt
Spara