From 85b05def689eb59e6e16aa54a9e0e2ff8f9656db Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 1 Oct 2008 10:27:16 +0200 Subject: [PATCH] xutil: store cursor font as static Signed-off-by: Julien Danjou --- common/xutil.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/common/xutil.c b/common/xutil.c index e8028249a..22f4fcde1 100644 --- a/common/xutil.c +++ b/common/xutil.c @@ -28,6 +28,9 @@ #include #include +/* CURSORFONT */ +#include + #include "common/util.h" #include "common/xutil.h" #include "common/atoms.h" @@ -422,12 +425,15 @@ xutil_button_fromint(int button) xcb_cursor_t xutil_cursor_new(xcb_connection_t *conn, unsigned int cursor_font) { - xcb_font_t font; + static xcb_font_t font = XCB_NONE; xcb_cursor_t cursor; - /* Get the font for the cursor*/ - font = xcb_generate_id(conn); - xcb_open_font(conn, font, sizeof("cursor")-1, "cursor"); + /* Get the font for the cursor */ + if(!font) + { + font = xcb_generate_id(conn); + xcb_open_font(conn, font, sizeof(CURSORFONT) - 1, CURSORFONT); + } cursor = xcb_generate_id(conn); xcb_create_glyph_cursor(conn, cursor, font, font,