* fix warnings
authorcaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 19 Apr 2009 06:36:47 +0000 (06:36 +0000)
committercaro <caro@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 19 Apr 2009 06:36:47 +0000 (06:36 +0000)
 * 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
src/lib/ecore_x/xcb/ecore_xcb_atom.c
src/lib/ecore_x/xcb/ecore_xcb_dnd.c
src/lib/ecore_x/xcb/ecore_xcb_icccm.c
src/lib/ecore_x/xcb/ecore_xcb_netwm.c
src/lib/ecore_x/xcb/ecore_xcb_randr.c
src/lib/ecore_x/xcb/ecore_xcb_screensaver.c
src/lib/ecore_x/xcb/ecore_xcb_selection.c
src/lib/ecore_x/xcb/ecore_xcb_shape.c
src/lib/ecore_x/xcb/ecore_xcb_window.c
src/lib/ecore_x/xcb/ecore_xcb_window_prop.c

index 6aa4c17..65fb2f2 100644 (file)
@@ -2,9 +2,12 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 
+#include <string.h>
+
 #include <X11/keysym.h>
 
-#include "Ecore.h"
+#include <Ecore.h>
+
 #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);
index 0813d45..ac087e8 100644 (file)
@@ -2,6 +2,8 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 
+#include <string.h>
+
 #include "ecore_xcb_private.h"
 
 
index 5dfa49c..dfa5562 100644 (file)
@@ -2,6 +2,8 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 
+#include <string.h>
+
 #include "Ecore.h"
 #include "ecore_xcb_private.h"
 #include "Ecore_X_Atoms.h"
index c5b0113..8a498de 100644 (file)
@@ -9,11 +9,13 @@
  * client.
  */
 
-#include "ecore_xcb_private.h"
-#include "Ecore_X_Atoms.h"
+#include <string.h>
 
 #include <xcb/xcb_icccm.h>
 
+#include "ecore_xcb_private.h"
+#include "Ecore_X_Atoms.h"
+
 
 /**
  * @defgroup Ecore_X_ICCCM_Group ICCCM related functions.
index 90affc7..9882e39 100644 (file)
@@ -6,7 +6,11 @@
  * _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
  */
 
-#include "Ecore_Data.h"
+#include <stdio.h>
+#include <string.h>
+
+#include <Ecore_Data.h>
+
 #include "ecore_xcb_private.h"
 #include "Ecore_X_Atoms.h"
 
index d2e0b9d..60ef77f 100644 (file)
@@ -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 */
 }
 
 /**
index b97b522..9dc13a6 100644 (file)
   */
 
 
+#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.
index dd4d075..d329add 100644 (file)
@@ -2,6 +2,8 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 
+#include <string.h>
+
 #include "ecore_xcb_private.h"
 #include "Ecore_X_Atoms.h"
 
index a85b2b7..c0f2486 100644 (file)
@@ -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
index 2dee1c3..a9eabb3 100644 (file)
@@ -2,7 +2,10 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 
-#include "Ecore.h"
+#include <string.h>
+
+#include <Ecore.h>
+
 #include "ecore_xcb_private.h"
 #include "Ecore_X_Atoms.h"
 
index c7b81af..14d539f 100644 (file)
@@ -2,6 +2,8 @@
  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
  */
 
+#include <string.h>
+
 #include "ecore_xcb_private.h"
 #include "Ecore_X_Atoms.h"