ソースを参照

* Implemented caca_set_display_title() for ncurses and S-Lang.

tags/v0.99.beta14
Sam Hocevar sam 18年前
コミット
dac2f4d57f
4個のファイルの変更29行の追加6行の削除
  1. +13
    -1
      caca/driver_ncurses.c
  2. +13
    -2
      caca/driver_slang.c
  3. +1
    -1
      caca/graphics.c
  4. +2
    -2
      doc/migrating.dox

+ 13
- 1
caca/driver_ncurses.c ファイルの表示

@@ -59,6 +59,7 @@ static caca_display_t *sigwinch_d; /* FIXME: we ought to get rid of this */
#if defined HAVE_GETENV && defined HAVE_PUTENV
static void ncurses_check_terminal(void);
#endif
static void ncurses_set_title(char const *);
static void ncurses_write_utf32(uint32_t);

struct driver_private
@@ -109,6 +110,8 @@ static int ncurses_init_graphics(caca_display_t *dp)
setlocale(LC_ALL, "");
#endif

ncurses_set_title("caca for ncurses");

initscr();
keypad(stdscr, TRUE);
nonl();
@@ -166,6 +169,7 @@ static int ncurses_init_graphics(caca_display_t *dp)

static int ncurses_end_graphics(caca_display_t *dp)
{
ncurses_set_title("");
mousemask(dp->drv.p->oldmask, NULL);
curs_set(1);
noraw();
@@ -178,7 +182,9 @@ static int ncurses_end_graphics(caca_display_t *dp)

static int ncurses_set_display_title(caca_display_t *dp, char const *title)
{
return -1;
ncurses_set_title(title);

return 0;
}

static unsigned int ncurses_get_display_width(caca_display_t *dp)
@@ -429,6 +435,12 @@ static void ncurses_check_terminal(void)
}
#endif

static void ncurses_set_title(char const *str)
{
fprintf(stdout, "\x1b]0;%s\x07\n", str);
fflush(stdout);
}

static void ncurses_write_utf32(uint32_t ch)
{
#if defined HAVE_NCURSESW_NCURSES_H


+ 13
- 2
caca/driver_slang.c ファイルの表示

@@ -103,6 +103,7 @@ static int const slang_assoc[16*16] =
* Local functions
*/
static void slang_init_palette(void);
static void slang_set_title(char const *);
static void slang_write_utf32(uint32_t);

#if defined(HAVE_SIGNAL)
@@ -124,6 +125,8 @@ static int slang_init_graphics(caca_display_t *dp)
signal(SIGWINCH, sigwinch_handler);
#endif

slang_set_title("caca for S-Lang");

/* Initialise slang library */
SLsig_block_signals();
SLtt_get_terminfo();
@@ -172,6 +175,7 @@ static int slang_init_graphics(caca_display_t *dp)

static int slang_end_graphics(caca_display_t *dp)
{
slang_set_title("");
SLtt_set_mouse_mode(0, 0);
SLtt_set_cursor_visibility(1);
SLang_reset_tty();
@@ -182,8 +186,9 @@ static int slang_end_graphics(caca_display_t *dp)

static int slang_set_display_title(caca_display_t *dp, char const *title)
{
/* FIXME */
return -1;
slang_set_title(title);

return 0;
}

static unsigned int slang_get_display_width(caca_display_t *dp)
@@ -442,6 +447,12 @@ static void slang_init_palette(void)
#endif
}

static void slang_set_title(char const *str)
{
fprintf(stdout, "\x1b]0;%s\x07\n", str);
fflush(stdout);
}

static void slang_write_utf32(uint32_t ch)
{
#ifdef HAVE_SLSMG_UTF8_ENABLE


+ 1
- 1
caca/graphics.c ファイルの表示

@@ -26,7 +26,7 @@
/** \brief Set the display title.
*
* If libcaca runs in a window, try to change its title. This works with
* the OpenGL, X11 and Win32 drivers.
* the ncurses, S-Lang, OpenGL, X11 and Win32 drivers.
*
* If an error occurs, -1 is returned and \b errno is set accordingly:
* - \c ENOSYS Display driver does not support setting the window title.


+ 2
- 2
doc/migrating.dox ファイルの表示

@@ -187,12 +187,12 @@ int main(void)
completely deprecated.

- \b caca_load_sprite(): use cucul_import_file().
- \b caca_get_sprite_frames(): use cucul_get_canvas_frame_count().
- \b caca_get_sprite_frames(): use cucul_get_frame_count().
- \b caca_get_sprite_width(): use cucul_get_canvas_width().
- \b caca_get_sprite_height(): use cucul_get_canvas_height().
- \b caca_get_sprite_dx(): use cucul_get_canvas_handle_x().
- \b caca_get_sprite_dy(): use cucul_get_canvas_handle_y().
- \b caca_draw_sprite(): use cucul_set_canvas_frame() and cucul_blit().
- \b caca_draw_sprite(): use cucul_set_frame() and cucul_blit().
- \b caca_free_sprite(): use cucul_free_canvas().

\subsection bar7 Bitmap handling


読み込み中…
キャンセル
保存