[cogl/wip/wayland-compositor: 17/18] remove _cogl_xlib_trap/untrap_errors wrappers



commit 2fea98c935712d5f6e14e9c7b707330355202103
Author: Robert Bragg <robert linux intel com>
Date:   Wed May 25 22:23:06 2011 +0100

    remove _cogl_xlib_trap/untrap_errors wrappers
    
    This removes the redundant _cogl_xlib_trap/untrap_errors functions that
    simply wrap equivalent functions in the _cogl_renderer_xlib namespace.
    These were originally only required while the EGL winsys was being
    handled in clutter and so there wasn't a CoglRenderer in all cases.

 cogl/cogl-renderer-xlib-private.h |   17 +++++++++--------
 cogl/cogl-xlib-private.h          |    6 ------
 cogl/cogl-xlib.c                  |   17 -----------------
 cogl/winsys/cogl-winsys-egl.c     |    5 +++--
 cogl/winsys/cogl-winsys-glx.c     |   11 ++++++-----
 5 files changed, 18 insertions(+), 38 deletions(-)
---
diff --git a/cogl/cogl-renderer-xlib-private.h b/cogl/cogl-renderer-xlib-private.h
index bc8ccb5..c9df5df 100644
--- a/cogl/cogl-renderer-xlib-private.h
+++ b/cogl/cogl-renderer-xlib-private.h
@@ -49,13 +49,14 @@ _cogl_renderer_xlib_disconnect (CoglRenderer *renderer);
  * cogl_renderer_xlib_trap_errors:
  * @state: A temporary place to store data for the trap.
  *
- * Traps every X error until _cogl_xlib_untrap_errors() called. You
- * should allocate an uninitialised CoglXlibTrapState struct on the
- * stack to pass to this function. The same pointer should later be
- * passed to _cogl_xlib_untrap_errors(). Calls to
- * _cogl_xlib_trap_errors() can be nested as long as
- * _cogl_xlib_untrap_errors() is called with the corresponding state
- * pointers in reverse order.
+ * Traps every X error until _cogl_renderer_xlib_untrap_errors()
+ * called. You should allocate an uninitialised CoglXlibTrapState
+ * struct on the stack to pass to this function. The same pointer
+ * should later be passed to _cogl_renderer_xlib_untrap_errors().
+ *
+ * Calls to _cogl_renderer_xlib_trap_errors() can be nested as long as
+ * _cogl_renderer_xlib_untrap_errors() is called with the
+ * corresponding state pointers in reverse order.
  */
 void
 _cogl_renderer_xlib_trap_errors (CoglRenderer *renderer,
@@ -63,7 +64,7 @@ _cogl_renderer_xlib_trap_errors (CoglRenderer *renderer,
 
 /*
  * cogl_renderer_xlib_untrap_errors:
- * @state: The state that was passed to _cogl_xlib_trap_errors().
+ * @state: The state that was passed to _cogl_renderer_xlib_trap_errors().
  *
  * Removes the X error trap and returns the current status.
  *
diff --git a/cogl/cogl-xlib-private.h b/cogl/cogl-xlib-private.h
index 5645439..a7077b2 100644
--- a/cogl/cogl-xlib-private.h
+++ b/cogl/cogl-xlib-private.h
@@ -46,12 +46,6 @@ _cogl_xlib_query_damage_extension (void);
 int
 _cogl_xlib_get_damage_base (void);
 
-void
-_cogl_xlib_trap_errors (CoglXlibTrapState *state);
-
-int
-_cogl_xlib_untrap_errors (CoglXlibTrapState *state);
-
 /*
  * _cogl_xlib_add_filter:
  *
diff --git a/cogl/cogl-xlib.c b/cogl/cogl-xlib.c
index c648216..6f999b3 100644
--- a/cogl/cogl-xlib.c
+++ b/cogl/cogl-xlib.c
@@ -100,23 +100,6 @@ _cogl_xlib_remove_filter (CoglNativeFilterFunc func,
 }
 
 void
-_cogl_xlib_trap_errors (CoglXlibTrapState *state)
-{
-  _COGL_GET_CONTEXT (ctxt, NO_RETVAL);
-
-  _cogl_renderer_xlib_trap_errors (ctxt->display->renderer, state);
-  return;
-}
-
-int
-_cogl_xlib_untrap_errors (CoglXlibTrapState *state)
-{
-  _COGL_GET_CONTEXT (ctxt, 0);
-
-  return _cogl_renderer_xlib_untrap_errors (ctxt->display->renderer, state);
-}
-
-void
 _cogl_xlib_query_damage_extension (void)
 {
   int damage_error;
diff --git a/cogl/winsys/cogl-winsys-egl.c b/cogl/winsys/cogl-winsys-egl.c
index 6f51992..7974ba6 100644
--- a/cogl/winsys/cogl-winsys-egl.c
+++ b/cogl/winsys/cogl-winsys-egl.c
@@ -1366,7 +1366,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 #endif
 
 #ifdef COGL_HAS_EGL_PLATFORM_POWERVR_X11_SUPPORT
-  _cogl_xlib_trap_errors (&old_state);
+  _cogl_renderer_xlib_trap_errors (context->display->renderer, &old_state);
 
   if (!xlib_onscreen->is_foreign_xwin && xlib_onscreen->xwin != None)
     {
@@ -1378,7 +1378,8 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 
   XSync (xlib_renderer->xdpy, False);
 
-  if (_cogl_xlib_untrap_errors (&old_state) != Success)
+  if (_cogl_renderer_xlib_untrap_errors (context->display->renderer,
+                                         &old_state) != Success)
     g_warning ("X Error while destroying X window");
 #endif
 
diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c
index 82008d6..f5baa79 100644
--- a/cogl/winsys/cogl-winsys-glx.c
+++ b/cogl/winsys/cogl-winsys-glx.c
@@ -865,7 +865,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
   if (glx_onscreen == NULL)
     return;
 
-  _cogl_xlib_trap_errors (&old_state);
+  _cogl_renderer_xlib_trap_errors (context->display->renderer, &old_state);
 
   if (glx_onscreen->glxwin != None)
     {
@@ -883,7 +883,7 @@ _cogl_winsys_onscreen_deinit (CoglOnscreen *onscreen)
 
   XSync (xlib_renderer->xdpy, False);
 
-  _cogl_xlib_untrap_errors (&old_state);
+  _cogl_renderer_xlib_untrap_errors (context->display->renderer, &old_state);
 
   g_slice_free (CoglOnscreenGLX, onscreen->winsys);
   onscreen->winsys = NULL;
@@ -912,7 +912,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
       if (glx_context->current_drawable == drawable)
         return;
 
-      _cogl_xlib_trap_errors (&old_state);
+      _cogl_renderer_xlib_trap_errors (context->display->renderer, &old_state);
 
       glXMakeContextCurrent (xlib_renderer->xdpy,
                              drawable, drawable,
@@ -926,7 +926,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
       if (glx_context->current_drawable == drawable)
         return;
 
-      _cogl_xlib_trap_errors (&old_state);
+      _cogl_renderer_xlib_trap_errors (context->display->renderer, &old_state);
 
       COGL_NOTE (WINSYS,
                  "MakeContextCurrent dpy: %p, window: 0x%x (%s), context: %p",
@@ -973,7 +973,8 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
 
   /* FIXME: We should be reporting a GError here
    */
-  if (_cogl_xlib_untrap_errors (&old_state))
+  if (_cogl_renderer_xlib_untrap_errors (context->display->renderer,
+                                         &old_state))
     {
       g_warning ("X Error received while making drawable 0x%08lX current",
                  drawable);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]