From 19ecd3bbc6c8d18341ef6a0bc1f51b60cdb0786d Mon Sep 17 00:00:00 2001 From: devilhorns Date: Tue, 20 Sep 2011 07:34:50 +0000 Subject: [PATCH] Ecore_X(cb): Add checks to make sure that extensions are loaded and available before making calls to them. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@63492 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/xcb/ecore_xcb.c | 6 +- src/lib/ecore_x/xcb/ecore_xcb_randr.c | 104 +++++++++++++++++++++++++++++++++ src/lib/ecore_x/xcb/ecore_xcb_render.c | 3 + src/lib/ecore_x/xcb/ecore_xcb_shape.c | 3 +- src/lib/ecore_x/xcb/ecore_xcb_xfixes.c | 38 ++++++++++++ 5 files changed, 150 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index 09d024c..5380e98 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -899,7 +899,7 @@ ecore_x_bell(int percent) } EAPI void -ecore_x_display_size_get(Ecore_X_Display *dsp, int *w, int *h) +ecore_x_display_size_get(Ecore_X_Display *dsp __UNUSED__, int *w, int *h) { xcb_screen_t *screen; @@ -912,7 +912,7 @@ ecore_x_display_size_get(Ecore_X_Display *dsp, int *w, int *h) } EAPI unsigned long -ecore_x_display_black_pixel_get(Ecore_X_Display *dsp) +ecore_x_display_black_pixel_get(Ecore_X_Display *dsp __UNUSED__) { xcb_screen_t *screen; @@ -924,7 +924,7 @@ ecore_x_display_black_pixel_get(Ecore_X_Display *dsp) } EAPI unsigned long -ecore_x_display_white_pixel_get(Ecore_X_Display *dsp) +ecore_x_display_white_pixel_get(Ecore_X_Display *dsp __UNUSED__) { xcb_screen_t *screen; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c index d145c82..6e0eb7e 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c @@ -178,6 +178,8 @@ ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_None; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -206,6 +208,8 @@ ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_None; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -236,6 +240,8 @@ ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root, Ecore_X LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -284,6 +290,8 @@ ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, int *num) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -342,6 +350,8 @@ ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, int *w LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -389,6 +399,8 @@ ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, int size_index LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if (!((size_index >= 0) && (_ecore_xcb_randr_root_validate(root)))) return EINA_FALSE; @@ -451,6 +463,8 @@ ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return 0.0; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return ret; @@ -484,6 +498,8 @@ ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, int s LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return ret; @@ -536,6 +552,8 @@ ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root, int si LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -600,6 +618,8 @@ ecore_x_randr_primary_output_get(Ecore_X_Window root) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_None; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return Ecore_X_Randr_None; @@ -624,6 +644,8 @@ ecore_x_randr_primary_output_set(Ecore_X_Window root, Ecore_X_Randr_Output outpu { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR if ((output) && (_ecore_xcb_randr_root_validate(root))) xcb_randr_set_output_primary(_ecore_xcb_conn, root, output); @@ -641,6 +663,8 @@ ecore_x_randr_output_modes_get(Ecore_X_Window root, Ecore_X_Randr_Output output, LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); @@ -695,6 +719,8 @@ ecore_x_randr_mode_info_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return NULL; @@ -769,6 +795,7 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root, int *num) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (num) *num = 0; + if (!_randr_avail) return NULL; #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return NULL; @@ -850,6 +877,8 @@ ecore_x_randr_mode_size_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode, int *w LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR if (mode == Ecore_X_Randr_None) return; cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, root); @@ -897,6 +926,8 @@ ecore_x_randr_output_edid_get(Ecore_X_Window root, Ecore_X_Randr_Output output, LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if ((!length) || (!_ecore_xcb_randr_output_validate(root, output))) return NULL; @@ -943,6 +974,8 @@ ecore_x_randr_output_clones_get(Ecore_X_Window root, Ecore_X_Randr_Output output LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (output == Ecore_X_Randr_None) return NULL; @@ -988,6 +1021,8 @@ ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, Ecore_X_Randr_Outpu LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (output == Ecore_X_Randr_None) return NULL; @@ -1038,6 +1073,8 @@ ecore_x_randr_output_name_get(Ecore_X_Window root, Ecore_X_Randr_Output output, LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (output == Ecore_X_Randr_None) return NULL; @@ -1088,6 +1125,8 @@ ecore_x_randr_output_connection_status_get(Ecore_X_Window root, Ecore_X_Randr_Ou LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return ret; + #ifdef ECORE_XCB_RANDR if (output == Ecore_X_Randr_None) return ret; @@ -1126,6 +1165,8 @@ ecore_x_randr_outputs_get(Ecore_X_Window root, int *num) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL); @@ -1154,6 +1195,8 @@ ecore_x_randr_output_crtc_get(Ecore_X_Window root, Ecore_X_Randr_Output output) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_None; + #ifdef ECORE_XCB_RANDR if (output == Ecore_X_Randr_None) return ret; @@ -1212,6 +1255,8 @@ ecore_x_randr_crtc_settings_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ec LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; @@ -1290,6 +1335,8 @@ ecore_x_randr_crtc_mode_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ecore_ LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return ret; + #ifdef ECORE_XCB_RANDR if ((int)mode == Ecore_X_Randr_Unset) return ret; ret = @@ -1319,6 +1366,8 @@ ecore_x_randr_crtc_mode_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_Unset; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; @@ -1357,6 +1406,8 @@ ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_None; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; @@ -1391,6 +1442,8 @@ ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if (orientation != Ecore_X_Randr_None) { @@ -1415,6 +1468,8 @@ ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return Ecore_X_Randr_None; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; @@ -1458,6 +1513,8 @@ ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; @@ -1510,6 +1567,8 @@ ecore_x_randr_crtcs_get(Ecore_X_Window root, int *num) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL); @@ -1543,6 +1602,8 @@ ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return NULL; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; @@ -1584,6 +1645,8 @@ ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, in LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return; @@ -1632,6 +1695,8 @@ ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if ((ecore_x_randr_crtc_mode_get(root, crtc1) == 0) || (ecore_x_randr_crtc_mode_get(root, crtc2) == 0)) @@ -1712,6 +1777,8 @@ ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, const Ecore_X_Randr_Crtc * LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if ((num <= 0) || (!not_moved) || (!_ecore_xcb_randr_root_validate(root))) return EINA_FALSE; @@ -1742,6 +1809,8 @@ ecore_x_randr_crtc_pos_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *x, { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL); #endif @@ -1766,6 +1835,8 @@ ecore_x_randr_crtc_pos_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int x, LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR ecore_x_randr_crtc_geometry_get(root, crtc, &rect.x, &rect.y, &rect.w, &rect.h); @@ -1794,6 +1865,8 @@ ecore_x_randr_crtc_size_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, int *w { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h); #endif @@ -1810,6 +1883,8 @@ ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return 0.0; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return 0.0; cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, root); @@ -1861,6 +1936,8 @@ ecore_x_randr_move_crtcs(Ecore_X_Window root, const Ecore_X_Randr_Crtc *crtcs, i LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return EINA_FALSE; @@ -1962,6 +2039,8 @@ ecore_x_randr_events_select(Ecore_X_Window win, Eina_Bool on) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR if (on) { @@ -1996,6 +2075,8 @@ ecore_x_randr_screen_reset(Ecore_X_Window root) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR if (!_ecore_xcb_randr_root_validate(root)) return; crtcs = ecore_x_randr_crtcs_get(root, &total); @@ -2068,6 +2149,8 @@ ecore_x_randr_screen_size_range_get(Ecore_X_Window root, int *minw, int *minh, i LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR cookie = xcb_randr_get_screen_size_range_unchecked(_ecore_xcb_conn, root); reply = xcb_randr_get_screen_size_range_reply(_ecore_xcb_conn, cookie, NULL); @@ -2099,6 +2182,8 @@ ecore_x_randr_screen_current_size_get(Ecore_X_Window root, int *w, int *h, int * LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return; + #ifdef ECORE_XCB_RANDR if (!RANDR_VALIDATE_ROOT(scr, root)) return; @@ -2152,6 +2237,8 @@ ecore_x_randr_screen_current_size_set(Ecore_X_Window root, int w, int h, int w_m LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if (!RANDR_VALIDATE_ROOT(scr, root)) return EINA_FALSE; ecore_x_randr_screen_current_size_get(root, &wc, &hc, &w_mm_c, &h_mm_c); @@ -2198,6 +2285,7 @@ ecore_x_randr_window_outputs_get(Ecore_X_Window window, int *num) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (num) *num = 0; + if (!_randr_avail) return NULL; #ifdef ECORE_XCB_RANDR if (_randr_version < ((1 << 16) | 2)) return NULL; @@ -2284,7 +2372,13 @@ ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, Ecore_X_Randr_Outp xcb_randr_query_output_property_reply_t *qreply; double dvalue; long value, max, min; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return -1; + +#ifdef ECORE_XCB_RANDR acookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, strlen("Backlight"), "Backlight"); @@ -2373,7 +2467,13 @@ ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, Ecore_X_Randr_Outp xcb_intern_atom_reply_t *areply; xcb_randr_query_output_property_cookie_t qcookie; xcb_randr_query_output_property_reply_t *qreply; +#endif + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!_randr_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_RANDR if ((level < 0) || (level > 1)) { ERR("Backlight level should be between 0 and 1"); @@ -2443,6 +2543,8 @@ _ecore_xcb_randr_output_validate(Ecore_X_Window root, Ecore_X_Randr_Output outpu LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if ((output) && (_ecore_xcb_randr_root_validate(root))) { @@ -2488,6 +2590,8 @@ _ecore_xcb_randr_crtc_validate(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_randr_avail) return EINA_FALSE; + #ifdef ECORE_XCB_RANDR if (((int)crtc == Ecore_X_Randr_None) || ((int)crtc == Ecore_X_Randr_Unset)) return ret; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_render.c b/src/lib/ecore_x/xcb/ecore_xcb_render.c index d242ba9..4c4eac4 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_render.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_render.c @@ -110,6 +110,7 @@ _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual) LOGFN(__FILE__, __LINE__, __FUNCTION__); if (!visual) return EINA_FALSE; + if (!_render_avail) return EINA_FALSE; #ifdef ECORE_XCB_RENDER reply = xcb_render_util_query_formats(_ecore_xcb_conn); @@ -150,6 +151,8 @@ _ecore_xcb_render_find_visual_id(int type, Eina_Bool check_alpha) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_render_avail) return 0; + #ifdef ECORE_XCB_RENDER reply = xcb_render_util_query_formats(_ecore_xcb_conn); if (!reply) return 0; diff --git a/src/lib/ecore_x/xcb/ecore_xcb_shape.c b/src/lib/ecore_x/xcb/ecore_xcb_shape.c index 0025c81..2a05230 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_shape.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_shape.c @@ -31,8 +31,9 @@ _ecore_xcb_shape_finalize(void) { xcb_shape_query_version_cookie_t cookie; xcb_shape_query_version_reply_t *reply; - Eina_Bool _shape_avail = EINA_FALSE; + Eina_Bool _shape_avail; + _shape_avail = EINA_FALSE; cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn); reply = xcb_shape_query_version_reply(_ecore_xcb_conn, cookie, NULL); if (reply) diff --git a/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c b/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c index 2028832..faa70c6 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c @@ -73,6 +73,7 @@ ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection) #endif if (!_xfixes_avail) return EINA_FALSE; + #ifdef ECORE_XCB_XFIXES root = ((xcb_screen_t *)_ecore_xcb_screen)->root; @@ -128,6 +129,8 @@ ecore_x_region_new(Ecore_X_Rectangle *rects, int num) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return 0; + #ifdef ECORE_XCB_XFIXES xrects = _ecore_xcb_rect_to_xcb(rects, num); region = xcb_generate_id(_ecore_xcb_conn); @@ -155,6 +158,8 @@ ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return 0; + #ifdef ECORE_XCB_XFIXES region = xcb_generate_id(_ecore_xcb_conn); xcb_xfixes_create_region_from_bitmap(_ecore_xcb_conn, region, bitmap); @@ -182,6 +187,8 @@ ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return 0; + #ifdef ECORE_XCB_XFIXES region = xcb_generate_id(_ecore_xcb_conn); xcb_xfixes_create_region_from_window(_ecore_xcb_conn, region, win, type); @@ -206,6 +213,8 @@ ecore_x_region_new_from_gc(Ecore_X_GC gc) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return 0; + #ifdef ECORE_XCB_XFIXES region = xcb_generate_id(_ecore_xcb_conn); xcb_xfixes_create_region_from_gc(_ecore_xcb_conn, region, gc); @@ -230,6 +239,8 @@ ecore_x_region_new_from_picture(Ecore_X_Picture picture) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return 0; + #ifdef ECORE_XCB_XFIXES region = xcb_generate_id(_ecore_xcb_conn); xcb_xfixes_create_region_from_picture(_ecore_xcb_conn, region, picture); @@ -251,6 +262,8 @@ ecore_x_region_free(Ecore_X_Region region) { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_destroy_region(_ecore_xcb_conn, region); // ecore_x_flush(); @@ -276,6 +289,8 @@ ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num) LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xrects = _ecore_xcb_rect_to_xcb(rects, num); xcb_xfixes_set_region(_ecore_xcb_conn, region, num, xrects); @@ -297,6 +312,8 @@ ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source) { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + // NB: Hmmmm...this may need converting to/fro xcb_rectangle_t #ifdef ECORE_XCB_XFIXES xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest); @@ -319,6 +336,8 @@ ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Regi { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest); // ecore_x_flush(); @@ -340,6 +359,8 @@ ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Re { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest); // ecore_x_flush(); @@ -361,6 +382,8 @@ ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Reg { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest); // ecore_x_flush(); @@ -387,6 +410,8 @@ ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Re LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xrects.x = bounds->x; xrects.y = bounds->y; @@ -412,6 +437,8 @@ ecore_x_region_translate(Ecore_X_Region region, int dx, int dy) { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy); // ecore_x_flush(); @@ -431,6 +458,8 @@ ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source) { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest); // ecore_x_flush(); @@ -468,6 +497,7 @@ ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds) if (num) *num = 0; if (bounds) *bounds = extents; + if (!_xfixes_avail) return NULL; #ifdef ECORE_XCB_XFIXES cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region); @@ -524,6 +554,8 @@ ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int l { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom); // ecore_x_flush(); @@ -551,6 +583,8 @@ ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x, int y) { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x, y); // ecore_x_flush(); @@ -575,6 +609,8 @@ ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window dest, Ecor { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x, y, region); // ecore_x_flush(); @@ -601,6 +637,8 @@ ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, { LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!_xfixes_avail) return; + #ifdef ECORE_XCB_XFIXES xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x, y); // ecore_x_flush(); -- 2.7.4