[vlc-devel] commit: XCB: CreateBlankCursor common helper ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Oct 28 20:11:56 CET 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 28 21:06:14 2009 +0200| [b69562699767589c46a0682f0ada5a7e74d6991f] | committer: Rémi Denis-Courmont
XCB: CreateBlankCursor common helper
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b69562699767589c46a0682f0ada5a7e74d6991f
---
modules/video_output/xcb/common.c | 32 ++++++++++++++++++++++++++++++++
modules/video_output/xcb/xcb_vlc.h | 1 +
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index 77ddd01..e9e55ac 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -200,6 +200,38 @@ int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
}
/**
+ * Create a blank cursor.
+ * Note that the pixmaps are leaked (until the X disconnection). Hence, this
+ * function should be called no more than once per X connection.
+ * @param conn XCB connection
+ * @param scr target XCB screen
+ */
+xcb_cursor_t CreateBlankCursor (xcb_connection_t *conn,
+ const xcb_screen_t *scr)
+{
+ xcb_cursor_t cur = xcb_generate_id (conn);
+ xcb_pixmap_t pix = xcb_generate_id (conn);
+ xcb_void_cookie_t ck;
+ xcb_generic_error_t *err;
+
+ ck = xcb_create_pixmap_checked (conn, 1, pix, scr->root, 1, 1);
+ err = xcb_request_check (conn, ck);
+ if (err)
+ {
+ fprintf (stderr, "Cannot create pixmap: %d", err->error_code);
+ free (err);
+ }
+ ck = xcb_create_cursor_checked (conn, cur, pix, pix, 0, 0, 0, 0, 0, 0, 0, 0);
+ err = xcb_request_check (conn, ck);
+ if (err)
+ {
+ fprintf (stderr, "Cannot create pixmap: %d", err->error_code);
+ free (err);
+ }
+ return cur;
+}
+
+/**
* Initialize a picture buffer as shared memory, according to the video output
* format. If a attach is true, the segment is attached to
* the X server (MIT-SHM extension).
diff --git a/modules/video_output/xcb/xcb_vlc.h b/modules/video_output/xcb/xcb_vlc.h
index 131c582..cc7f640 100644
--- a/modules/video_output/xcb/xcb_vlc.h
+++ b/modules/video_output/xcb/xcb_vlc.h
@@ -45,6 +45,7 @@ struct vout_window_t *GetWindow (vout_display_t *obj,
bool *restrict pshm);
int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
unsigned *restrict width, unsigned *restrict height);
+xcb_cursor_t CreateBlankCursor (xcb_connection_t *, const xcb_screen_t *);
int CheckError (vout_display_t *, xcb_connection_t *conn,
const char *str, xcb_void_cookie_t);
More information about the vlc-devel
mailing list