Commit 6a9f9527 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

xcb: clean up non-static function names

parent 5ceac2ed
......@@ -44,7 +44,7 @@ libvlc_LTLIBRARIES += \
libxcb_x11_plugin_la_SOURCES = \
xcb/xcb_vlc.h \
xcb/x11.c \
xcb/common.c \
xcb/pictures.c \
xcb/events.c
libxcb_x11_plugin_la_CFLAGS = $(AM_CFLAGS) \
$(XCB_CFLAGS) $(XCB_SHM_CFLAGS)
......@@ -54,7 +54,7 @@ libxcb_x11_plugin_la_LIBADD = $(AM_LIBADD) \
libxcb_xv_plugin_la_SOURCES = \
xcb/xcb_vlc.h \
xcb/xvideo.c \
xcb/common.c \
xcb/pictures.c \
xcb/events.c
libxcb_xv_plugin_la_CFLAGS = $(AM_CFLAGS) \
$(XCB_CFLAGS) $(XCB_SHM_CFLAGS) $(XCB_XV_CFLAGS)
......
......@@ -37,8 +37,8 @@
/**
* Check for an error
*/
int CheckError (vout_display_t *vd, xcb_connection_t *conn,
const char *str, xcb_void_cookie_t ck)
int XCB_error_Check (vout_display_t *vd, xcb_connection_t *conn,
const char *str, xcb_void_cookie_t ck)
{
xcb_generic_error_t *err;
......@@ -125,12 +125,12 @@ static const xcb_screen_t *FindScreen (vlc_object_t *obj,
* Create a VLC video X window object, connect to the corresponding X server,
* find the corresponding X server screen.
*/
vout_window_t *GetWindow (vout_display_t *vd,
xcb_connection_t **restrict pconn,
const xcb_screen_t **restrict pscreen,
uint8_t *restrict pdepth,
uint16_t *restrict pwidth,
uint16_t *restrict pheight)
vout_window_t *XCB_parent_Create (vout_display_t *vd,
xcb_connection_t **restrict pconn,
const xcb_screen_t **restrict pscreen,
uint8_t *restrict pdepth,
uint16_t *restrict pwidth,
uint16_t *restrict pheight)
{
vout_window_cfg_t cfg = {
.type = VOUT_WINDOW_TYPE_XID,
......@@ -189,7 +189,7 @@ error:
* @param conn XCB connection
* @param scr target XCB screen
*/
xcb_cursor_t CreateBlankCursor (xcb_connection_t *conn,
xcb_cursor_t XCB_cursor_Create (xcb_connection_t *conn,
const xcb_screen_t *scr)
{
xcb_cursor_t cur = xcb_generate_id (conn);
......@@ -304,7 +304,7 @@ static int ProcessEvent (vout_display_t *vd, xcb_connection_t *conn,
/**
* Process incoming X events.
*/
int ManageEvent (vout_display_t *vd, xcb_connection_t *conn, bool *visible)
int XCB_Manage (vout_display_t *vd, xcb_connection_t *conn, bool *visible)
{
xcb_generic_event_t *ev;
......
......@@ -138,8 +138,8 @@ static int CreateWindow (vout_display_t *vd, xcb_connection_t *conn,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
vid, mask, values);
cm = xcb_map_window_checked (conn, sys->window);
if (CheckError (vd, conn, "cannot create X11 window", cc)
|| CheckError (vd, conn, "cannot map X11 window", cm))
if (XCB_error_Check (vd, conn, "cannot create X11 window", cc)
|| XCB_error_Check (vd, conn, "cannot map X11 window", cm))
return VLC_EGENERIC;
msg_Dbg (vd, "using X11 window %08"PRIx32, sys->window);
......@@ -169,7 +169,7 @@ static int Open (vlc_object_t *obj)
const xcb_screen_t *scr;
uint16_t width, height;
uint8_t depth;
sys->embed = GetWindow (vd, &conn, &scr, &depth, &width, &height);
sys->embed = XCB_parent_Create (vd, &conn, &scr, &depth, &width, &height);
if (sys->embed == NULL)
{
free (sys);
......@@ -305,7 +305,7 @@ static int Open (vlc_object_t *obj)
goto error;
}
sys->cursor = CreateBlankCursor (conn, scr);
sys->cursor = XCB_cursor_Create (conn, scr);
sys->visible = false;
/* Setup vout_display_t once everything is fine */
......@@ -469,7 +469,7 @@ static int Control (vout_display_t *vd, int query, va_list ap)
XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
| XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
values);
if (CheckError (vd, sys->conn, "cannot resize X11 window", ck))
if (XCB_error_Check (vd, sys->conn, "cannot resize X11 window", ck))
return VLC_EGENERIC;
glViewport (0, 0, place.width, place.height);
......@@ -503,5 +503,5 @@ static void Manage (vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
ManageEvent (vd, sys->conn, &sys->visible);
XCB_Manage (vd, sys->conn, &sys->visible);
}
......@@ -53,7 +53,8 @@ struct key_handler_t
* @param conn XCB connection to the X server (to fetch key mappings)
* @return NULL on error, or a key handling context.
*/
key_handler_t *CreateKeyHandler (vlc_object_t *obj, xcb_connection_t *conn)
key_handler_t *XCB_keyHandler_Create (vlc_object_t *obj,
xcb_connection_t *conn)
{
key_handler_t *ctx = malloc (sizeof (*ctx));
if (!ctx)
......@@ -64,7 +65,7 @@ key_handler_t *CreateKeyHandler (vlc_object_t *obj, xcb_connection_t *conn)
return ctx;
}
void DestroyKeyHandler (key_handler_t *ctx)
void XCB_keyHandler_Destroy (key_handler_t *ctx)
{
xcb_key_symbols_free (ctx->syms);
free (ctx);
......@@ -136,7 +137,7 @@ static uint_fast32_t ConvertKeySym (xcb_keysym_t sym)
* @param ev XCB event to process
* @return 0 if the event was handled and free()'d, non-zero otherwise
*/
int ProcessKeyEvent (key_handler_t *ctx, xcb_generic_event_t *ev)
int XCB_keyHandler_Process (key_handler_t *ctx, xcb_generic_event_t *ev)
{
assert (ctx);
......@@ -185,20 +186,21 @@ int ProcessKeyEvent (key_handler_t *ctx, xcb_generic_event_t *ev)
#else /* HAVE_XCB_KEYSYMS */
key_handler_t *CreateKeyHandler (vlc_object_t *obj, xcb_connection_t *conn)
key_handler_t *XCB_keyHandler_Create (vlc_object_t *obj,
xcb_connection_t *conn)
{
msg_Err (obj, "X11 key press support not compiled-in");
(void) conn;
return NULL;
}
void DestroyKeyHandler (key_handler_t *ctx)
void XCB_keyHandler_Destroy (key_handler_t *ctx)
{
(void) ctx;
abort ();
}
int ProcessKeyEvent (key_handler_t *ctx, xcb_generic_event_t *ev)
int XCB_keyHandler_Process (key_handler_t *ctx, xcb_generic_event_t *ev)
{
(void) ctx;
(void) ev;
......
/**
* @file common.c
* @brief Common code for XCB video output plugins
* @file pictures.c
* @brief Pictures management code for XCB video output plugins
*/
/*****************************************************************************
* Copyright © 2009 Rémi Denis-Courmont
* Copyright © 2009-2013 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
......@@ -42,7 +42,7 @@
#include "xcb_vlc.h"
/** Check MIT-SHM shared memory support */
bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn)
bool XCB_shm_Check (vlc_object_t *obj, xcb_connection_t *conn)
{
#ifdef HAVE_SYS_SHM_H
xcb_shm_query_version_cookie_t ck;
......@@ -69,8 +69,8 @@ bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn)
* format. If a attach is true, the segment is attached to
* the X server (MIT-SHM extension).
*/
int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t size,
xcb_connection_t *conn, bool attach)
int XCB_pictures_Alloc (vout_display_t *vd, picture_resource_t *res,
size_t size, xcb_connection_t *conn, bool attach)
{
res->p_sys = malloc (sizeof(*res->p_sys));
if (!res->p_sys)
......@@ -105,7 +105,8 @@ int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t si
segment = xcb_generate_id (conn);
ck = xcb_shm_attach_checked (conn, segment, id, 1);
switch (CheckError (vd, conn, "shared memory server-side error", ck))
switch (XCB_error_Check (vd, conn, "shared memory server-side error",
ck))
{
case 0:
break;
......@@ -118,7 +119,7 @@ int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t si
buf.shm_perm.mode |= S_IRGRP|S_IROTH;
shmctl (id, IPC_SET, &buf);
ck = xcb_shm_attach_checked (conn, segment, id, 1);
if (CheckError (vd, conn, "same error on retry", ck) == 0)
if (XCB_error_Check (vd, conn, "same error on retry", ck) == 0)
break;
/* fall through */
}
......@@ -152,7 +153,7 @@ int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t si
/**
* Release picture private data: detach the shared memory segment.
*/
void PictureResourceFree (picture_resource_t *res, xcb_connection_t *conn)
void XCB_pictures_Free (picture_resource_t *res, xcb_connection_t *conn)
{
#ifdef HAVE_SYS_SHM_H
xcb_shm_seg_t segment = res->p_sys->segment;
......
......@@ -266,7 +266,7 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
p_sys->conn = conn;
if (var_InheritBool (wnd, "keyboard-events"))
p_sys->keys = CreateKeyHandler (VLC_OBJECT(wnd), conn);
p_sys->keys = XCB_keyHandler_Create (VLC_OBJECT(wnd), conn);
else
p_sys->keys = NULL;
p_sys->root = scr->root;
......@@ -334,7 +334,7 @@ static int Open (vout_window_t *wnd, const vout_window_cfg_t *cfg)
* request from this thread must be completed at this point. */
if ((p_sys->keys != NULL)
&& vlc_clone (&p_sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
DestroyKeyHandler (p_sys->keys);
XCB_keyHandler_Destroy (p_sys->keys);
xcb_flush (conn); /* Make sure map_window is sent (should be useless) */
return VLC_SUCCESS;
......@@ -359,7 +359,7 @@ static void Close (vout_window_t *wnd)
{
vlc_cancel (p_sys->thread);
vlc_join (p_sys->thread, NULL);
DestroyKeyHandler (p_sys->keys);
XCB_keyHandler_Destroy (p_sys->keys);
}
xcb_disconnect (conn);
free (wnd->display.x11);
......@@ -388,7 +388,7 @@ static void *Thread (void *data)
int canc = vlc_savecancel ();
while ((ev = xcb_poll_for_event (conn)) != NULL)
{
if (ProcessKeyEvent (p_sys->keys, ev) == 0)
if (XCB_keyHandler_Process (p_sys->keys, ev) == 0)
continue;
msg_Dbg (wnd, "unhandled event: %"PRIu8, ev->response_type);
free (ev);
......@@ -589,7 +589,7 @@ static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg)
if (var_InheritBool (wnd, "keyboard-events"))
{
p_sys->keys = CreateKeyHandler (VLC_OBJECT(wnd), conn);
p_sys->keys = XCB_keyHandler_Create (VLC_OBJECT(wnd), conn);
if (p_sys->keys != NULL)
{
const uint32_t mask = XCB_CW_EVENT_MASK;
......@@ -603,7 +603,7 @@ static int EmOpen (vout_window_t *wnd, const vout_window_cfg_t *cfg)
CacheAtoms (p_sys);
if ((p_sys->keys != NULL)
&& vlc_clone (&p_sys->thread, Thread, wnd, VLC_THREAD_PRIORITY_LOW))
DestroyKeyHandler (p_sys->keys);
XCB_keyHandler_Destroy (p_sys->keys);
xcb_flush (conn);
(void) cfg;
......
......@@ -116,7 +116,8 @@ static int Open (vlc_object_t *obj)
xcb_connection_t *conn;
const xcb_screen_t *scr;
uint16_t width, height;
sys->embed = GetWindow (vd, &conn, &scr, &(uint8_t){ 0 }, &width, &height);
sys->embed = XCB_parent_Create (vd, &conn, &scr,
&(uint8_t){ 0 }, &width, &height);
if (sys->embed == NULL)
{
free (sys);
......@@ -287,15 +288,15 @@ found_format:;
/* Create graphic context (I wonder why the heck do we need this) */
xcb_create_gc (conn, sys->gc, sys->window, 0, NULL);
if (CheckError (vd, conn, "cannot create X11 window", c))
if (XCB_error_Check (vd, conn, "cannot create X11 window", c))
goto error;
}
msg_Dbg (vd, "using X11 window %08"PRIx32, sys->window);
msg_Dbg (vd, "using X11 graphic context %08"PRIx32, sys->gc);
sys->cursor = CreateBlankCursor (conn, scr);
sys->cursor = XCB_cursor_Create (conn, scr);
sys->visible = false;
sys->shm = CheckSHM (obj, conn);
sys->shm = XCB_shm_Check (obj, conn);
/* Setup vout_display_t once everything is fine */
......@@ -382,13 +383,13 @@ static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
res->p->i_lines = pic->p->i_lines;
res->p->i_pitch = pic->p->i_pitch;
if (PictureResourceAlloc (vd, res, res->p->i_pitch * res->p->i_lines,
sys->conn, sys->shm))
if (XCB_pictures_Alloc (vd, res, res->p->i_pitch * res->p->i_lines,
sys->conn, sys->shm))
break;
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
{
PictureResourceFree (res, sys->conn);
XCB_pictures_Free (res, sys->conn);
memset (res, 0, sizeof(*res));
break;
}
......@@ -546,7 +547,7 @@ static void Manage (vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
ManageEvent (vd, sys->conn, &sys->visible);
XCB_Manage (vd, sys->conn, &sys->visible);
}
static void ResetPictures (vout_display_t *vd)
......@@ -562,7 +563,7 @@ static void ResetPictures (vout_display_t *vd)
if (!res->p->p_pixels)
break;
PictureResourceFree (res, sys->conn);
XCB_pictures_Free (res, sys->conn);
}
picture_pool_Delete (sys->pool);
sys->pool = NULL;
......
......@@ -33,23 +33,26 @@
#include <vlc_picture.h>
#include <vlc_vout_display.h>
int ManageEvent (vout_display_t *vd, xcb_connection_t *conn, bool *);
/* keys.c */
typedef struct key_handler_t key_handler_t;
key_handler_t *CreateKeyHandler (vlc_object_t *, xcb_connection_t *);
void DestroyKeyHandler (key_handler_t *);
int ProcessKeyEvent (key_handler_t *, xcb_generic_event_t *);
key_handler_t *XCB_keyHandler_Create (vlc_object_t *, xcb_connection_t *);
void XCB_keyHandler_Destroy (key_handler_t *);
int XCB_keyHandler_Process (key_handler_t *, xcb_generic_event_t *);
/* common.c */
struct vout_window_t *GetWindow (vout_display_t *obj, xcb_connection_t **,
const xcb_screen_t **, uint8_t *depth,
uint16_t *width, uint16_t *height);
bool CheckSHM (vlc_object_t *obj, xcb_connection_t *conn);
xcb_cursor_t CreateBlankCursor (xcb_connection_t *, const xcb_screen_t *);
/* events.c */
int XCB_error_Check (vout_display_t *, xcb_connection_t *conn,
const char *str, xcb_void_cookie_t);
struct vout_window_t *XCB_parent_Create (vout_display_t *obj,
xcb_connection_t **,
const xcb_screen_t **, uint8_t *depth,
uint16_t *width, uint16_t *height);
xcb_cursor_t XCB_cursor_Create (xcb_connection_t *, const xcb_screen_t *);
int CheckError (vout_display_t *, xcb_connection_t *conn,
const char *str, xcb_void_cookie_t);
int XCB_Manage (vout_display_t *vd, xcb_connection_t *conn, bool *);
/* common.c */
bool XCB_shm_Check (vlc_object_t *obj, xcb_connection_t *conn);
/* FIXME
* maybe it would be better to split this header in 2 */
......@@ -58,7 +61,6 @@ struct picture_sys_t
{
xcb_shm_seg_t segment;
};
int PictureResourceAlloc (vout_display_t *vd, picture_resource_t *res, size_t size,
xcb_connection_t *conn, bool attach);
void PictureResourceFree (picture_resource_t *res, xcb_connection_t *conn);
int XCB_pictures_Alloc (vout_display_t *, picture_resource_t *, size_t size,
xcb_connection_t *, bool attach);
void XCB_pictures_Free (picture_resource_t *, xcb_connection_t *);
......@@ -388,7 +388,8 @@ static int Open (vlc_object_t *obj)
const xcb_screen_t *screen;
uint16_t width, height;
uint8_t depth;
p_sys->embed = GetWindow (vd, &conn, &screen, &depth, &width, &height);
p_sys->embed = XCB_parent_Create (vd, &conn, &screen,
&depth, &width, &height);
if (p_sys->embed == NULL)
{
free (p_sys);
......@@ -506,7 +507,7 @@ static int Open (vlc_object_t *obj)
p_sys->embed->handle.xid, 0, 0, 1, 1, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT, f->visual, mask, list);
if (!CheckError (vd, conn, "cannot create X11 window", c))
if (!XCB_error_Check (vd, conn, "cannot create X11 window", c))
{
msg_Dbg (vd, "using X11 visual ID 0x%"PRIx32
" (depth: %"PRIu8")", f->visual, f->depth);
......@@ -565,9 +566,9 @@ static int Open (vlc_object_t *obj)
}
/* Create cursor */
p_sys->cursor = CreateBlankCursor (conn, screen);
p_sys->cursor = XCB_cursor_Create (conn, screen);
p_sys->shm = CheckSHM (obj, conn);
p_sys->shm = XCB_shm_Check (obj, conn);
/* */
vout_display_info_t info = vd->info;
......@@ -619,7 +620,7 @@ static void Close (vlc_object_t *obj)
if (!res->p->p_pixels)
break;
PictureResourceFree (res, NULL);
XCB_pictures_Free (res, NULL);
}
picture_pool_Delete (p_sys->pool);
}
......@@ -663,8 +664,8 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
res->p[i].i_pitch = pitches[i];
}
if (PictureResourceAlloc (vd, res, p_sys->att->data_size,
p_sys->conn, p_sys->shm))
if (XCB_pictures_Alloc (vd, res, p_sys->att->data_size,
p_sys->conn, p_sys->shm))
break;
/* Allocate further planes as specified by XVideo */
......@@ -682,7 +683,7 @@ static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
pic_array[count] = picture_NewFromResource (&vd->fmt, res);
if (!pic_array[count])
{
PictureResourceFree (res, p_sys->conn);
XCB_pictures_Free (res, p_sys->conn);
memset (res, 0, sizeof(*res));
break;
}
......@@ -840,7 +841,7 @@ static void Manage (vout_display_t *vd)
{
vout_display_sys_t *p_sys = vd->sys;
ManageEvent (vd, p_sys->conn, &p_sys->visible);
XCB_Manage (vd, p_sys->conn, &p_sys->visible);
}
static int EnumAdaptors (vlc_object_t *obj, const char *var,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment