+ 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
@@ -196,3 +196,6 @@ $Id$ | |||||
o Win32: we use GetConsoleScreenBufferInfo etc. There is an interesting | o Win32: we use GetConsoleScreenBufferInfo etc. There is an interesting | ||||
tutorial here: http://www.adrianxw.dk/SoftwareSite/index.html | 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 | |||||
@@ -84,6 +84,9 @@ int main(int argc, char **argv) | |||||
return 1; | return 1; | ||||
} | } | ||||
/* Set the window title */ | |||||
caca_set_title("cacaview"); | |||||
/* Load items into playlist */ | /* Load items into playlist */ | ||||
for(i = 1; i < argc; i++) | for(i = 1; i < argc; i++) | ||||
{ | { | ||||
@@ -245,6 +245,7 @@ char const *caca_get_feature_name(enum caca_feature); | |||||
unsigned int caca_get_rendertime(void); | unsigned int caca_get_rendertime(void); | ||||
unsigned int caca_get_width(void); | unsigned int caca_get_width(void); | ||||
unsigned int caca_get_height(void); | unsigned int caca_get_height(void); | ||||
int caca_set_title(char const *); | |||||
void caca_refresh(void); | void caca_refresh(void); | ||||
void caca_end(void); | void caca_end(void); | ||||
/* @} */ | /* @} */ | ||||
@@ -937,6 +937,38 @@ int _caca_end_graphics(void) | |||||
} | } | ||||
#endif /* _DOXYGEN_SKIP_ME */ | #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. | /** \brief Set the refresh delay. | ||||
* | * | ||||
* This function sets the refresh delay in microseconds. The refresh delay | * This function sets the refresh delay in microseconds. The refresh delay | ||||