From 1ec654430503b6cc61dcc9046a398420a9444389 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Wed, 19 Apr 2006 10:10:58 +0000 Subject: [PATCH] * More function mass-renaming: caca_attach -> caca_create_display, etc. --- caca/caca.c | 4 ++-- caca/caca.h | 12 ++++++------ caca/caca_internals.h | 6 +++--- caca/driver_conio.c | 12 ++++++------ caca/driver_gl.c | 12 ++++++------ caca/driver_ncurses.c | 12 ++++++------ caca/driver_raw.c | 12 ++++++------ caca/driver_slang.c | 12 ++++++------ caca/driver_vga.c | 12 ++++++------ caca/driver_win32.c | 12 ++++++------ caca/driver_x11.c | 12 ++++++------ caca/graphics.c | 44 +++++++++++++++++++++---------------------- cpp/caca++.cpp | 22 +++++++++++----------- cpp/caca++.h | 6 +++--- cucul/cucul.c | 8 ++++---- python/pypycaca.c | 18 +++++++++--------- python/pypycaca.h | 6 +++--- src/aafire.c | 6 +++--- src/cacaball.c | 6 +++--- src/cacamoir.c | 6 +++--- src/cacaplas.c | 6 +++--- src/cacaplay.c | 6 +++--- src/cacaview.c | 14 +++++++------- test/colors.c | 6 +++--- test/demo.c | 12 ++++++------ test/dithering.c | 6 +++--- test/event.c | 8 ++++---- test/font.c | 6 +++--- test/gamma.c | 6 +++--- test/hsv.c | 6 +++--- test/spritedit.c | 8 ++++---- test/transform.c | 6 +++--- test/truecolor.c | 6 +++--- test/unicode.c | 6 +++--- 34 files changed, 171 insertions(+), 171 deletions(-) diff --git a/caca/caca.c b/caca/caca.c index 351fc0e..3d250da 100644 --- a/caca/caca.c +++ b/caca/caca.c @@ -41,7 +41,7 @@ static int caca_init_driver(caca_display_t *dp); * \param cv The cucul cavas. * \return The caca graphical context or NULL if an error occurred. */ -caca_display_t * caca_attach(cucul_canvas_t * cv) +caca_display_t * caca_create_display(cucul_canvas_t * cv) { caca_display_t *dp = malloc(sizeof(caca_display_t)); @@ -100,7 +100,7 @@ caca_display_t * caca_attach(cucul_canvas_t * cv) * * \param dp The libcaca graphical context. */ -void caca_detach(caca_display_t *dp) +void caca_free_display(caca_display_t *dp) { dp->drv.end_graphics(dp); dp->cv->refcount--; diff --git a/caca/caca.h b/caca/caca.h index 66c8280..f74b2d5 100644 --- a/caca/caca.h +++ b/caca/caca.h @@ -203,14 +203,14 @@ enum caca_key * initialisation, system information retrieval and configuration. * * @{ */ -caca_display_t * caca_attach(cucul_canvas_t *); -void caca_detach(caca_display_t *); +caca_display_t * caca_create_display(cucul_canvas_t *); +void caca_free_display(caca_display_t *); void caca_set_delay(caca_display_t *, unsigned int); -void caca_display(caca_display_t *); +void caca_refresh_display(caca_display_t *); unsigned int caca_get_rendertime(caca_display_t *); -unsigned int caca_get_window_width(caca_display_t *); -unsigned int caca_get_window_height(caca_display_t *); -int caca_set_window_title(caca_display_t *, char const *); +unsigned int caca_get_display_width(caca_display_t *); +unsigned int caca_get_display_height(caca_display_t *); +int caca_set_display_title(caca_display_t *, char const *); /* @} */ /** \defgroup event Event handling diff --git a/caca/caca_internals.h b/caca/caca_internals.h index 435f66a..25437f3 100644 --- a/caca/caca_internals.h +++ b/caca/caca_internals.h @@ -103,9 +103,9 @@ struct caca_display int (* init_graphics) (caca_display_t *); int (* end_graphics) (caca_display_t *); - int (* set_window_title) (caca_display_t *, char const *); - unsigned int (* get_window_width) (caca_display_t *); - unsigned int (* get_window_height) (caca_display_t *); + int (* set_display_title) (caca_display_t *, char const *); + unsigned int (* get_display_width) (caca_display_t *); + unsigned int (* get_display_height) (caca_display_t *); void (* display) (caca_display_t *); void (* handle_resize) (caca_display_t *); int (* get_event) (caca_display_t *, caca_event_t *); diff --git a/caca/driver_conio.c b/caca/driver_conio.c index 2c9c5b1..5b1a431 100644 --- a/caca/driver_conio.c +++ b/caca/driver_conio.c @@ -76,18 +76,18 @@ static int conio_end_graphics(caca_display_t *dp) return 0; } -static int conio_set_window_title(caca_display_t *dp, char const *title) +static int conio_set_display_title(caca_display_t *dp, char const *title) { return 0; } -static unsigned int conio_get_window_width(caca_display_t *dp) +static unsigned int conio_get_display_width(caca_display_t *dp) { /* Fallback to a 6x10 font */ return dp->cv->width * 6; } -static unsigned int conio_get_window_height(caca_display_t *dp) +static unsigned int conio_get_display_height(caca_display_t *dp) { /* Fallback to a 6x10 font */ return dp->cv->height * 10; @@ -155,9 +155,9 @@ int conio_install(caca_display_t *dp) dp->drv.init_graphics = conio_init_graphics; dp->drv.end_graphics = conio_end_graphics; - dp->drv.set_window_title = conio_set_window_title; - dp->drv.get_window_width = conio_get_window_width; - dp->drv.get_window_height = conio_get_window_height; + dp->drv.set_display_title = conio_set_display_title; + dp->drv.get_display_width = conio_get_display_width; + dp->drv.get_display_height = conio_get_display_height; dp->drv.display = conio_display; dp->drv.handle_resize = conio_handle_resize; dp->drv.get_event = conio_get_event; diff --git a/caca/driver_gl.c b/caca/driver_gl.c index 39331e9..bb2b3fc 100644 --- a/caca/driver_gl.c +++ b/caca/driver_gl.c @@ -202,18 +202,18 @@ static int gl_end_graphics(caca_display_t *dp) return 0; } -static int gl_set_window_title(caca_display_t *dp, char const *title) +static int gl_set_display_title(caca_display_t *dp, char const *title) { glutSetWindowTitle(title); return 0; } -static unsigned int gl_get_window_width(caca_display_t *dp) +static unsigned int gl_get_display_width(caca_display_t *dp) { return dp->drv.p->width; } -static unsigned int gl_get_window_height(caca_display_t *dp) +static unsigned int gl_get_display_height(caca_display_t *dp) { return dp->drv.p->height; } @@ -501,9 +501,9 @@ int gl_install(caca_display_t *dp) dp->drv.init_graphics = gl_init_graphics; dp->drv.end_graphics = gl_end_graphics; - dp->drv.set_window_title = gl_set_window_title; - dp->drv.get_window_width = gl_get_window_width; - dp->drv.get_window_height = gl_get_window_height; + dp->drv.set_display_title = gl_set_display_title; + dp->drv.get_display_width = gl_get_display_width; + dp->drv.get_display_height = gl_get_display_height; dp->drv.display = gl_display; dp->drv.handle_resize = gl_handle_resize; dp->drv.get_event = gl_get_event; diff --git a/caca/driver_ncurses.c b/caca/driver_ncurses.c index 976f968..23ef42d 100644 --- a/caca/driver_ncurses.c +++ b/caca/driver_ncurses.c @@ -168,18 +168,18 @@ static int ncurses_end_graphics(caca_display_t *dp) return 0; } -static int ncurses_set_window_title(caca_display_t *dp, char const *title) +static int ncurses_set_display_title(caca_display_t *dp, char const *title) { return 0; } -static unsigned int ncurses_get_window_width(caca_display_t *dp) +static unsigned int ncurses_get_display_width(caca_display_t *dp) { /* Fallback to a 6x10 font */ return dp->cv->width * 6; } -static unsigned int ncurses_get_window_height(caca_display_t *dp) +static unsigned int ncurses_get_display_height(caca_display_t *dp) { /* Fallback to a 6x10 font */ return dp->cv->height * 10; @@ -534,9 +534,9 @@ int ncurses_install(caca_display_t *dp) dp->drv.init_graphics = ncurses_init_graphics; dp->drv.end_graphics = ncurses_end_graphics; - dp->drv.set_window_title = ncurses_set_window_title; - dp->drv.get_window_width = ncurses_get_window_width; - dp->drv.get_window_height = ncurses_get_window_height; + dp->drv.set_display_title = ncurses_set_display_title; + dp->drv.get_display_width = ncurses_get_display_width; + dp->drv.get_display_height = ncurses_get_display_height; dp->drv.display = ncurses_display; dp->drv.handle_resize = ncurses_handle_resize; dp->drv.get_event = ncurses_get_event; diff --git a/caca/driver_raw.c b/caca/driver_raw.c index 67828f2..a5ddcb8 100644 --- a/caca/driver_raw.c +++ b/caca/driver_raw.c @@ -36,17 +36,17 @@ static int raw_end_graphics(caca_display_t *dp) return 0; } -static int raw_set_window_title(caca_display_t *dp, char const *title) +static int raw_set_display_title(caca_display_t *dp, char const *title) { return 0; } -static unsigned int raw_get_window_width(caca_display_t *dp) +static unsigned int raw_get_display_width(caca_display_t *dp) { return 0; } -static unsigned int raw_get_window_height(caca_display_t *dp) +static unsigned int raw_get_display_height(caca_display_t *dp) { return 0; } @@ -83,9 +83,9 @@ int raw_install(caca_display_t *dp) dp->drv.init_graphics = raw_init_graphics; dp->drv.end_graphics = raw_end_graphics; - dp->drv.set_window_title = raw_set_window_title; - dp->drv.get_window_width = raw_get_window_width; - dp->drv.get_window_height = raw_get_window_height; + dp->drv.set_display_title = raw_set_display_title; + dp->drv.get_display_width = raw_get_display_width; + dp->drv.get_display_height = raw_get_display_height; dp->drv.display = raw_display; dp->drv.handle_resize = raw_handle_resize; dp->drv.get_event = raw_get_event; diff --git a/caca/driver_slang.c b/caca/driver_slang.c index af701bc..a381458 100644 --- a/caca/driver_slang.c +++ b/caca/driver_slang.c @@ -179,19 +179,19 @@ static int slang_end_graphics(caca_display_t *dp) return 0; } -static int slang_set_window_title(caca_display_t *dp, char const *title) +static int slang_set_display_title(caca_display_t *dp, char const *title) { /* FIXME */ return 0; } -static unsigned int slang_get_window_width(caca_display_t *dp) +static unsigned int slang_get_display_width(caca_display_t *dp) { /* Fallback to a 6x10 font */ return dp->cv->width * 6; } -static unsigned int slang_get_window_height(caca_display_t *dp) +static unsigned int slang_get_display_height(caca_display_t *dp) { /* Fallback to a 6x10 font */ return dp->cv->height * 10; @@ -472,9 +472,9 @@ int slang_install(caca_display_t *dp) dp->drv.init_graphics = slang_init_graphics; dp->drv.end_graphics = slang_end_graphics; - dp->drv.set_window_title = slang_set_window_title; - dp->drv.get_window_width = slang_get_window_width; - dp->drv.get_window_height = slang_get_window_height; + dp->drv.set_display_title = slang_set_display_title; + dp->drv.get_display_width = slang_get_display_width; + dp->drv.get_display_height = slang_get_display_height; dp->drv.display = slang_display; dp->drv.handle_resize = slang_handle_resize; dp->drv.get_event = slang_get_event; diff --git a/caca/driver_vga.c b/caca/driver_vga.c index 5cf41ba..d1d9d96 100644 --- a/caca/driver_vga.c +++ b/caca/driver_vga.c @@ -93,19 +93,19 @@ static int vga_end_graphics(caca_display_t *dp) return 0; } -static int vga_set_window_title(caca_display_t *dp, char const *title) +static int vga_set_display_title(caca_display_t *dp, char const *title) { /* Unsupported, of course. */ return 0; } -static unsigned int vga_get_window_width(caca_display_t *dp) +static unsigned int vga_get_display_width(caca_display_t *dp) { /* Fallback to a 320x200 screen */ return 320; } -static unsigned int vga_get_window_height(caca_display_t *dp) +static unsigned int vga_get_display_height(caca_display_t *dp) { /* Fallback to a 320x200 screen */ return 200; @@ -149,9 +149,9 @@ int vga_install(caca_display_t *dp) dp->drv.init_graphics = vga_init_graphics; dp->drv.end_graphics = vga_end_graphics; - dp->drv.set_window_title = vga_set_window_title; - dp->drv.get_window_width = vga_get_window_width; - dp->drv.get_window_height = vga_get_window_height; + dp->drv.set_display_title = vga_set_display_title; + dp->drv.get_display_width = vga_get_display_width; + dp->drv.get_display_height = vga_get_display_height; dp->drv.display = vga_display; dp->drv.handle_resize = vga_handle_resize; dp->drv.get_event = vga_get_event; diff --git a/caca/driver_win32.c b/caca/driver_win32.c index 9bca52c..a5b8078 100644 --- a/caca/driver_win32.c +++ b/caca/driver_win32.c @@ -162,13 +162,13 @@ static int win32_end_graphics(caca_display_t *dp) return 0; } -static int win32_set_window_title(caca_display_t *dp, char const *title) +static int win32_set_display_title(caca_display_t *dp, char const *title) { SetConsoleTitle(title); return 0; } -static unsigned int win32_get_window_width(caca_display_t *dp) +static unsigned int win32_get_display_width(caca_display_t *dp) { /* FIXME */ @@ -176,7 +176,7 @@ static unsigned int win32_get_window_width(caca_display_t *dp) return dp->cv->width * 6; } -static unsigned int win32_get_window_height(caca_display_t *dp) +static unsigned int win32_get_display_height(caca_display_t *dp) { /* FIXME */ @@ -337,9 +337,9 @@ int win32_install(caca_display_t *dp) dp->drv.init_graphics = win32_init_graphics; dp->drv.end_graphics = win32_end_graphics; - dp->drv.set_window_title = win32_set_window_title; - dp->drv.get_window_width = win32_get_window_width; - dp->drv.get_window_height = win32_get_window_height; + dp->drv.set_display_title = win32_set_display_title; + dp->drv.get_display_width = win32_get_display_width; + dp->drv.get_display_height = win32_get_display_height; dp->drv.display = win32_display; dp->drv.handle_resize = win32_handle_resize; dp->drv.get_event = win32_get_event; diff --git a/caca/driver_x11.c b/caca/driver_x11.c index 6eb01c9..41111b6 100644 --- a/caca/driver_x11.c +++ b/caca/driver_x11.c @@ -220,18 +220,18 @@ static int x11_end_graphics(caca_display_t *dp) return 0; } -static int x11_set_window_title(caca_display_t *dp, char const *title) +static int x11_set_display_title(caca_display_t *dp, char const *title) { XStoreName(dp->drv.p->dpy, dp->drv.p->window, title); return 0; } -static unsigned int x11_get_window_width(caca_display_t *dp) +static unsigned int x11_get_display_width(caca_display_t *dp) { return dp->cv->width * dp->drv.p->font_width; } -static unsigned int x11_get_window_height(caca_display_t *dp) +static unsigned int x11_get_display_height(caca_display_t *dp) { return dp->cv->height * dp->drv.p->font_height; } @@ -592,9 +592,9 @@ int x11_install(caca_display_t *dp) dp->drv.init_graphics = x11_init_graphics; dp->drv.end_graphics = x11_end_graphics; - dp->drv.set_window_title = x11_set_window_title; - dp->drv.get_window_width = x11_get_window_width; - dp->drv.get_window_height = x11_get_window_height; + dp->drv.set_display_title = x11_set_display_title; + dp->drv.get_display_width = x11_get_display_width; + dp->drv.get_display_height = x11_get_display_height; dp->drv.display = x11_display; dp->drv.handle_resize = x11_handle_resize; dp->drv.get_event = x11_get_event; diff --git a/caca/graphics.c b/caca/graphics.c index eeff3fd..0b39ecd 100644 --- a/caca/graphics.c +++ b/caca/graphics.c @@ -22,21 +22,21 @@ #include "cucul.h" #include "cucul_internals.h" -/** \brief Set the window title. +/** \brief Set the display title. * * If libcaca runs in a window, try to change its title. This works with * the X11 and Win32 drivers. * * \param dp The libcaca graphical context. - * \param title The desired window title. + * \param title The desired display title. * \return 0 upon success, a non-zero value if an error occurs. */ -int caca_set_window_title(caca_display_t *dp, char const *title) +int caca_set_display_title(caca_display_t *dp, char const *title) { - return dp->drv.set_window_title(dp, title); + return dp->drv.set_display_title(dp, title); } -/** \brief Get the window width. +/** \brief Get the display width. * * If libcaca runs in a window, get the usable window width. This value can * be used for aspect ratio calculation. If libcaca does not run in a window @@ -44,14 +44,14 @@ int caca_set_window_title(caca_display_t *dp, char const *title) * 6x10 font is being used. Note that the units are not necessarily pixels. * * \param dp The libcaca graphical context. - * \return The window width. + * \return The display width. */ -unsigned int caca_get_window_width(caca_display_t *dp) +unsigned int caca_get_display_width(caca_display_t *dp) { - return dp->drv.get_window_width(dp); + return dp->drv.get_display_width(dp); } -/** \brief Get the window height. +/** \brief Get the display height. * * If libcaca runs in a window, get the usable window height. This value can * be used for aspect ratio calculation. If libcaca does not run in a window @@ -59,18 +59,18 @@ unsigned int caca_get_window_width(caca_display_t *dp) * used. Note that the units are not necessarily pixels. * * \param dp The libcaca graphical context. - * \return The window height. + * \return The display height. */ -unsigned int caca_get_window_height(caca_display_t *dp) +unsigned int caca_get_display_height(caca_display_t *dp) { - return dp->drv.get_window_height(dp); + return dp->drv.get_display_height(dp); } /** \brief Set the refresh delay. * * This function sets the refresh delay in microseconds. The refresh delay - * is used by caca_display() to achieve constant framerate. See the - * caca_display() documentation for more details. + * is used by caca_refresh_display() to achieve constant framerate. See the + * caca_refresh_display() documentation for more details. * * If the argument is zero, constant framerate is disabled. This is the * default behaviour. @@ -86,7 +86,7 @@ void caca_set_delay(caca_display_t *dp, unsigned int usec) /** \brief Get the average rendering time. * * This function returns the average rendering time, which is the average - * measured time between two caca_display() calls, in microseconds. If + * measured time between two caca_refresh_display() calls, in microseconds. If * constant framerate was activated by calling caca_set_delay(), the average * rendering time will not be considerably shorter than the requested delay * even if the real rendering time was shorter. @@ -102,18 +102,18 @@ unsigned int caca_get_rendertime(caca_display_t *dp) /** \brief Flush pending changes and redraw the screen. * * This function flushes all graphical operations and prints them to the - * screen. Nothing will show on the screen until caca_display() is + * screen. Nothing will show on the screen until caca_refresh_display() is * called. * - * If caca_set_delay() was called with a non-zero value, caca_display() - * will use that value to achieve constant framerate: if two consecutive - * calls to caca_display() are within a time range shorter than the value - * set with caca_set_delay(), the second call will wait a bit before - * performing the screen refresh. + * If caca_set_delay() was called with a non-zero value, + * caca_refresh_display() will use that value to achieve constant + * framerate: if two consecutive calls to caca_refresh_display() are + * within a time range shorter than the value set with caca_set_delay(), + * the second call will be delayed before performing the screen refresh. * * \param dp The libcaca graphical context. */ -void caca_display(caca_display_t *dp) +void caca_refresh_display(caca_display_t *dp) { #if !defined(_DOXYGEN_SKIP_ME) #define IDLE_USEC 10000 diff --git a/cpp/caca++.cpp b/cpp/caca++.cpp index 8c4fe31..a152e15 100644 --- a/cpp/caca++.cpp +++ b/cpp/caca++.cpp @@ -27,21 +27,21 @@ Caca::Caca(void) } Caca::Caca(Cucul *cv) { - dp = caca_attach(cv->get_cucul_canvas_t()); + dp = caca_create_display(cv->get_cucul_canvas_t()); if(!dp) throw -1; } Caca::~Caca() { - caca_detach(dp); + caca_free_display(dp); } void Caca::attach(Cucul *cv) { - dp = caca_attach(cv->get_cucul_canvas_t()); + dp = caca_create_display(cv->get_cucul_canvas_t()); if(!dp) throw -1; } void Caca::detach () { - caca_detach(dp); + caca_free_display(dp); } void Caca::set_delay (unsigned int d) { @@ -49,23 +49,23 @@ void Caca::set_delay (unsigned int d) } void Caca::display () { - caca_display(dp); + caca_refresh_display(dp); } unsigned int Caca::get_rendertime () { return caca_get_rendertime(dp); } -unsigned int Caca::get_window_width () +unsigned int Caca::get_display_width () { - return caca_get_window_width(dp); + return caca_get_display_width(dp); } -unsigned int Caca::get_window_height () +unsigned int Caca::get_display_height () { - return caca_get_window_height(dp); + return caca_get_display_height(dp); } -int Caca::set_window_title (char const *s) +int Caca::set_display_title (char const *s) { - return caca_set_window_title(dp, s); + return caca_set_display_title(dp, s); } int Caca::get_event (unsigned int g, Event *n, int aa) { diff --git a/cpp/caca++.h b/cpp/caca++.h index 4d4c88b..11dc67a 100644 --- a/cpp/caca++.h +++ b/cpp/caca++.h @@ -61,9 +61,9 @@ class Caca { void set_delay (unsigned int); void display (); unsigned int get_rendertime (); - unsigned int get_window_width (); - unsigned int get_window_height (); - int set_window_title (char const *); + unsigned int get_display_width (); + unsigned int get_display_height (); + int set_display_title (char const *); int get_event (unsigned int, Event*, int); unsigned int get_mouse_x (); unsigned int get_mouse_y (); diff --git a/cucul/cucul.c b/cucul/cucul.c index 6963488..7b8abdf 100644 --- a/cucul/cucul.c +++ b/cucul/cucul.c @@ -136,10 +136,10 @@ cucul_canvas_t *cucul_load_canvas(void *data, unsigned int size) * the bottom of the canvas are filled with spaces. * * It is an error to try to resize the canvas if an output driver has - * been attached to the canvas using caca_attach(). You need to remove - * the output driver using caca_detach() before you can change the - * canvas size again. However, the caca output driver can cause a canvas - * resize through user interaction. See the caca_event() documentation + * been attached to the canvas using caca_create_display(). You need to + * remove the output driver using caca_free_display() before you can change + * the canvas size again. However, the caca output driver can cause a + * canvas resize through user interaction. See the caca_event() documentation * for more about this. * * \param cv A libcucul canvas diff --git a/python/pypycaca.c b/python/pypycaca.c index 45962de..1344655 100644 --- a/python/pypycaca.c +++ b/python/pypycaca.c @@ -22,9 +22,9 @@ static PyMethodDef CacaMethods[] = { {"set_size", pycaca_set_size, METH_VARARGS, "Set size"}, {"set_width", pycaca_set_width, METH_VARARGS, "Set width"}, {"set_height", pycaca_set_height, METH_VARARGS, "Set height"}, - {"set_window_title", pycaca_set_window_title, METH_VARARGS, "Set window titl"}, - {"get_window_width", pycaca_get_window_width, METH_NOARGS, "Get window width"}, - {"get_window_height", pycaca_get_window_height, METH_NOARGS, "Get Window height"}, + {"set_display_title", pycaca_set_display_title, METH_VARARGS, "Set window titl"}, + {"get_display_width", pycaca_get_display_width, METH_NOARGS, "Get window width"}, + {"get_display_height", pycaca_get_display_height, METH_NOARGS, "Get Window height"}, {"refresh", pycaca_refresh, METH_NOARGS, "Refresh window"}, {"end", pycaca_end, METH_NOARGS, "End libcaca"}, {"get_feature", pycaca_get_feature, METH_VARARGS, "Get feature"}, @@ -255,26 +255,26 @@ pycaca_set_height(PyObject *self, PyObject *args) } static PyObject * -pycaca_set_window_title(PyObject *self, PyObject *args) +pycaca_set_display_title(PyObject *self, PyObject *args) { int ret; const char *str; if (!PyArg_ParseTuple(args, "s", &str)); - ret = caca_set_window_title(str); + ret = caca_set_display_title(str); return Py_BuildValue("i", ret); /* FIXME */ } static PyObject * -pycaca_get_window_width(PyObject *self, PyObject *args) +pycaca_get_display_width(PyObject *self, PyObject *args) { - int ret = caca_get_window_width(); + int ret = caca_get_display_width(); return Py_BuildValue("i", ret); } static PyObject * -pycaca_get_window_height(PyObject *self, PyObject *args) +pycaca_get_display_height(PyObject *self, PyObject *args) { - int ret = caca_get_window_height(); + int ret = caca_get_display_height(); return Py_BuildValue("i", ret); } diff --git a/python/pypycaca.h b/python/pypycaca.h index 780c762..28fbeaa 100644 --- a/python/pypycaca.h +++ b/python/pypycaca.h @@ -38,11 +38,11 @@ pycaca_set_width(PyObject *self, PyObject *args); static PyObject * pycaca_set_height(PyObject *self, PyObject *args); static PyObject * -pycaca_set_window_title(PyObject *self, PyObject *args); +pycaca_set_display_title(PyObject *self, PyObject *args); static PyObject * -pycaca_get_window_width(PyObject *self, PyObject *args); +pycaca_get_display_width(PyObject *self, PyObject *args); static PyObject * -pycaca_get_window_height(PyObject *self, PyObject *args); +pycaca_get_display_height(PyObject *self, PyObject *args); static PyObject * pycaca_refresh(PyObject *self, PyObject *args); static PyObject * diff --git a/src/aafire.c b/src/aafire.c index 09d2624..4889267 100644 --- a/src/aafire.c +++ b/src/aafire.c @@ -106,7 +106,7 @@ initialize (void) printf ("Failed to initialize libcucul\n"); exit (1); } - dp = caca_attach(cv); + dp = caca_create_display(cv); if (!dp) { printf ("Failed to initialize libcaca\n"); @@ -154,7 +154,7 @@ static void uninitialize (void) { #ifdef LIBCACA - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); #else aa_close (context); @@ -243,7 +243,7 @@ paused: cucul_putstr(cv, cucul_get_canvas_width(cv) - 30, cucul_get_canvas_height(cv) - 2, " -=[ Powered by libcaca ]=- "); - caca_display(dp); + caca_refresh_display(dp); /*XSIZ = caca_get_width() * 2; YSIZ = caca_get_height() * 2 - 4;*/ #else diff --git a/src/cacaball.c b/src/cacaball.c index 1b26c94..14d1232 100644 --- a/src/cacaball.c +++ b/src/cacaball.c @@ -56,7 +56,7 @@ int main(int argc, char **argv) cv = cucul_create_canvas(0, 0); if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -162,13 +162,13 @@ paused: cucul_get_canvas_height(cv) - 2, " -=[ Powered by libcaca ]=- "); - caca_display(dp); + caca_refresh_display(dp); } /* End, bye folks */ end: cucul_free_dither(cucul_dither); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/src/cacamoir.c b/src/cacamoir.c index 214b8ac..6ce831d 100644 --- a/src/cacamoir.c +++ b/src/cacamoir.c @@ -45,7 +45,7 @@ int main (int argc, char **argv) cv = cucul_create_canvas(0, 0); if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -114,12 +114,12 @@ paused: cucul_putstr(cv, cucul_get_canvas_width(cv) - 30, cucul_get_canvas_height(cv) - 2, " -=[ Powered by libcaca ]=- "); - caca_display(dp); + caca_refresh_display(dp); } end: cucul_free_dither(dither); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/src/cacaplas.c b/src/cacaplas.c index 1fd4d82..7255746 100644 --- a/src/cacaplas.c +++ b/src/cacaplas.c @@ -49,7 +49,7 @@ int main (int argc, char **argv) cv = cucul_create_canvas(0, 0); if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -136,12 +136,12 @@ paused: cucul_putstr(cv, cucul_get_canvas_width(cv) - 30, cucul_get_canvas_height(cv) - 2, " -=[ Powered by libcaca ]=- "); - caca_display(dp); + caca_refresh_display(dp); } end: cucul_free_dither(dither); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/src/cacaplay.c b/src/cacaplay.c index 1cbc1d8..15ee2be 100644 --- a/src/cacaplay.c +++ b/src/cacaplay.c @@ -62,9 +62,9 @@ int main(int argc, char **argv) return 1; } - dp = caca_attach(cv); + dp = caca_create_display(cv); - caca_display(dp); + caca_refresh_display(dp); while(caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1)) { @@ -73,7 +73,7 @@ int main(int argc, char **argv) } /* Clean up */ - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/src/cacaview.c b/src/cacaview.c index 1d3ce47..11eb3c5 100644 --- a/src/cacaview.c +++ b/src/cacaview.c @@ -75,7 +75,7 @@ int main(int argc, char **argv) return 1; } - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) { fprintf(stderr, "%s: unable to initialise libcaca\n", argv[0]); @@ -83,7 +83,7 @@ int main(int argc, char **argv) } /* Set the window title */ - caca_set_window_title(dp, "cacaview"); + caca_set_display_title(dp, "cacaview"); ww = cucul_get_canvas_width(cv); wh = cucul_get_canvas_height(cv); @@ -273,7 +273,7 @@ int main(int argc, char **argv) } else if(ev.type == CACA_EVENT_RESIZE) { - caca_display(dp); + caca_refresh_display(dp); ww = ev.data.resize.w; wh = ev.data.resize.h; update = 1; @@ -303,7 +303,7 @@ int main(int argc, char **argv) buffer[ww] = '\0'; cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); cucul_putstr(cv, (ww - strlen(buffer)) / 2, wh / 2, buffer); - caca_display(dp); + caca_refresh_display(dp); ww = cucul_get_canvas_width(cv); wh = cucul_get_canvas_height(cv); @@ -399,14 +399,14 @@ int main(int argc, char **argv) print_help(ww - 26, 2); } - caca_display(dp); + caca_refresh_display(dp); update = 0; } /* Clean up */ if(im) unload_image(im); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; @@ -476,7 +476,7 @@ static void set_zoom(int new_zoom) xfactor = (zoom < 0) ? 1.0 / zoomtab[-zoom] : zoomtab[zoom]; yfactor = xfactor * ww / height * im->h / im->w * cucul_get_canvas_height(cv) / cucul_get_canvas_width(cv) - * caca_get_window_width(dp) / caca_get_window_height(dp); + * caca_get_display_width(dp) / caca_get_display_height(dp); if(yfactor > xfactor) { diff --git a/test/colors.c b/test/colors.c index 07c3eb1..a7244ba 100644 --- a/test/colors.c +++ b/test/colors.c @@ -31,7 +31,7 @@ int main(int argc, char **argv) if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -49,10 +49,10 @@ int main(int argc, char **argv) } } - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/demo.c b/test/demo.c index 7ab84bd..50428df 100644 --- a/test/demo.c +++ b/test/demo.c @@ -48,7 +48,7 @@ int main(int argc, char **argv) cv = cucul_create_canvas(0, 0); if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -66,7 +66,7 @@ int main(int argc, char **argv) /* Main menu */ display_menu(); - caca_display(dp); + caca_refresh_display(dp); /* Go ! */ while(!quit) @@ -165,7 +165,7 @@ int main(int argc, char **argv) cucul_putstr(cv, xmouse, ymouse, "."); cucul_putstr(cv, xmouse, ymouse + 1, "|\\"); } - caca_display(dp); + caca_refresh_display(dp); mouse = menu = 0; } @@ -179,13 +179,13 @@ int main(int argc, char **argv) cucul_printf(cv, 4, 1, "[%i.%i fps]----", 1000000 / caca_get_rendertime(dp), (10000000 / caca_get_rendertime(dp)) % 10); - caca_display(dp); + caca_refresh_display(dp); } } /* Clean up */ cucul_free_sprite(sprite); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; @@ -225,7 +225,7 @@ static void display_menu(void) cucul_putstr(cv, 4, yo - 2, "'q': quit"); - caca_display(dp); + caca_refresh_display(dp); } static void demo_all(void) diff --git a/test/dithering.c b/test/dithering.c index 2fcba79..b79f73a 100644 --- a/test/dithering.c +++ b/test/dithering.c @@ -41,7 +41,7 @@ int main(void) int x, y; cv = cucul_create_canvas(0, 0); - dp = caca_attach(cv); + dp = caca_create_display(cv); for(x = 0; x < 100; x++) for(y = 0; y < 100; y++) @@ -122,11 +122,11 @@ int main(void) (100 - y) * cucul_get_canvas_height(cv) / 100, ch); } - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/event.c b/test/event.c index 2ae68df..d084e44 100644 --- a/test/event.c +++ b/test/event.c @@ -33,7 +33,7 @@ int main(int argc, char **argv) cv = cucul_create_canvas(0, 0); if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -45,7 +45,7 @@ int main(int argc, char **argv) cucul_draw_line(cv, 0, h, cucul_get_canvas_width(cv) - 1, h, " "); cucul_putstr(cv, 0, h, "type \"quit\" to exit"); - caca_display(dp); + caca_refresh_display(dp); events = malloc(h * sizeof(caca_event_t)); memset(events, 0, h * sizeof(caca_event_t)); @@ -96,11 +96,11 @@ int main(int argc, char **argv) for(i = 1; i < h && events[i].type; i++) print_event(0, i, events + i); - caca_display(dp); + caca_refresh_display(dp); } /* Clean up */ - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/font.c b/test/font.c index ef4669e..191f802 100644 --- a/test/font.c +++ b/test/font.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) /* Just for fun, render the image using libcaca */ cucul_set_canvas_size(cv, 80, 32); - dp = caca_attach(cv); + dp = caca_create_display(cv); #if defined(HAVE_ENDIAN_H) if(__BYTE_ORDER == __BIG_ENDIAN) @@ -95,12 +95,12 @@ int main(int argc, char *argv[]) cucul_dither_bitmap(cv, 0, 0, cucul_get_canvas_width(cv), cucul_get_canvas_height(cv), d, buf); - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); /* Free everything */ - caca_detach(dp); + caca_free_display(dp); free(buf); cucul_free_dither(d); cucul_free_font(f); diff --git a/test/gamma.c b/test/gamma.c index 8c1420a..cc253b7 100644 --- a/test/gamma.c +++ b/test/gamma.c @@ -41,7 +41,7 @@ int main(void) int x; cv = cucul_create_canvas(0, 0); - dp = caca_attach(cv); + dp = caca_create_display(cv); cw = cucul_create_canvas(cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); mask = cucul_create_canvas(cucul_get_canvas_width(cv), cucul_get_canvas_height(cv)); @@ -106,13 +106,13 @@ int main(void) cucul_printf(cv, 2, 1, "gamma=%g - use arrows to change, Esc to quit", gam); - caca_display(dp); + caca_refresh_display(dp); } cucul_free_dither(left); cucul_free_dither(right); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/hsv.c b/test/hsv.c index 68bb80e..c4cd9b4 100644 --- a/test/hsv.c +++ b/test/hsv.c @@ -36,7 +36,7 @@ int main(void) int x, y; cv = cucul_create_canvas(0, 0); - dp = caca_attach(cv); + dp = caca_create_display(cv); for(y = 0; y < 256; y++) for(x = 0; x < 256; x++) @@ -50,11 +50,11 @@ int main(void) cucul_get_canvas_height(cv), dither, buffer); cucul_free_dither(dither); - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/spritedit.c b/test/spritedit.c index e2acd55..861e775 100644 --- a/test/spritedit.c +++ b/test/spritedit.c @@ -40,7 +40,7 @@ int main(int argc, char **argv) cv = cucul_create_canvas(0, 0); if(!cv) return 1; - dp = caca_attach(cv); + dp = caca_create_display(cv); if(!dp) return 1; @@ -48,7 +48,7 @@ int main(int argc, char **argv) if(!sprite) { - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); fprintf(stderr, "%s: could not open `%s'.\n", argv[0], argv[1]); return 1; @@ -132,11 +132,11 @@ int main(int argc, char **argv) /* Free sprite */ cucul_draw_sprite(cv, 20, 10, sprite, frame); - caca_display(dp); + caca_refresh_display(dp); } /* Clean up */ - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/transform.c b/test/transform.c index 86720d4..d2e81a6 100644 --- a/test/transform.c +++ b/test/transform.c @@ -55,7 +55,7 @@ int main(void) int i; cv = cucul_create_canvas(0, 0); - dp = caca_attach(cv); + dp = caca_create_display(cv); normal = cucul_create_canvas(70, 6); flip = cucul_create_canvas(70, 6); @@ -106,11 +106,11 @@ int main(void) cucul_putstr(cv, 0, 18, "rotate"); cucul_blit(cv, 10, 18, rotate, NULL); - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(rotate); cucul_free_canvas(flop); cucul_free_canvas(flip); diff --git a/test/truecolor.c b/test/truecolor.c index 0165524..d538590 100644 --- a/test/truecolor.c +++ b/test/truecolor.c @@ -33,7 +33,7 @@ int main(void) int x, y; cv = cucul_create_canvas(32, 16); - dp = caca_attach(cv); + dp = caca_create_display(cv); for(y = 0; y < 16; y++) for(x = 0; x < 16; x++) @@ -48,11 +48,11 @@ int main(void) cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_LIGHTBLUE); cucul_putstr(cv, 2, 1, " truecolor libcaca "); - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0; diff --git a/test/unicode.c b/test/unicode.c index d2babc7..2423b5a 100644 --- a/test/unicode.c +++ b/test/unicode.c @@ -31,7 +31,7 @@ int main(void) caca_display_t *dp; cv = cucul_create_canvas(0, 0); - dp = caca_attach(cv); + dp = caca_create_display(cv); cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLUE); cucul_putstr(cv, 1, 1, "Basic Unicode support"); @@ -85,11 +85,11 @@ int main(void) cucul_putstr(cv, 1, 21, "more CP437: α ß Γ π Σ σ µ τ Φ Θ Ω δ ∞ φ ε ∩ ≡ ± ≥ ≤ ⌠ ⌡ ÷ ≈ ° ∙ · √ ⁿ ² ■"); cucul_putstr(cv, 1, 22, "drawing blocks: ███ ▓▓▓ ▒▒▒ ░░░ ▀ ▄ ▌ ▐ █ ▖ ▗ ▘ ▝ ▚ ▞ ▙ ▛ ▜ ▟"); - caca_display(dp); + caca_refresh_display(dp); caca_get_event(dp, CACA_EVENT_KEY_PRESS, &ev, -1); - caca_detach(dp); + caca_free_display(dp); cucul_free_canvas(cv); return 0;