ephyr: move host_has_extension() implementation to hostx.c

This is a trivial patch that moves host_has_extension() implementation
from ephyr.c to hostx.c so that it can be called by hostx.c internal
functions. Also rename function to hostx_has_extension() for consistency.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br>
This commit is contained in:
Laércio de Sousa 2015-03-23 10:58:03 -03:00 committed by Adam Jackson
parent 9414ba3683
commit a6c0564f7f
5 changed files with 17 additions and 19 deletions

View File

@ -70,16 +70,6 @@ Bool EphyrWantGrayScale = 0;
Bool EphyrWantResize = 0;
Bool EphyrWantNoHostGrab = 0;
Bool
host_has_extension(xcb_extension_t *extension)
{
const xcb_query_extension_reply_t *rep;
rep = xcb_get_extension_data(hostx_get_xcbconn(), extension);
return rep && rep->present;
}
Bool
ephyrInitialize(KdCardInfo * card, EphyrPriv * priv)
{
@ -670,7 +660,7 @@ ephyrInitScreen(ScreenPtr pScreen)
}
#endif /*XV*/
#ifdef XF86DRI
if (!ephyrNoDRI && !host_has_extension(&xcb_xf86dri_id)) {
if (!ephyrNoDRI && !hostx_has_extension(&xcb_xf86dri_id)) {
EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n");
ephyrNoDRI = TRUE;
}

View File

@ -1321,12 +1321,12 @@ ephyrDRIExtensionInit(ScreenPtr a_screen)
EphyrDRIScreenPrivPtr screen_priv = NULL;
EPHYR_LOG("enter\n");
if (!host_has_extension(&xcb_xf86dri_id)) {
if (!hostx_has_extension(&xcb_xf86dri_id)) {
EPHYR_LOG("host does not have DRI extension\n");
goto out;
}
EPHYR_LOG("host X does have DRI extension\n");
if (!host_has_extension(&xcb_shape_id)) {
if (!hostx_has_extension(&xcb_shape_id)) {
EPHYR_LOG("host does not have XShape extension\n");
goto out;
}

View File

@ -84,7 +84,7 @@ ephyrHijackGLXExtension(void)
{
const void *(*dispatch_functions)[2];
if (!host_has_extension(&xcb_glx_id)) {
if (!hostx_has_extension(&xcb_glx_id)) {
EPHYR_LOG("host X does not have GLX\n");
return FALSE;
}

View File

@ -99,6 +99,16 @@ int ephyrResNameFromCmd = 0;
char *ephyrTitle = NULL;
Bool ephyr_glamor = FALSE;
Bool
hostx_has_extension(xcb_extension_t *extension)
{
const xcb_query_extension_reply_t *rep;
rep = xcb_get_extension_data(HostX.conn, extension);
return rep && rep->present;
}
static void
hostx_set_fullscreen_hint(void);
@ -240,7 +250,7 @@ hostx_get_output_geometry(const char *output,
xcb_randr_get_crtc_info_reply_t *crtc_info_r;
/* First of all, check for extension */
if (!xcb_get_extension_data(HostX.conn, &xcb_randr_id)->present)
if (!hostx_has_extension(&xcb_randr_id))
{
fprintf(stderr, "\nHost X server does not support RANDR extension (or it's disabled).\n");
exit(1);
@ -422,7 +432,6 @@ hostx_init(void)
char *tmpstr;
char *class_hint;
size_t class_len;
const xcb_query_extension_reply_t *shm_rep;
xcb_screen_t *xscreen;
xcb_rectangle_t rect = { 0, 0, 1, 1 };
@ -632,8 +641,7 @@ hostx_init(void)
}
/* Try to get share memory ximages for a little bit more speed */
shm_rep = xcb_get_extension_data(HostX.conn, &xcb_shm_id);
if (!shm_rep || !shm_rep->present || getenv("XEPHYR_NO_SHM")) {
if (!hostx_has_extension(&xcb_shm_id) || getenv("XEPHYR_NO_SHM")) {
fprintf(stderr, "\nXephyr unable to use SHM XImages\n");
HostX.have_shm = FALSE;
}

View File

@ -182,7 +182,7 @@ int hostx_set_window_geometry(int a_win, EphyrBox * a_geo);
int hostx_set_window_bounding_rectangles(int a_window,
EphyrRect * a_rects, int a_num_rects);
int host_has_extension(xcb_extension_t *extension);
int hostx_has_extension(xcb_extension_t *extension);
#ifdef XF86DRI
int hostx_lookup_peer_window(void *a_local_window,