xutil: store cursor font as static

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-01 10:27:16 +02:00
parent b382754f3e
commit 85b05def68
1 changed files with 10 additions and 4 deletions

View File

@ -28,6 +28,9 @@
#include <xcb/xcb_atom.h> #include <xcb/xcb_atom.h>
#include <xcb/xcb_icccm.h> #include <xcb/xcb_icccm.h>
/* CURSORFONT */
#include <X11/Xlibint.h>
#include "common/util.h" #include "common/util.h"
#include "common/xutil.h" #include "common/xutil.h"
#include "common/atoms.h" #include "common/atoms.h"
@ -422,12 +425,15 @@ xutil_button_fromint(int button)
xcb_cursor_t xcb_cursor_t
xutil_cursor_new(xcb_connection_t *conn, unsigned int cursor_font) 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; xcb_cursor_t cursor;
/* Get the font for the cursor */ /* Get the font for the cursor */
if(!font)
{
font = xcb_generate_id(conn); font = xcb_generate_id(conn);
xcb_open_font(conn, font, sizeof("cursor")-1, "cursor"); xcb_open_font(conn, font, sizeof(CURSORFONT) - 1, CURSORFONT);
}
cursor = xcb_generate_id(conn); cursor = xcb_generate_id(conn);
xcb_create_glyph_cursor(conn, cursor, font, font, xcb_create_glyph_cursor(conn, cursor, font, font,