diff options
author | Laércio de Sousa <laerciosousa@sme-mogidascruzes.sp.gov.br> | 2015-03-23 10:58:03 -0300 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-09-21 12:12:41 -0400 |
commit | a6c0564f7f00aa66fd19180f75b6b09904444f06 (patch) | |
tree | 4b21cd46883a847912a0759c9d4eade319f7f67f /hw/kdrive | |
parent | 9414ba3683231afe9bee0f941c53998dea218615 (diff) |
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>
Diffstat (limited to 'hw/kdrive')
-rw-r--r-- | hw/kdrive/ephyr/ephyr.c | 12 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrdriext.c | 4 | ||||
-rw-r--r-- | hw/kdrive/ephyr/ephyrglxext.c | 2 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.c | 16 | ||||
-rw-r--r-- | hw/kdrive/ephyr/hostx.h | 2 |
5 files changed, 17 insertions, 19 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index e6e72d354..1909a06e9 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -71,16 +71,6 @@ 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) { OsSignal(SIGUSR1, hostx_handle_signal); @@ -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; } diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c index 748b608c2..3703adf8c 100644 --- a/hw/kdrive/ephyr/ephyrdriext.c +++ b/hw/kdrive/ephyr/ephyrdriext.c @@ -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; } diff --git a/hw/kdrive/ephyr/ephyrglxext.c b/hw/kdrive/ephyr/ephyrglxext.c index 248689e6f..c6d156900 100644 --- a/hw/kdrive/ephyr/ephyrglxext.c +++ b/hw/kdrive/ephyr/ephyrglxext.c @@ -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; } diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index dc265d545..5406938bc 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -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; } diff --git a/hw/kdrive/ephyr/hostx.h b/hw/kdrive/ephyr/hostx.h index 93aaa509c..9299e8dd4 100644 --- a/hw/kdrive/ephyr/hostx.h +++ b/hw/kdrive/ephyr/hostx.h @@ -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, |