From 4e0cc9332e709f50f2a915b53fec644e46ada731 Mon Sep 17 00:00:00 2001 From: caro Date: Sun, 19 Apr 2009 06:36:47 +0000 Subject: [PATCH] * fix warnings * add missing guards * add missing QueryVersion check for the screensaver extension git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@40207 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/ecore_x/xcb/ecore_xcb.c | 24 ++++++++++++++++- src/lib/ecore_x/xcb/ecore_xcb_atom.c | 2 ++ src/lib/ecore_x/xcb/ecore_xcb_dnd.c | 2 ++ src/lib/ecore_x/xcb/ecore_xcb_icccm.c | 6 +++-- src/lib/ecore_x/xcb/ecore_xcb_netwm.c | 6 ++++- src/lib/ecore_x/xcb/ecore_xcb_randr.c | 4 +++ src/lib/ecore_x/xcb/ecore_xcb_screensaver.c | 40 +++++++++++++++++++++++++++++ src/lib/ecore_x/xcb/ecore_xcb_selection.c | 2 ++ src/lib/ecore_x/xcb/ecore_xcb_shape.c | 2 ++ src/lib/ecore_x/xcb/ecore_xcb_window.c | 5 +++- src/lib/ecore_x/xcb/ecore_xcb_window_prop.c | 2 ++ 11 files changed, 90 insertions(+), 5 deletions(-) diff --git a/src/lib/ecore_x/xcb/ecore_xcb.c b/src/lib/ecore_x/xcb/ecore_xcb.c index 6aa4c17..65fb2f2 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb.c +++ b/src/lib/ecore_x/xcb/ecore_xcb.c @@ -2,9 +2,12 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include + #include -#include "Ecore.h" +#include + #include "ecore_xcb_private.h" #include "Ecore_X_Atoms.h" @@ -371,14 +374,33 @@ ecore_x_init(const char *name) /*********************/ /* We ask for the QueryVersion request of the extensions */ +#ifdef ECORE_XCB_DAMAGE _ecore_x_damage_init(reply_damage); +#endif /* ECORE_XCB_DAMAGE */ +#ifdef ECORE_XCB_COMPOSITE _ecore_x_composite_init(reply_composite); +#endif /* ECORE_XCB_COMPOSITE */ +#ifdef ECORE_XCB_DPMS _ecore_x_dpms_init(reply_dpms); +#endif /* ECORE_XCB_DPMS */ +#ifdef ECORE_XCB_RANDR _ecore_x_randr_init(reply_randr); +#endif /* ECORE_XCB_RANDR */ +#ifdef ECORE_XCB_SCREENSAVER + _ecore_x_screensaver_init(reply_screensaver); +#endif /* ECORE_XCB_SCREENSAVER */ +#ifdef ECORE_XCB_SHAPE _ecore_x_shape_init(reply_shape); +#endif /* ECORE_XCB_SHAPE */ +#ifdef ECORE_XCB_SYNC _ecore_x_sync_init(reply_sync); +#endif /* ECORE_XCB_SYNC */ +#ifdef ECORE_XCB_FIXES _ecore_x_xfixes_init(reply_xfixes); +#endif /* ECORE_XCB_FIXES */ +#ifdef ECORE_XCB_XINERAMA _ecore_x_xinerama_init(reply_xinerama); +#endif /* ECORE_XCB_XINERAMA */ /* we enable the Big Request extension if present */ max_request_length = xcb_get_maximum_request_length(_ecore_xcb_conn); diff --git a/src/lib/ecore_x/xcb/ecore_xcb_atom.c b/src/lib/ecore_x/xcb/ecore_xcb_atom.c index 0813d45..ac087e8 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_atom.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_atom.c @@ -2,6 +2,8 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include + #include "ecore_xcb_private.h" diff --git a/src/lib/ecore_x/xcb/ecore_xcb_dnd.c b/src/lib/ecore_x/xcb/ecore_xcb_dnd.c index 5dfa49c..dfa5562 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_dnd.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_dnd.c @@ -2,6 +2,8 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include + #include "Ecore.h" #include "ecore_xcb_private.h" #include "Ecore_X_Atoms.h" diff --git a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c index c5b0113..8a498de 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_icccm.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_icccm.c @@ -9,11 +9,13 @@ * client. */ -#include "ecore_xcb_private.h" -#include "Ecore_X_Atoms.h" +#include #include +#include "ecore_xcb_private.h" +#include "Ecore_X_Atoms.h" + /** * @defgroup Ecore_X_ICCCM_Group ICCCM related functions. diff --git a/src/lib/ecore_x/xcb/ecore_xcb_netwm.c b/src/lib/ecore_x/xcb/ecore_xcb_netwm.c index 90affc7..9882e39 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_netwm.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_netwm.c @@ -6,7 +6,11 @@ * _NET_WM... aka Extended Window Manager Hint (EWMH) functions. */ -#include "Ecore_Data.h" +#include +#include + +#include + #include "ecore_xcb_private.h" #include "Ecore_X_Atoms.h" diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c index d2e0b9d..60ef77f 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c @@ -120,11 +120,13 @@ ecore_x_randr_events_select(Ecore_X_Window window, EAPI void ecore_x_randr_get_screen_info_prefetch(Ecore_X_Window window) { +#ifdef ECORE_XCB_RANDR xcb_randr_get_screen_info_cookie_t cookie; cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, _xcb_randr_root_to_screen(window)); _ecore_xcb_cookie_cache(cookie.sequence); +#endif /* ECORE_XCB_RANDR */ } @@ -135,12 +137,14 @@ ecore_x_randr_get_screen_info_prefetch(Ecore_X_Window window) EAPI void ecore_x_randr_get_screen_info_fetch(void) { +#ifdef ECORE_XCB_RANDR xcb_randr_get_screen_info_cookie_t cookie; xcb_randr_get_screen_info_reply_t *reply; cookie.sequence = _ecore_xcb_cookie_get(); reply =xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); _ecore_xcb_reply_cache(reply); +#endif /* ECORE_XCB_RANDR */ } /** diff --git a/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c b/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c index b97b522..9dc13a6 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c @@ -12,6 +12,46 @@ */ +#ifdef ECORE_XCB_SCREENSAVER +static int _screensaver_available = 0; +static xcb_screensaver_query_version_cookie_t _ecore_xcb_screensaver_init_cookie; +#endif /* ECORE_XCB_SCREENSAVER */ + + +/* To avoid round trips, the initialization is separated in 2 + functions: _ecore_xcb_screensaver_init and + _ecore_xcb_screensaver_init_finalize. The first one gets the cookies and + the second one gets the replies and set the atoms. */ + +void +_ecore_x_screensaver_init(const xcb_query_extension_reply_t *reply) +{ +#ifdef ECORE_XCB_SCREENSAVER + if (reply && (reply->present)) + _ecore_xcb_screensaver_init_cookie = xcb_screensaver_query_version_unchecked(_ecore_xcb_conn, 1, 1); +#endif /* ECORE_XCB_SCREENSAVER */ +} + +void +_ecore_x_screensaver_init_finalize(void) +{ +#ifdef ECORE_XCB_SCREENSAVER + xcb_screensaver_query_version_reply_t *reply; + + reply = xcb_screensaver_query_version_reply(_ecore_xcb_conn, + _ecore_xcb_screensaver_init_cookie, NULL); + + if (reply) + { + if ((reply->server_major_version >= 1) && + (reply->server_minor_version >= 1)) + _screensaver_available = 1; + free(reply); + } +#endif /* ECORE_XCB_SCREENSAVER */ +} + + /** * Return whether the X server supports the ScreenSaver Extension. * @return 1 if the X ScreenSaver Extension is available, 0 otherwise. diff --git a/src/lib/ecore_x/xcb/ecore_xcb_selection.c b/src/lib/ecore_x/xcb/ecore_xcb_selection.c index dd4d075..d329add 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_selection.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_selection.c @@ -2,6 +2,8 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include + #include "ecore_xcb_private.h" #include "Ecore_X_Atoms.h" diff --git a/src/lib/ecore_x/xcb/ecore_xcb_shape.c b/src/lib/ecore_x/xcb/ecore_xcb_shape.c index a85b2b7..c0f2486 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_shape.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_shape.c @@ -178,6 +178,7 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win, int width, int height) { +#ifdef ECORE_XCB_SHAPE xcb_rectangle_t rect; rect.x = x; @@ -187,6 +188,7 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window dest_win, xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT, XCB_SHAPE_SK_BOUNDING, 0, dest_win, 0, 0, 1, &rect); +#endif /* ECORE_XCB_SHAPE */ } EAPI void diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window.c b/src/lib/ecore_x/xcb/ecore_xcb_window.c index 2dee1c3..a9eabb3 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_window.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_window.c @@ -2,7 +2,10 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ -#include "Ecore.h" +#include + +#include + #include "ecore_xcb_private.h" #include "Ecore_X_Atoms.h" diff --git a/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c b/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c index c7b81af..14d539f 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c @@ -2,6 +2,8 @@ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 */ +#include + #include "ecore_xcb_private.h" #include "Ecore_X_Atoms.h" -- 2.7.4