From 10bfc08d2652f8f460d76cfb76cddd117fd40dd9 Mon Sep 17 00:00:00 2001 From: Jean-Yves Lamoureux Date: Fri, 24 Mar 2006 15:42:46 +0000 Subject: [PATCH] * Added forgotten X11 set/hide cursor (non-working code) --- caca/driver_x11.c | 21 +++++++++++++++++++++ test/demo.c | 3 +++ 2 files changed, 24 insertions(+) diff --git a/caca/driver_x11.c b/caca/driver_x11.c index c1c48a7..aaaabb9 100644 --- a/caca/driver_x11.c +++ b/caca/driver_x11.c @@ -53,6 +53,7 @@ struct driver_private Font font; XFontStruct *font_struct; int font_offset; + Cursor pointer; #if defined(HAVE_X11_XKBLIB_H) Bool autorepeat; #endif @@ -209,6 +210,9 @@ static int x11_init_graphics(caca_t *kk) DefaultDepth(kk->drv.p->dpy, DefaultScreen(kk->drv.p->dpy))); + + kk->drv.p->pointer = None; + return 0; } @@ -533,6 +537,21 @@ static int x11_get_event(caca_t *kk, struct caca_event *ev) return 0; } +static void x11_show_cursor(caca_t *kk) +{ + +} + +static void x11_hide_cursor(caca_t *kk) +{ + XFreeCursor( kk->drv.p->dpy, kk->drv.p->pointer ); + kk->drv.p->pointer = None; + XUndefineCursor( kk->drv.p->dpy, kk->drv.p->window ); + XSync( kk->drv.p->dpy, False ); /* optional */ + +} + + /* * XXX: following functions are local */ @@ -564,6 +583,8 @@ int x11_install(caca_t *kk) kk->drv.display = x11_display; kk->drv.handle_resize = x11_handle_resize; kk->drv.get_event = x11_get_event; + kk->drv.show_cursor = x11_show_cursor; + kk->drv.hide_cursor = x11_hide_cursor; return 0; } diff --git a/test/demo.c b/test/demo.c index a745b89..0a5a0da 100644 --- a/test/demo.c +++ b/test/demo.c @@ -61,6 +61,9 @@ int main(int argc, char **argv) if(!sprite) sprite = cucul_load_sprite(qq, "examples/caca.txt"); + /* Disable cursor */ + caca_hide_cursor(kk); + /* Main menu */ display_menu(); caca_display(kk);